00061 :
00062 parser = argparse.ArgumentParser(prog=os.path.basename(sys.argv[0]),description="Lumi Data operations")
00063
00064 parser.add_argument('-c',dest='connect',action='store',required=True,help='connect string to lumiDB')
00065
00066 parser.add_argument('-P',dest='authpath',action='store',help='path to authentication file')
00067 parser.add_argument('-lumiversion',dest='lumiversion',action='store',help='lumi data version, optional')
00068 parser.add_argument('-siteconfpath',dest='siteconfpath',action='store',help='specific path to site-local-config.xml file, default to $CMS_PATH/SITECONF/local/JobConfig, if path undefined, fallback to cern proxy&server')
00069 parser.add_argument('action',choices=['listrun'],help='command actions')
00070 parser.add_argument('--raw',dest='printraw',action='store_true',help='print raw data' )
00071 parser.add_argument('--verbose',dest='verbose',action='store_true',help='verbose mode for printing' )
00072 parser.add_argument('--debug',dest='debug',action='store_true',help='debug')
00073
00074 args=parser.parse_args()
00075 connectstring=args.connect
00076 connectparser=connectstrParser.connectstrParser(connectstring)
00077 connectparser.parse()
00078 usedefaultfrontierconfig=False
00079 cacheconfigpath=''
00080 if connectparser.needsitelocalinfo():
00081 if not args.siteconfpath:
00082 cacheconfigpath=os.environ['CMS_PATH']
00083 if cacheconfigpath:
00084 cacheconfigpath=os.path.join(cacheconfigpath,'SITECONF','local','JobConfig','site-local-config.xml')
00085 else:
00086 usedefaultfrontierconfig=True
00087 else:
00088 cacheconfigpath=args.siteconfpath
00089 cacheconfigpath=os.path.join(cacheconfigpath,'site-local-config.xml')
00090 p=cacheconfigParser.cacheconfigParser()
00091 if usedefaultfrontierconfig:
00092 p.parseString(c.defaultfrontierConfigString)
00093 else:
00094 p.parse(cacheconfigpath)
00095 connectstring=connectparser.fullfrontierStr(connectparser.schemaname(),p.parameterdict())
00096
00097 runnumber=0
00098 svc = coral.ConnectionService()
00099 isverbose=False
00100 if args.debug :
00101 msg=coral.MessageStream('')
00102 msg.setMsgVerbosity(coral.message_Level_Debug)
00103 c.VERBOSE=True
00104
00105 if args.verbose :
00106 c.VERBOSE=True
00107 if args.authpath and len(args.authpath)!=0:
00108 os.environ['CORAL_AUTH_PATH']=args.authpath
00109
00110 session=svc.connect(connectstring,accessMode=coral.access_Update)
00111 session.typeConverter().setCppTypeForSqlType("unsigned int","NUMBER(10)")
00112
00113 if args.action == 'listrun':
00114 lumiversion=''
00115 if args.lumiversion:
00116 lumiversion=args.lumiversion
00117 runlist=runListInDB(session,lumiversion)
00118 if args.printraw:
00119 print runlist
00120 else: printRunList(runlist)
00121
00122 del session
del svc