test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions | Variables
o2oSetup Namespace Reference

Functions

def main
 

Variables

string __author__ = 'Giacomo Govi'
 

Function Documentation

def o2oSetup.main (   argv)

Definition at line 13 of file o2oSetup.py.

13 
14 def main( argv ):
15 
16  parser = argparse.ArgumentParser()
17  parser.add_argument("-c","--create", type=str, help="create a new O2O job" )
18  parser.add_argument("-1","--enable", type=str, help="enable the O2O job" )
19  parser.add_argument("-0","--disable", type=str, help="disable the O2O job" )
20 
21  parser.add_argument("-t","--tag", type=str, help="the CondDB Tag name")
22  parser.add_argument("-i","--interval", type=str, help="the chron job interval")
23  parser.add_argument("-d","--dev", action="store_true", help="bookkeeping in dev database")
24  parser.add_argument("-a","--auth", type=str, help="path of the authentication file")
25  args = parser.parse_args()
26 
27  if not args.create and not args.enable and not args.disable:
28  parser.error("Command not given. Possible choices: create, enable, disable")
29 
30  db_service = o2olib.prod_db_service
31  if args.dev:
32  db_service = o2olib.dev_db_service
33  mgr = o2olib.O2OJobMgr()
34  ret = -1
35  if mgr.connect( db_service, args.auth ):
36  if args.create:
37  if not args.tag:
38  parser.error("Option 'tag' not provided.")
39  if not args.interval:
40  parser.error("Option 'interval' not provided.")
41  print 'creating...'
42  created = mgr.add( args.create, args.tag, args.interval, True )
43  return created
44  if args.enable:
45  mgr.set( args.enable, True )
46  if args.disable:
47  mgr.set( args.disable, False )
48  ret = 0
49  return ret
def main
Definition: o2oSetup.py:13

Variable Documentation

string o2oSetup.__author__ = 'Giacomo Govi'

Definition at line 6 of file o2oSetup.py.