CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Functions
checkPayloads Namespace Reference

Functions

def getListOfRunsAndLumiFromFile
 
def getListOfRunsAndLumiFromRR
 
def getUploadedIOVs
 
def main
 

Function Documentation

def checkPayloads.getListOfRunsAndLumiFromFile (   firstRun = -1,
  fileName = "" 
)

Definition at line 42 of file checkPayloads.py.

Referenced by main().

42 
43 def getListOfRunsAndLumiFromFile(firstRun=-1,fileName=""):
44  file = open(fileName);
45  jsonFile = file.read();
46  file.close()
47  jsonList=json.loads(jsonFile);
48 
49  selected_dcs = {};
50  for element in jsonList:
51  selected_dcs[long(element)]=jsonList[element]
52  return selected_dcs
def getListOfRunsAndLumiFromFile
def checkPayloads.getListOfRunsAndLumiFromRR (   firstRun = -1,
  error = "" 
)

Definition at line 54 of file checkPayloads.py.

References print(), and str.

54 
55 def getListOfRunsAndLumiFromRR(firstRun=-1,error=""):
56  RunReg ="http://pccmsdqm04.cern.ch/runregistry"
57  #RunReg = "http://localhost:40010/runregistry"
58  #Dataset=%Online%
59  Group = "Collisions10"
60 
61  # get handler to RR XML-RPC server
62  FULLADDRESS=RunReg + "/xmlrpc"
63  #print "RunRegistry from: ",FULLADDRESS
64  #firstRun = 153000
65  server = xmlrpclib.ServerProxy(FULLADDRESS)
66  #sel_runtable="{groupName} ='" + Group + "' and {runNumber} > " + str(firstRun) + " and {datasetName} LIKE '" + Dataset + "'"
67  sel_runtable="{groupName} ='" + Group + "' and {runNumber} > " + str(firstRun)
68 
69  tries = 0;
70  maxAttempts = 3
71  while tries<maxAttempts:
72  try:
73  run_data = server.DataExporter.export('RUN', 'GLOBAL', 'csv_runs', sel_runtable)
74  break
75  except:
76  tries += 1
77  print("Trying to get run data. This fails only 2-3 times so don't panic yet...", tries, "/", maxAttempts)
78  time.sleep(1)
79  print("Exception type: ", sys.exc_info()[0])
80  if tries==maxAttempts:
81  error = "Ok, now panic...run registry unaccessible...I'll get the runs from a json file!"
82  print(error);
83  return {};
84 
85  listOfRuns=[]
86  runErrors = {}
87  for line in run_data.split("\n"):
88  run=line.split(',')[0]
89  if run.isdigit():
90  listOfRuns.append(run)
91 
92  tries = 0
93  maxAttempts = 3
94  firstRun = listOfRuns[len(listOfRuns)-1];
95  lastRun = listOfRuns[0];
96  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"
97  while tries<maxAttempts:
98  try:
99  dcs_data = server.DataExporter.export('RUNLUMISECTION', 'GLOBAL', 'json' , sel_dcstable)
100  break
101  except:
102  tries += 1
103  print("I was able to get the list of runs and now I am trying to access the detector status", tries, "/", maxAttempts)
104  time.sleep(1)
105  print("Exception type: ", sys.exc_info()[0])
106 
107  if tries==maxAttempts:
108  error = "Ok, now panic...run registry unaccessible...I'll get the runs from a json file!"
109  print(error);
110  return {};
111 
112  #This is the original and shold work in the furture as soon as the server will be moved to a more powerfull PC
113  #while tries<maxAttempts:
114  # try:
115  # run_data = server.DataExporter.export('RUN' , 'GLOBAL', 'csv_runs', sel_runtable)
116  # dcs_data = server.DataExporter.export('RUNLUMISECTION', 'GLOBAL', 'json' , sel_dcstable)
117  # #print run_data
118  # #print dcs_data
119  # break
120  # except:
121  # print "Something wrong in accessing runregistry, retrying in 5s...."
122  # tries += 1
123  # time.sleep(2)
124  # print "Exception type: ", sys.exc_info()[0]
125  #
126  # if tries==maxAttempts:
127  # error = "Run registry unaccessible.....exiting now"
128  # sys.exit(error)
129 
130 
131 
132  selected_dcs={}
133  jsonList=json.loads(dcs_data)
134 
135  #for element in jsonList:
136  for element in listOfRuns:
137  #if element in listOfRuns:
138  if element in jsonList:
139  selected_dcs[long(element)]=jsonList[element]
140  else:
141  #print "WARNING: Run " + element + " is a collision10 run with 0 lumis in Run Registry!"
142  selected_dcs[long(element)]= [[]]
143  return selected_dcs
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
def getListOfRunsAndLumiFromRR
#define str(s)
def checkPayloads.getUploadedIOVs (   tagName,
  destDB = "oracle://cms_orcoff_prod/CMS_COND_31X_BEAMSPOT" 
)

Definition at line 17 of file checkPayloads.py.

References beamvalidation.exit(), spr.find(), and submitPVValidationJobs.split().

Referenced by main().

