CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 41 of file checkPayloads.py.

Referenced by main().

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

Definition at line 53 of file checkPayloads.py.

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

Definition at line 16 of file checkPayloads.py.

References cmsRelvalreport.exit, spr.find(), and split.

Referenced by main().

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

Definition at line 144 of file checkPayloads.py.

References cmsRelvalreport.exit, getListOfRunsAndLumiFromFile(), getUploadedIOVs(), and if().

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