14 import Alignment.MillePedeAlignmentAlgorithm.mpslib.Mpslibclass
as mpslib
19 lib = mpslib.jobdatabase()
23 command =
' ls -l '+lib.mssDir
24 eoslsoutput = subprocess.check_output(command, stderr=subprocess.STDOUT, shell=
True).
split(
'\n')
27 for i
in xrange(len(lib.JOBID)):
61 if 'DISABLED' in lib.JOBSTATUS[i]:
64 if 'FETCH' in lib.JOBSTATUS[i]:
67 stdOut =
'jobData/'+lib.JOBDIR[i]+
'/STDOUT' 69 if os.access(stdOut+
'.gz', os.R_OK):
70 os.system(
'gunzip '+stdOut+
'.gz')
73 with open(stdOut,
"r") as STDFILE: 79 if re.search(re.compile(
'Unable to access quota space',re.M|re.I), line):
81 if re.search(re.compile(
'Unable to get quota space',re.M|re.I), line):
83 if re.search(re.compile(
'Disk quota exceeded',re.M|re.I), line):
85 if re.search(re.compile(
'CERN report: Job Killed',re.M), line):
87 if re.search(re.compile(
'Job finished',re.M), line):
89 if re.search(re.compile(
'connection timed out',re.M), line):
91 if re.search(re.compile(
'ConfigFileReadError',re.M), line):
93 if re.search(re.compile(
'0 bytes transferred',re.M), line):
95 if re.search(re.compile(
'command not found',re.M), line):
98 if re.search(re.compile(
'stage_put: Insufficient user privileges',re.M), line):
104 match = re.search(re.compile(
'This process used .+?(\d+) KSI2K seconds',re.M|re.I), line)
107 cputime =
int(round(
int(match.group(1))/cpuFactor))
110 print 'gzip -f '+stdOut
111 os.system(
'gzip -f '+stdOut)
113 if e.args == (2,
"No such file or directory"):
114 print "mps_check.py cannot find", stdOut,
"to test" 119 eazeLog =
'jobData/'+lib.JOBDIR[i]+
'/cmsRun.out' 120 if os.access(eazeLog, os.R_OK):
122 with open(eazeLog,
"r") as INFILE: 126 if re.search(re.compile(
'<StorageStatistics>',re.M), line):
128 if re.search(re.compile(
'Time limit reached\.',re.M), line):
130 if re.search(re.compile(
'gives I\/O problem',re.M), line):
132 if re.search(re.compile(
'FrameworkError ExitStatus=[\'\"]8001[\'\"]',re.M), line):
134 if re.search(re.compile(
'too many tracks',re.M), line):
136 if re.search(re.compile(
'segmentation violation',re.M), line):
138 if re.search(re.compile(
'failed RFIO error',re.M), line):
140 if re.search(re.compile(
'Request exceeds quota',re.M), line):
144 eazeLog =
'jobData/'+lib.JOBDIR[i]+
'/alignment.log' 147 if os.access(eazeLog+
'.gz', os.R_OK):
148 os.system(
'gunzip '+eazeLog+
'.gz')
151 if os.access(eazeLog, os.R_OK):
153 with open(eazeLog,
'r') as INFILE: 157 if re.search(re.compile(
'<StorageStatistics>',re.M), line):
159 if re.search(re.compile(
'EAZE\. Time limit reached\.',re.M), line):
161 if re.search(re.compile(
'GAF gives I\/O problem',re.M), line):
163 if re.search(re.compile(
'FrameworkError ExitStatus=[\'\"]8001[\'\"]',re.M), line):
165 if re.search(re.compile(
'too many tracks',re.M), line):
167 if re.search(re.compile(
'segmentation violation',re.M), line):
169 if re.search(re.compile(
'failed RFIO error',re.M), line):
171 if re.search(re.compile(
'Request exceeds quota',re.M), line):
174 if re.search(re.compile(
'Fatal Exception',re.M), line):
176 if re.search(re.compile(
'Exception caught in cmsRun',re.M), line):
179 if re.search(re.compile(
'AlignmentProducerAsAnalyzer::endJob\(\)',re.M), line):
181 if re.search(re.compile(
'FwkReport -i main_input:sourc',re.M), line):
183 nEvent =
int(array[5])
184 if nEvent==0
and re.search(re.compile(
'FwkReport -i PostSource',re.M), line):
186 nEvent =
int(array[5])
188 if nEvent==0
and re.search(re.compile(
'FwkReport -i AfterSource',re.M), line):
190 nEvent =
int(array[5])
192 if logZipped ==
'true':
193 os.system(
'gzip '+eazeLog)
196 print 'mps_check.py cannot find',eazeLog,
'to test' 202 milleOut =
'milleBinary%03d.dat' % (i+1)
208 for line
in eoslsoutput:
210 columns = line.split()
211 mOutSize = columns[4]
218 eazeLog =
'jobData/'+lib.JOBDIR[i]+
'/pede.dump' 219 if os.access(eazeLog+
'.gz', os.R_OK):
221 os.system(
'rm -f /tmp/pede.dump')
222 os.system(
'gunzip -c '+eazeLog+
'.gz > /tmp/pede.dump')
223 eazeLog =
'/tmp/pede.dump' 224 if os.access(eazeLog, os.R_OK):
225 with open(eazeLog,
"r") as INFILE: # open pede.dump 231 if re.search(re.compile(
'Millepede II.* ending',re.M), line):
234 match = re.search(re.compile(
'Peak dynamic memory allocation: (.+) GB',re.I), line)
237 mem = re.sub(
'\s',
'', mem)
239 if re.search(re.compile(
'^\d+\.\d+$',re.M), mem):
240 usedPedeMem =
float(mem)
242 print 'mps_check.py: Found Pede peak memory allocation but extracted number is not a float:',mem
246 if lib.pedeMem > 0
and usedPedeMem > 0.:
247 memoryratio = usedPedeMem /(lib.pedeMem/1024.)
250 if lib.pedeMem > 4000
and memoryratio < 0.75 :
251 msg = (
"Warning: {0:.2f} GB of memory for Pede " 252 "requested, but only {1:.1f}% of it has been " 253 "used! Consider to request less memory in order " 254 "to save resources.").
format(lib.pedeMem/1024.0,
258 msg = (
"Info: Used {0:.1f}% of {1:.2f} GB of memory " 259 "which has been requested for Pede.")
260 print msg.format(memoryratio*100, lib.pedeMem/1024.0)
264 if eazeLog ==
'/tmp/pede.dump':
265 os.system(
'rm /tmp/pede.dump')
269 print 'mps_check.py cannot find',eazeLog,
'to test' 272 eazeLog =
'jobData/'+lib.JOBDIR[i]+
'/millepede.log' 274 if os.access(eazeLog+
'.gz', os.R_OK):
275 os.system(
'gunzip '+eazeLog+
'.gz')
278 if os.access(eazeLog, os.R_OK):
280 with open(eazeLog,
"r") as INFILE: 284 if re.search(re.compile(
'step no descending',re.M), line):
286 pedeLogErrStr += line
287 if re.search(re.compile(
'Constraint equation discrepancies:',re.M), line):
289 pedeLogErrStr += line
291 if re.search(re.compile(
'insufficient constraint equations',re.M), line):
293 pedeLogWrnStr += line
295 if logZipped ==
'true':
296 os.system(
'gzip '+eazeLog)
298 print 'mps_check.py cannot find',eazeLog,
'to test' 302 eazeLog =
'jobData/'+lib.JOBDIR[i]+
'/millepede.end' 304 if os.access(eazeLog+
'.gz', os.R_OK):
305 os.system(
'gunzip'+eazeLog+
'.gz')
308 if os.access(eazeLog, os.R_OK):
310 with open(eazeLog,
"r") as INFILE: 315 match = re.search(re.compile(
'([-+]?\d+)',re.M), line)
317 if int(match.group(1)) == 1:
319 pedeLogWrnStr += line
320 elif int(match.group(1)) != 0:
322 pedeLogErrStr += line
323 if logZipped ==
'true':
324 os.system(
'gzip '+eazeLog)
326 print 'mps_check.py cannot find',eazeLog,
'to test' 334 print lib.JOBDIR[i],lib.JOBID[i],
'did not reach end of file' 337 print lib.JOBDIR[i],lib.JOBID[i],
'had quota space problem' 339 remark =
'eos quota space problem' 341 print lib.JOBDIR[i],lib.JOBID[i],
'had I/O problem' 344 print lib.JOBDIR[i],lib.JOBID[i],
'had Framework error 8001 problem' 345 remark =
'fwk error 8001' 348 print lib.JOBDIR[i],lib.JOBID[i],
'had connection timed out problem' 349 remark =
'connection timed out' 351 print lib.JOBDIR[i],lib.JOBID[i],
'had config file error' 352 remark =
'cfg file error' 355 print lib.JOBDIR[i],lib.JOBID[i],
'Job Killed (probably time exceeded)' 359 print lib.JOBDIR[i],lib.JOBID[i],
'ran into time limit' 361 if tooManyTracks == 1:
362 print lib.JOBDIR[i],lib.JOBID[i],
'too many tracks' 364 print lib.JOBDIR[i],lib.JOBID[i],
'SEGVIOL encountered' 368 print lib.JOBDIR[i],lib.JOBID[i],
'RFIO error encountered' 369 remark =
'rfio error' 372 print lib.JOBDIR[i],lib.JOBID[i],
'Request exceeds quota' 373 if exceptionCaught == 1:
374 print lib.JOBDIR[i],lib.JOBID[i],
'Exception caught in cmsrun' 375 remark =
'Exception caught' 378 print 'milleBinary???.dat file not found or empty' 379 remark =
'empty milleBinary' 380 if emptyDatOnFarm > 0:
381 print '...but already empty on farm so OK (or check job',i+1,
'yourself...)' 385 print lib.JOBDIR[i],lib.JOBID[i],
'Command not found' 386 remark =
'cmd not found' 389 print lib.JOBDIR[i],lib.JOBID[i],
'Insufficient privileges to rfcp files' 390 remark =
'Could not rfcp files' 393 print lib.JOBDIR[i],lib.JOBID[i],
'Pede did not end normally' 394 remark =
'pede failed' 397 print lib.JOBDIR[i],lib.JOBID[i],
'Problems in running Pede:' 399 remark =
'pede error' 403 print lib.JOBDIR[i],lib.JOBID[i],
'Warnings in running Pede:' 405 remark =
'pede warnings' 408 print lib.JOBDIR[i],lib.JOBID[i],
'Job not ended' 409 remark =
'job not ended' 414 print lib.JOBDIR[i],lib.JOBID[i],
' -------- ',okStatus
417 lib.JOBNEVT[i] = nEvent
419 lib.JOBSTATUS[i] = disabled+okStatus
422 lib.JOBRUNTIME[i] = cputime
424 lib.JOBREMARK[i] = remark