Functions | |
def | getListOfRunsAndLumiFromFile |
def | getListOfRunsAndLumiFromRR |
def | getUploadedIOVs |
def | main |
def checkPayloads::getListOfRunsAndLumiFromFile | ( | firstRun = -1 , |
|
fileName = "" |
|||
) |
Definition at line 41 of file checkPayloads.py.
def checkPayloads::getListOfRunsAndLumiFromRR | ( | firstRun = -1 , |
|
error = "" |
|||
) |
Definition at line 53 of file checkPayloads.py.
00054 : 00055 RunReg ="https://pccmsdqm04.cern.ch/runregistry" 00056 #RunReg = "https://localhost:40010/runregistry" 00057 #Dataset=%Online% 00058 Group = "Collisions10" 00059 00060 # get handler to RR XML-RPC server 00061 FULLADDRESS=RunReg + "/xmlrpc" 00062 #print "RunRegistry from: ",FULLADDRESS 00063 #firstRun = 153000 00064 server = xmlrpclib.ServerProxy(FULLADDRESS) 00065 #sel_runtable="{groupName} ='" + Group + "' and {runNumber} > " + str(firstRun) + " and {datasetName} LIKE '" + Dataset + "'" 00066 sel_runtable="{groupName} ='" + Group + "' and {runNumber} > " + str(firstRun) 00067 00068 tries = 0; 00069 maxAttempts = 3 00070 while tries<maxAttempts: 00071 try: 00072 run_data = server.DataExporter.export('RUN', 'GLOBAL', 'csv_runs', sel_runtable) 00073 break 00074 except: 00075 tries += 1 00076 print "Trying to get run data. This fails only 2-3 times so don't panic yet...", tries, "/", maxAttempts 00077 time.sleep(1) 00078 print "Exception type: ", sys.exc_info()[0] 00079 if tries==maxAttempts: 00080 error = "Ok, now panic...run registry unaccessible...I'll get the runs from a json file!" 00081 print error; 00082 return {}; 00083 00084 listOfRuns=[] 00085 runErrors = {} 00086 for line in run_data.split("\n"): 00087 run=line.split(',')[0] 00088 if run.isdigit(): 00089 listOfRuns.append(run) 00090 00091 tries = 0 00092 maxAttempts = 3 00093 firstRun = listOfRuns[len(listOfRuns)-1]; 00094 lastRun = listOfRuns[0]; 00095 sel_dcstable="{groupName} ='" + Group + "' and {runNumber} >= " + str(firstRun) + " and {runNumber} <= " + str(lastRun) + " and {parDcsBpix} = 1 and {parDcsFpix} = 1 and {parDcsTibtid} = 1 and {parDcsTecM} = 1 and {parDcsTecP} = 1 and {parDcsTob} = 1 and {parDcsEbminus} = 1 and {parDcsEbplus} = 1 and {parDcsEeMinus} = 1 and {parDcsEePlus} = 1 and {parDcsEsMinus} = 1 and {parDcsEsPlus} = 1 and {parDcsHbheA} = 1 and {parDcsHbheB} = 1 and {parDcsHbheC} = 1 and {parDcsH0} = 1 and {parDcsHf} = 1" 00096 while tries<maxAttempts: 00097 try: 00098 dcs_data = server.DataExporter.export('RUNLUMISECTION', 'GLOBAL', 'json' , sel_dcstable) 00099 break 00100 except: 00101 tries += 1 00102 print "I was able to get the list of runs and now I am trying to access the detector status", tries, "/", maxAttempts 00103 time.sleep(1) 00104 print "Exception type: ", sys.exc_info()[0] 00105 00106 if tries==maxAttempts: 00107 error = "Ok, now panic...run registry unaccessible...I'll get the runs from a json file!" 00108 print error; 00109 return {}; 00110 00111 #This is the original and shold work in the furture as soon as the server will be moved to a more powerfull PC 00112 #while tries<maxAttempts: 00113 # try: 00114 # run_data = server.DataExporter.export('RUN' , 'GLOBAL', 'csv_runs', sel_runtable) 00115 # dcs_data = server.DataExporter.export('RUNLUMISECTION', 'GLOBAL', 'json' , sel_dcstable) 00116 # #print run_data 00117 # #print dcs_data 00118 # break 00119 # except: 00120 # print "Something wrong in accessing runregistry, retrying in 5s...." 00121 # tries += 1 00122 # time.sleep(2) 00123 # print "Exception type: ", sys.exc_info()[0] 00124 # 00125 # if tries==maxAttempts: 00126 # error = "Run registry unaccessible.....exiting now" 00127 # sys.exit(error) 00128 00129 00130 00131 selected_dcs={} 00132 jsonList=json.loads(dcs_data) 00133 00134 #for element in jsonList: 00135 for element in listOfRuns: 00136 #if element in listOfRuns: 00137 if element in jsonList: 00138 selected_dcs[long(element)]=jsonList[element] 00139 else: 00140 #print "WARNING: Run " + element + " is a collision10 run with 0 lumis in Run Registry!" 00141 selected_dcs[long(element)]= [[]] 00142 return selected_dcs
def checkPayloads::getUploadedIOVs | ( | tagName, | |
destDB = "oracle://cms_orcoff_prod/CMS_COND_31X_BEAMSPOT" |
|||
) |
Definition at line 16 of file checkPayloads.py.
00016 ://cms_orcoff_prod/CMS_COND_31X_BEAMSPOT"): 00017 listIOVCommand = "cmscond_list_iov -c " + destDB + " -P /afs/cern.ch/cms/DB/conddb -t " + tagName 00018 dbError = commands.getstatusoutput( listIOVCommand ) 00019 if dbError[0] != 0 : 00020 if dbError[1].find("metadata entry \"" + tagName + "\" does not exist") != -1: 00021 exit(dbError[1]) 00022 else: 00023 exit("ERROR: Can\'t connect to db because:\n" + dbError[1]) 00024 00025 00026 aCommand = listIOVCommand + " | grep DB= | awk \'{print $1}\'" 00027 #print aCommand 00028 output = commands.getstatusoutput( aCommand ) 00029 00030 #WARNING when we pass to lumi IOV this should be long long 00031 if output[1] == '': 00032 exit("ERROR: The tag " + tagName + " exists but I can't get the value of the last IOV") 00033 00034 runs = [] 00035 for run in output[1].split('\n'): 00036 runs.append(long(run)) 00037 00038 return runs 00039
def checkPayloads::main | ( | ) |
Definition at line 144 of file checkPayloads.py.
00145 : 00146 usage = "USAGE: ./checkPayloads.py (optional tagNumber) (optional \"lumi\") (optional \"z\" (optional destDB)" 00147 printExtra = False 00148 tagNumber = "14" 00149 dbBase = "" 00150 sigmaZ = "" 00151 00152 if len(sys.argv) >= 2: 00153 if not sys.argv[1].isdigit(): 00154 exit(usage) 00155 else: 00156 tagNumber = sys.argv[1] 00157 if len(sys.argv) >= 3: 00158 if not sys.argv[2] == "lumi": 00159 exit(usage) 00160 else: 00161 dbBase = "_LumiBased" 00162 if len(sys.argv) >= 4: 00163 if not sys.argv[3] == "z": 00164 exit(usage) 00165 else: 00166 sigmaZ = "_SigmaZ" 00167 destDB = "" 00168 if(len(sys.argv) > 4): 00169 destDB = sys.argv[4] 00170 #132573 Beam lost immediately 00171 #132958 Bad strips 00172 #133081 Bad pixels bad strips 00173 #133242 Bad strips 00174 #133472 Bad strips 00175 #133473 Only 20 lumisection, run duration 00:00:03:00 00176 #133509 Should be good!!!!!!!!!! 00177 #136290 Bad Pixels bad strips 00178 #138560 Bad pixels bad strips 00179 #138562 Bad HLT bad L1T, need to rescale the Jet Triggers 00180 #139363 NOT in the bad list but only 15 lumis and stopped for DAQ problems 00181 #139455 Bad Pixels and Strips and stopped because of HCAL trigger rate too high 00182 #140133 Beams dumped 00183 #140182 No pixel and Strips with few entries 00184 #141865 Pixel are bad but Strips work. Run is acceptable but need relaxed cuts since there are no pixels. BeamWidth measurement is bad 80um compared to 40um 00185 #142461 Run crashed immediately due to PIX, stable beams since LS1 00186 #142465 PostCollsions10, beams lost, HCAl DQM partly working 00187 #142503 Bad pixels bad strips 00188 #142653 Strips not in data taking 00189 #143977 No Beam Strips and Pixels bad 00190 #148859 Strips and Pixels HV off waiting for beam 00191 00192 knownMissingRunList = [132573,132958,133081,133242,133472,133473,136290,138560,138562,139455,140133,140182,142461,142465,142503,142653,143977,148859] 00193 tagName = "BeamSpotObjects_2009" + dbBase + sigmaZ + "_v" + tagNumber + "_offline" 00194 print "Checking payloads for tag " + tagName 00195 listOfRunsAndLumi = {}; 00196 #listOfRunsAndLumi = getListOfRunsAndLumiFromRR(-1); 00197 if(not listOfRunsAndLumi): 00198 listOfRunsAndLumi = getListOfRunsAndLumiFromFile(-1,"/afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions10/7TeV/StreamExpress/Cert_132440-149442_7TeV_StreamExpress_Collisions10_JSON_v3.txt"); 00199 tmpListOfIOVs = [] 00200 if(destDB != ""): 00201 tmpListOfIOVs = getUploadedIOVs(tagName,destDB) 00202 else: 00203 tmpListOfIOVs = getUploadedIOVs(tagName) 00204 00205 00206 listOfIOVs = [] 00207 if(dbBase == ''): 00208 listOfIOVs = tmpListOfIOVs 00209 else: 00210 for iov in tmpListOfIOVs: 00211 if((iov >> 32) not in listOfIOVs): 00212 listOfIOVs.append(iov >>32) 00213 RRRuns = listOfRunsAndLumi.keys() 00214 RRRuns.sort() 00215 for run in RRRuns: 00216 #print listOfRunsAndLumiFromRR[run] 00217 if run not in listOfIOVs: 00218 extraMsg = "" 00219 if listOfRunsAndLumi[run] == [[]]: 00220 extraMsg = " but it is empty in the RR" 00221 if not printExtra: continue 00222 if run in knownMissingRunList : 00223 extraMsg = " but this run is know to be bad " #+ runErrors[run] 00224 if not printExtra: continue 00225 print "Run: " + str(run) + " is missing for DB tag " + tagName + extraMsg 00226