17 
18 def getUploadedIOVs(tagName,destDB="oracle://cms_orcoff_prod/CMS_COND_31X_BEAMSPOT"):
19  listIOVCommand = "cmscond_list_iov -c " + destDB + " -P /afs/cern.ch/cms/DB/conddb -t " + tagName
20  dbError = subprocess.getstatusoutput( listIOVCommand )
21  if dbError[0] != 0 :
22  if dbError[1].find("metadata entry \"" + tagName + "\" does not exist") != -1:
23  exit(dbError[1])
24  else:
25  exit("ERROR: Can\'t connect to db because:\n" + dbError[1])
26 
27 
28  aCommand = listIOVCommand + " | grep DB= | awk \'{print $1}\'"
29  #print aCommand
30  output = subprocess.getstatusoutput( aCommand )
31 
32  #WARNING when we pass to lumi IOV this should be long long
33  if output[1] == '':
34  exit("ERROR: The tag " + tagName + " exists but I can't get the value of the last IOV")
35 
36  runs = []
37  for run in output[1].split('\n'):
38  runs.append(long(run))
39 
40  return runs
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
def checkPayloads.main ( )

Definition at line 145 of file checkPayloads.py.

References beamvalidation.exit(), getListOfRunsAndLumiFromFile(), getUploadedIOVs(), if(), print(), and str.

146 def main():
147  usage = "USAGE: ./checkPayloads.py (optional tagNumber) (optional \"lumi\") (optional \"z\" (optional destDB)"
148  printExtra = False
149  tagNumber = "14"
150  dbBase = ""
151  sigmaZ = ""
152 
153  if len(sys.argv) >= 2:
154  if not sys.argv[1].isdigit():
155  exit(usage)
156  else:
157  tagNumber = sys.argv[1]
158  if len(sys.argv) >= 3:
159  if not sys.argv[2] == "lumi":
160  exit(usage)
161  else:
162  dbBase = "_LumiBased"
163  if len(sys.argv) >= 4:
164  if not sys.argv[3] == "z":
165  exit(usage)
166  else:
167  sigmaZ = "_SigmaZ"
168  destDB = ""
169  if(len(sys.argv) > 4):
170  destDB = sys.argv[4]
171  #132573 Beam lost immediately
172  #132958 Bad strips
173  #133081 Bad pixels bad strips
174  #133242 Bad strips
175  #133472 Bad strips
176  #133473 Only 20 lumisection, run duration 00:00:03:00
177  #133509 Should be good!!!!!!!!!!
178  #136290 Bad Pixels bad strips
179  #138560 Bad pixels bad strips
180  #138562 Bad HLT bad L1T, need to rescale the Jet Triggers
181  #139363 NOT in the bad list but only 15 lumis and stopped for DAQ problems
182  #139455 Bad Pixels and Strips and stopped because of HCAL trigger rate too high
183  #140133 Beams dumped
184  #140182 No pixel and Strips with few entries
185  #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
186  #142461 Run crashed immediately due to PIX, stable beams since LS1
187  #142465 PostCollsions10, beams lost, HCAl DQM partly working
188  #142503 Bad pixels bad strips
189  #142653 Strips not in data taking
190  #143977 No Beam Strips and Pixels bad
191  #148859 Strips and Pixels HV off waiting for beam
192 
193  knownMissingRunList = [132573,132958,133081,133242,133472,133473,136290,138560,138562,139455,140133,140182,142461,142465,142503,142653,143977,148859]
194  tagName = "BeamSpotObjects_2009" + dbBase + sigmaZ + "_v" + tagNumber + "_offline"
195  print("Checking payloads for tag " + tagName)
196  listOfRunsAndLumi = {};
197  #listOfRunsAndLumi = getListOfRunsAndLumiFromRR(-1);
198  if(not listOfRunsAndLumi):
199  listOfRunsAndLumi = getListOfRunsAndLumiFromFile(-1,"/afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions10/7TeV/StreamExpress/Cert_132440-149442_7TeV_StreamExpress_Collisions10_JSON_v3.txt");
200  tmpListOfIOVs = []
201  if(destDB != ""):
202  tmpListOfIOVs = getUploadedIOVs(tagName,destDB)
203  else:
204  tmpListOfIOVs = getUploadedIOVs(tagName)
205 
206 
207  listOfIOVs = []
208  if(dbBase == ''):
209  listOfIOVs = tmpListOfIOVs
210  else:
211  for iov in tmpListOfIOVs:
212  if((iov >> 32) not in listOfIOVs):
213  listOfIOVs.append(iov >>32)
214  RRRuns = sorted(listOfRunsAndLumi.keys())
215  for run in RRRuns:
216  #print listOfRunsAndLumiFromRR[run]
217  if run not in listOfIOVs:
218  extraMsg = ""
219  if listOfRunsAndLumi[run] == [[]]:
220  extraMsg = " but it is empty in the RR"
221  if not printExtra: continue
222  if run in knownMissingRunList :
223  extraMsg = " but this run is know to be bad " #+ runErrors[run]
224  if not printExtra: continue
225  print("Run: " + str(run) + " is missing for DB tag " + tagName + extraMsg)
226 
if(conf_.getParameter< bool >("UseStripCablingDB"))
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
#define str(s)
def getListOfRunsAndLumiFromFile