CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
o2oRun.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 '''
3 '''
4 
5 __author__ = 'Giacomo Govi'
6 
7 import CondCore.Utilities.o2o as o2olib
8 import sys
9 import optparse
10 import argparse
11 
12 def main( argv ):
13 
14  parser = argparse.ArgumentParser()
15  parser.add_argument("executable", type=str, help="wrapper for O2O jobs")
16  parser.add_argument("-n","--name", type=str, help="the O2O job name" )
17  parser.add_argument("-d","--dev", action="store_true", help="bookkeeping in dev database")
18  parser.add_argument("-p","--private", action="store_true", help="bookkeeping in private database")
19  parser.add_argument("-a","--auth", type=str, help="path of the authentication file")
20  args = parser.parse_args()
21 
22  if not args.name:
23  parser.error("Job name not given.")
24 
25  command = args.executable
26 
27  db_service = None
28  if not args.private:
29  if args.dev:
30  db_service = o2olib.dev_db_service
31  else:
32  db_service = o2olib.prod_db_service
33  runMgr = o2olib.O2ORunMgr()
34  ret = -1
35  if runMgr.connect( db_service, args.auth ):
36  ret = runMgr.executeJob( args.name, command )
37  return ret
38 
39 if __name__ == '__main__':
40  sys.exit(main(sys.argv))
def main
Definition: o2oRun.py:12
Definition: main.py:1