Classes | |
class | constants |
Functions | |
def | fillnumForRun |
def | hltkeyForRun |
def | l1keyForRun |
def | main |
Variables | |
string | VERSION = '1.02' |
def dumpRunInfo::fillnumForRun | ( | dbsession, | |
c, | |||
runnum | |||
) |
select string_value from cms_runinfo.runsession_parameter where runnumber=129265 and name='CMS.SCAL:FILLN' and rownum<=1;
Definition at line 17 of file dumpRunInfo.py.
00018 : 00019 '''select string_value from cms_runinfo.runsession_parameter where runnumber=129265 and name='CMS.SCAL:FILLN' and rownum<=1; 00020 00021 ''' 00022 result='' 00023 try: 00024 dbsession.transaction().start(True) 00025 schema=dbsession.schema(c.runinfoschema) 00026 if not schema: 00027 raise Exception, 'cannot connect to schema '+c.runinfoschema 00028 if not schema.existsTable(c.runsessionparameterTable): 00029 raise Exception, 'non-existing table '+c.runsessionparameterTable 00030 00031 fillOutput=coral.AttributeList() 00032 fillOutput.extend("fillnum","string") 00033 00034 bindVarList=coral.AttributeList() 00035 bindVarList.extend("name","string") 00036 bindVarList.extend("runnumber","unsigned int") 00037 00038 bindVarList["name"].setData(c.fillnumname) 00039 bindVarList["runnumber"].setData(int(runnum)) 00040 00041 query=schema.newQuery() 00042 query.addToTableList(c.runsessionparameterTable) 00043 query.addToOutputList('STRING_VALUE','value') 00044 query.setCondition('NAME=:name AND RUNNUMBER=:runnumber',bindVarList) 00045 query.limitReturnedRows(1) 00046 query.defineOutput(fillOutput) 00047 00048 cursor=query.execute() 00049 while cursor.next(): 00050 result=cursor.currentRow()['fillnum'].data() 00051 del query 00052 dbsession.transaction().commit() 00053 #print result 00054 return result 00055 except Exception,e: 00056 print str(e) 00057 dbsession.transaction().rollback() 00058 del dbsession
def dumpRunInfo::hltkeyForRun | ( | dbsession, | |
c, | |||
runnum | |||
) |
select runnumber,string_value from cms_runinfo.runsession_parameter where name=:runsessionparametername and runnumber=:runnum
Definition at line 59 of file dumpRunInfo.py.
00060 : 00061 ''' 00062 select runnumber,string_value from cms_runinfo.runsession_parameter where name=:runsessionparametername and runnumber=:runnum 00063 ''' 00064 result={} 00065 try: 00066 dbsession.transaction().start(True) 00067 schema=dbsession.schema(c.runinfoschema) 00068 if not schema: 00069 raise Exception, 'cannot connect to schema '+c.runinfoschema 00070 if not schema.existsTable(c.runsessionparameterTable): 00071 raise Exception, 'non-existing table '+c.runsessionparameterTable 00072 00073 hltkeyOutput=coral.AttributeList() 00074 hltkeyOutput.extend("runnum","unsigned int") 00075 hltkeyOutput.extend("hltkey","string") 00076 00077 bindVarList=coral.AttributeList() 00078 bindVarList.extend("name","string") 00079 bindVarList.extend("runnumber","unsigned int") 00080 00081 bindVarList["name"].setData(c.hltconfname) 00082 bindVarList["runnumber"].setData(int(runnum)) 00083 00084 query=schema.newQuery() 00085 query.addToTableList(c.runsessionparameterTable) 00086 query.addToOutputList('RUNNUMBER','runnumber') 00087 query.addToOutputList('STRING_VALUE','value') 00088 query.setCondition('NAME=:name AND RUNNUMBER=:runnumber',bindVarList) 00089 query.defineOutput(hltkeyOutput) 00090 00091 cursor=query.execute() 00092 while cursor.next(): 00093 runnum=cursor.currentRow()['runnum'].data() 00094 hltkey=cursor.currentRow()['hltkey'].data() 00095 result[runnum]=hltkey 00096 del query 00097 dbsession.transaction().commit() 00098 #print result 00099 return result 00100 except Exception,e: 00101 print str(e) 00102 dbsession.transaction().rollback() 00103 del dbsession
def dumpRunInfo::l1keyForRun | ( | dbsession, | |
c, | |||
runnum | |||
) |
select runnumber,string_value from cms_runinfo.runsession_parameter where name=:runsessionparametername and runnumber=:runnum
Definition at line 104 of file dumpRunInfo.py.
00105 : 00106 ''' 00107 select runnumber,string_value from cms_runinfo.runsession_parameter where name=:runsessionparametername and runnumber=:runnum 00108 ''' 00109 result={} 00110 try: 00111 dbsession.transaction().start(True) 00112 schema=dbsession.schema(c.runinfoschema) 00113 if not schema: 00114 raise Exception, 'cannot connect to schema '+c.runinfoschema 00115 if not schema.existsTable(c.runsessionparameterTable): 00116 raise Exception, 'non-existing table '+c.runsessionparameterTable 00117 00118 l1keyOutput=coral.AttributeList() 00119 l1keyOutput.extend("runnum","unsigned int") 00120 l1keyOutput.extend("l1key","string") 00121 00122 bindVarList=coral.AttributeList() 00123 bindVarList.extend("name","string") 00124 bindVarList.extend("runnumber","unsigned int") 00125 00126 bindVarList["name"].setData(c.tsckeyname) 00127 bindVarList["runnumber"].setData(int(runnum)) 00128 00129 query=schema.newQuery() 00130 query.addToTableList(c.runsessionparameterTable) 00131 query.addToOutputList('RUNNUMBER','runnumber') 00132 query.addToOutputList('STRING_VALUE','value') 00133 query.setCondition('NAME=:name AND RUNNUMBER=:runnumber',bindVarList) 00134 query.defineOutput(l1keyOutput) 00135 00136 cursor=query.execute() 00137 while cursor.next(): 00138 runnum=cursor.currentRow()['runnum'].data() 00139 l1key=cursor.currentRow()['l1key'].data() 00140 result[runnum]=l1key 00141 del query 00142 dbsession.transaction().commit() 00143 #print result 00144 return result 00145 except Exception,e: 00146 print str(e) 00147 dbsession.transaction().rollback() 00148 del dbsession
def dumpRunInfo::main | ( | ) |
Definition at line 149 of file dumpRunInfo.py.
00150 : 00151 c=constants() 00152 parser = argparse.ArgumentParser(prog=os.path.basename(sys.argv[0]),description="Dump Run info") 00153 parser.add_argument('-c',dest='connect',action='store',required=True,help='connect string to trigger DB(required)') 00154 parser.add_argument('-P',dest='authpath',action='store',required=True,help='path to authentication file') 00155 parser.add_argument('-r',dest='runnumber',action='store',required=True,help='run number') 00156 parser.add_argument('action',choices=['hltkey','l1key','fill'],help='information to show') 00157 parser.add_argument('--debug',dest='debug',action='store_true',help='debug') 00158 parser.add_argument('--collision-only',dest='collisiononly',action='store_true',help='return only collision runs') 00159 args=parser.parse_args() 00160 runnumber=args.runnumber 00161 c.runinfodb=args.connect 00162 if args.authpath and len(args.authpath)!=0: 00163 os.environ['CORAL_AUTH_PATH']=args.authpath 00164 svc=coral.ConnectionService() 00165 session=svc.connect(c.runinfodb,accessMode=coral.access_ReadOnly) 00166 session.typeConverter().setCppTypeForSqlType("unsigned int","NUMBER(10)") 00167 session.typeConverter().setCppTypeForSqlType("unsigned long long","NUMBER(20)") 00168 if args.debug: 00169 msg=coral.MessageStream('') 00170 msg.setMsgVerbosity(coral.message_Level_Debug) 00171 00172 if args.action == 'hltkey': 00173 p=re.compile(r'^/cdaq/physics/.+') 00174 result=hltkeyForRun(session,c,runnumber) 00175 print 'runnumber hltkey' 00176 for runnum,hltkey in result.items(): 00177 if not args.collisiononly: 00178 print runnum,hltkey 00179 if args.collisiononly and re.match(p,hltkey): 00180 fillnum=fillnumForRun(session,c,runnumber) 00181 if len(fillnum)!=0: 00182 print runnum,hltkey 00183 if args.action == 'l1key': 00184 p=re.compile(r'^TSC_.+_collisions_.+') 00185 result=l1keyForRun(session,c,runnumber) 00186 print 'runnumber tsc_key' 00187 for runnum,l1key in result.items(): 00188 if not args.collisiononly: 00189 print runnum,l1key 00190 if args.collisiononly and re.match(p,l1key): 00191 fillnum=fillnumForRun(session,c,runnumber) 00192 if len(fillnum)!=0: 00193 print runnum,l1key 00194 if args.action == 'fill': 00195 result=fillnumForRun(session,c,runnumber) 00196 print 'runnumber fill' 00197 if not args.collisiononly: 00198 print runnumber,result 00199 else: 00200 if len(result)!=0: 00201 print runnumber,result 00202 del session 00203 del svc
string dumpRunInfo::VERSION = '1.02' |
Definition at line 2 of file dumpRunInfo.py.