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("-p","--private", action="store_true", help="bookkeeping in private database")
25  parser.add_argument("-a","--auth", type=str, help="path of the authentication file")
26  args = parser.parse_args()
27 
28  if not args.create and not args.enable and not args.disable:
29  parser.error("Command not given. Possible choices: create, enable, disable")
30 
31  db_service = None
32  if not args.private:
33  if args.dev:
34  db_service = o2olib.dev_db_service
35  else:
36  db_service = o2olib.prod_db_service
37  mgr = o2olib.O2OJobMgr()
38  ret = -1
39  if mgr.connect( db_service, args.auth ):
40  if args.create:
41  if not args.tag:
42  parser.error("Option 'tag' not provided.")
43  if not args.interval:
44  parser.error("Option 'interval' not provided.")
45  print 'creating...'
46  created = mgr.add( args.create, args.tag, args.interval, True )
47  return created
48  if args.enable:
49  mgr.set( args.enable, True )
50  if args.disable:
51  mgr.set( args.disable, False )
52  ret = 0
53  return ret
def main
Definition: o2oSetup.py:13

Variable Documentation

string o2oSetup.__author__ = 'Giacomo Govi'

Definition at line 6 of file o2oSetup.py.