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("-i","--inputFromDb", action="store_true", help="get input params from the db ( labels: '$db' for the database connection string; '$tag' for the destination tag name")
18  parser.add_argument("-d","--dev", action="store_true", help="bookkeeping in dev database")
19  parser.add_argument("-a","--auth", type=str, help="path of the authentication file")
20  parser.add_argument("-v","--verbose", action="store_true", help="job output mirrored to screen (default=logfile only)")
21  args = parser.parse_args()
22 
23  if not args.name:
24  parser.error("Job name not given.")
25 
26  db_service = o2olib.prod_db_service
27  if args.dev:
28  db_service = o2olib.dev_db_service
29  runMgr = o2olib.O2ORunMgr()
30  ret = -1
31  if runMgr.connect( db_service, args ):
32  ret = runMgr.executeJob( args )
33  return ret
34 
35 if __name__ == '__main__':
36  sys.exit(main(sys.argv))
def main
Definition: o2oRun.py:12
Definition: main.py:1