CMS 3D CMS Logo

Functions

checkPayloads Namespace Reference

Functions

def getListOfRunsAndLumiFromRR
def getUploadedIOVs
def main

Function Documentation

def checkPayloads::getListOfRunsAndLumiFromRR (   lastRun = -1,
  runErrors = {} 
)

Definition at line 41 of file checkPayloads.py.

00041                                                     {}):
00042     RunReg  ="http://pccmsdqm04.cern.ch/runregistry"
00043     #RunReg  = "http://localhost:40010/runregistry"
00044     #Dataset=%Online%
00045     Group   = "Collisions10"
00046 
00047     # get handler to RR XML-RPC server
00048     FULLADDRESS=RunReg + "/xmlrpc"
00049     #print "RunRegistry from: ",FULLADDRESS
00050     server = xmlrpclib.ServerProxy(FULLADDRESS)
00051     #sel_runtable="{groupName} ='" + Group + "' and {runNumber} > " + str(lastRun) + " and {datasetName} LIKE '" + Dataset + "'"
00052     sel_runtable="{groupName} ='" + Group + "' and {runNumber} > " + str(lastRun)
00053     sel_dcstable="{groupName} ='" + Group + "' 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"
00054 
00055     tries = 0;
00056     while tries<10:
00057         try:
00058             run_data = server.DataExporter.export('RUN'           , 'GLOBAL', 'csv_runs', sel_runtable)
00059             dcs_data = server.DataExporter.export('RUNLUMISECTION', 'GLOBAL', 'json'    , sel_dcstable)
00060             #print run_data
00061             #print dcs_data
00062             break
00063         except:
00064             print "Something wrong in accessing runregistry, retrying in 5s...."
00065             tries += 1
00066             time.sleep(5)
00067         if tries==10:
00068             error = "Run registry unaccessible.....exiting now"
00069             sys.exit(error)
00070                 
00071                 
00072     listOfRuns=[]
00073     for line in run_data.split("\n"):
00074         run=line.split(',')[0]
00075         if run.isdigit():
00076             listOfRuns.append(run)
00077             runErrors[long(run)] = line.split(',')[19:27]
00078                         
00079                         
00080     selected_dcs={}
00081     jsonList=json.loads(dcs_data)
00082     
00083     #for element in jsonList:
00084     for element in listOfRuns:
00085         #if element in listOfRuns:
00086         if element in jsonList:
00087             selected_dcs[long(element)]=jsonList[element]
00088         else:
00089             #print "WARNING: Run " + element + " is a collision10 run with 0 lumis in Run Registry!"
00090             selected_dcs[long(element)]= [[]]
00091     return selected_dcs
00092 
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 94 of file checkPayloads.py.

00095           :
00096     usage = "USAGE: ./checkPayloads.py (optional tagNumber) (optional \"lumi\") (optional \"z\" (optional destDB)"
00097     printExtra = False
00098     tagNumber = "14"
00099     dbBase = ""
00100     sigmaZ = ""
00101 
00102     if len(sys.argv) >= 2:
00103         if not sys.argv[1].isdigit():
00104             exit(usage)
00105         else:
00106             tagNumber = sys.argv[1]
00107     if len(sys.argv) >= 3:
00108         if not sys.argv[2] == "lumi":
00109             exit(usage)
00110         else:
00111             dbBase = "_LumiBased"
00112     if len(sys.argv) == 4:
00113         if not sys.argv[3] == "z":
00114             exit(usage)
00115         else:
00116             sigmaZ = "_SigmaZ"
00117     destDB = ""
00118     if(len(sys.argv) > 4):
00119         destDB = sys.argv[4]
00120     #132573 Beam lost immediately
00121     #132958 Bad strips
00122     #133081 Bad pixels bad strips
00123     #133242 Bad strips
00124     #133472 Bad strips
00125     #133473 Only 20 lumisection, run duration 00:00:03:00 
00126     #133509 Should be good!!!!!!!!!!
00127     #136290 Bad Pixels bad strips
00128     #138560 Bad pixels bad strips
00129     #138562 Bad HLT bad L1T, need to rescale the Jet Triggers
00130     #139363 NOT in the bad list but only 15 lumis and stopped for DAQ problems
00131     #139455 Bad Pixels and Strips and stopped because of HCAL trigger rate too high
00132     #140133 Beams dumped
00133     #140182 No pixel and Strips with few entries
00134     #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
00135     #142461 Run crashed immediately due to PIX, stable beams since LS1
00136     #142465 PostCollsions10, beams lost, HCAl DQM partly working
00137     #142503 Bad pixels bad strips
00138     #142653 Strips not in data taking
00139     #143977 No Beam Strips and Pixels bad
00140     #148859 Strips and Pixels HV off waiting for beam 
00141     
00142     knownMissingRunList = [132573,132958,133081,133242,133472,133473,136290,138560,138562,139455,140133,140182,142461,142465,142503,142653,143977,148859]
00143     tagName = "BeamSpotObjects_2009" + dbBase + sigmaZ + "_v" + tagNumber + "_offline"
00144     print "Checking payloads for tag " + tagName
00145     runErrors = {}
00146     listOfRunsAndLumiFromRR = getListOfRunsAndLumiFromRR(-1,runErrors)
00147     tmpListOfIOVs = []
00148     if(destDB != ""):
00149         tmpListOfIOVs = getUploadedIOVs(tagName,destDB) 
00150     else:
00151         tmpListOfIOVs = getUploadedIOVs(tagName)
00152 
00153 
00154     listOfIOVs = []
00155     if(dbBase == ''):
00156         listOfIOVs = tmpListOfIOVs
00157     else:
00158         for iov in tmpListOfIOVs:
00159             if((iov >> 32) not in listOfIOVs):
00160                 listOfIOVs.append(iov >>32)
00161     RRRuns = listOfRunsAndLumiFromRR.keys()
00162     RRRuns.sort()
00163     for run in RRRuns:
00164         #print listOfRunsAndLumiFromRR[run]
00165         if run not in listOfIOVs:
00166             extraMsg = ""
00167             if listOfRunsAndLumiFromRR[run] == [[]]:
00168                 extraMsg = " but it is empty in the RR"
00169                 if not printExtra: continue
00170             if run in knownMissingRunList :
00171                 extraMsg = " but this run is know to be bad " #+ runErrors[run]
00172                 if not printExtra: continue
00173             print "Run: " + str(run) + " is missing for DB tag " + tagName + extraMsg 
00174