6 __author__ =
'Giacomo Govi'
8 import CondCore.Utilities.o2o
as o2olib
16 parser.add_argument(
"-c",
"--create", type=str, help=
"create a new O2O job" )
17 parser.add_argument(
"-1",
"--enable", type=str, help=
"enable the O2O job" )
18 parser.add_argument(
"-0",
"--disable", type=str, help=
"disable the O2O job" )
20 parser.add_argument(
"-t",
"--tag", type=str, help=
"the CondDB Tag name")
21 parser.add_argument(
"-i",
"--interval", type=str, help=
"the chron job interval")
22 parser.add_argument(
"-d",
"--dev", action=
"store_true", help=
"bookkeeping in dev database")
23 parser.add_argument(
"-a",
"--auth", type=str, help=
"path of the authentication file")
24 args = parser.parse_args()
26 if not args.create
and not args.enable
and not args.disable:
27 parser.error(
"Command not given. Possible choices: create, enable, disable")
29 db_service = o2olib.prod_db_service
31 db_service = o2olib.dev_db_service
32 mgr = o2olib.O2OJobMgr()
34 if mgr.connect( db_service, args.auth ):
37 parser.error(
"Option 'tag' not provided.")
39 parser.error(
"Option 'interval' not provided.")
41 created = mgr.add( args.create, args.tag, args.interval,
True )
44 mgr.set( args.enable,
True )
46 mgr.set( args.disable,
False )
50 if __name__ ==
'__main__':
52 sys.exit(
main(sys.argv))