6import optparse, sys, math, subprocess
20 if opts.INPUT_FILE==
"-":
28 "including file \"MC15JobOptions/":[],
29 "including file \"MC15.":[]
38 'Events passing all checks and written':[]
42 'Weighted Filter Efficiency':[],
43 'Filter Efficiency':[]
56 'contactPhysicist':[],
59 'cross-section (nb)':[],
70 'snapshot_post_fin':[],
76 file=open(opts.INPUT_FILE,
"r")
77 lines=file.readlines()
82 checkLine(line,
'Py:Athena',JOsDict,
'INFO')
84 checkLine(line,
'MetaData',metaDataDict,
'=')
85 checkLine(line,
'Py:Generate',generateDict,
'=')
87 checkLine(line,
'Py:PerfMonSvc',perfMonDict,
':')
88 checkLine(line,
'PMonSD',perfMonDict,
'---')
90 checkLine(line,
'TestHepMC',testHepMCDict,
'=')
91 checkLine(line,
'Py:EvgenFilterSeq',evgenFilterSeqDict,
'=')
92 checkLine(line,
'CountHepMC',countHepMCDict,
'=')
93 checkLine(line,
'SimTimeEstimate',simTimeEstimateDict,
'|')
100 print(
"---------------------")
101 print(
"jobOptions and release:")
102 print(
"---------------------")
107 JOsErrors.append(
"including file \"MC15JobOptions/")
108 JOsErrors.append(
"including file \"MC15.")
112 if not len(JOsDict[
"including file \"MC15JobOptions/"]):
113 JOsErrors.append(
"including file \"MC15JobOptions/")
114 if not len(JOsDict[
"including file \"MC15."]):
115 JOsErrors.append(
"including file \"MC15.")
122 pieces=jo.replace(
'.py',
'').
split(
'.')
123 if len(pieces)
and pieces[0]==
'MC15':
128 DSIDxxx=
"DSID"+DSID[:3]+
"xxx"
131 logerr(
"",
"ERROR: More than one \"top\" JO file found!")
132 raise RuntimeError(
"More than one \"top\" JO file found")
136 svnexcomm=
"svn ls --depth infinity svn+ssh://mcfayden@svn.cern.ch/reps/atlasoff/Generators/MC15JobOptions/trunk/"
137 retcode = subprocess.Popen(svnexcomm, shell=
True,stdout=subprocess.PIPE,stderr=subprocess.PIPE).communicate()
138 svnJOs=retcode[0].
split()
141 logerr(
"",
"ERROR: Problem reading from SVN")
142 raise RuntimeError(
"Problem reading from SVN")
146 if "share/%s/%s"%(DSIDxxx,jo)
in retcode[0]:
149 logerr(
"",jo+
" ERROR <-- jobOptions not found in SVN!")
151 indices = [i
for i,s
in enumerate(svnJOs)
if "/"+jo
in s]
156 logerr(
"",jo+
" - jobOptions not found in SVN!")
158 logwarn(
"",jo+
" - multiple instances of jobOptions not found in SVN!")
160 logwarn(
"",jo+
" --> %s"%svnJOs[ix])
168 if not len(JOsDict[
'using release']):
169 JOsErrors.append(JOsDict[
'using release'])
173 val=tmp.replace(
'[',
'').
replace(
']',
'')
176 if checkBlockList(val.split(
'-')[0],val.split(
'-')[1],
'MC15JobOptions',
".",JOsList) :
177 logerr(
'- '+name+
' = ',
"".join(val)+
" <-- ERROR: Cache is blocklisted for this generator")
179 loggood(
'- '+name+
' = ',
"".join(val))
181 loginfo(
'- '+name+
' = ',
"".join(val))
186 print(
"---------------------")
187 print(
"MISSING JOs:")
189 if i ==
"including file \"MC15.":
191 logwarn(
"",
"INFO: local version of JOs used?")
193 logerr(
"",
"ERROR: %s is missing!"%i)
199 print(
"---------------------")
200 print(
"Generate params:")
201 print(
"---------------------")
202 for key
in generateDict:
204 val=generateDict[key]
207 generate.append(name)
209 if key ==
'minevents':
211 generateDict[
'minevents']=tmp
214 loginfo(
'- '+name+
' = ',
"".join(val))
216 if len(generateErrors):
217 print(
"---------------------")
218 print(
"MISSING Generate params:")
219 for i
in generateErrors:
220 logerr(
"",
"ERROR: %s is missing!"%i)
226 print(
"---------------------")
228 print(
"---------------------")
229 for key
in metaDataDict:
231 val=metaDataDict[key]
233 metaDataErrors.append(name)
235 if name==
"contactPhysicist":
237 logerr(
'- '+name+
' = ',
"".join(val)+
" <-- ERROR: No email found")
240 loginfo(
'- '+name+
' = ',
"".join(val))
242 if len(metaDataErrors):
243 print(
"---------------------")
244 print(
"MISSING Metadata:")
245 for i
in metaDataErrors:
247 loginfo(
"INFO:",
"%s is missing"%i)
249 logerr(
"",
"ERROR: %s is missing!"%i)
255 print(
"---------------------")
256 print(
"Performance metrics:")
257 print(
"---------------------")
258 for key
in perfMonDict:
262 perfMonErrors.append(name)
265 if key ==
'snapshot_post_fin':
268 tmp=float(val[0].
split()[3])
269 tmp=tmp/(1000.*60.*60.)
272 logerr(
'- '+name+
' = ',
"".join(val))
274 loggood(
'- '+name+
' = ',
"".join(val))
276 if key ==
'last -evt vmem':
277 name =
'Virtual memory'
278 tmp=float(val[0].
split()[0])
280 logerr(
'- '+name+
' = ',
"".join(val))
282 loggood(
'- '+name+
' = ',
"".join(val))
285 if len(perfMonErrors):
286 print(
"---------------------")
287 print(
"MISSING Performance metric:")
288 for i
in perfMonErrors:
289 print(
"ERROR: %s is missing!"%i)
295 'TestHepMC':testHepMCDict,
296 'EvgenFilterSeq':evgenFilterSeqDict,
297 'CountHepMC':countHepMCDict,
298 'SimTimeEstimate':simTimeEstimateDict
303 print(
"---------------------")
304 print(
"Event tests:")
305 print(
"---------------------")
306 for dictkey
in testDict:
307 for key
in testDict[dictkey]:
309 val=testDict[dictkey][key]
311 testErrors.append(
"%s %s"%(dictkey,name))
314 if dictkey==
"CountHepMC":
315 allowed_minevents_lt1000 = [1, 2, 5, 10, 20, 25, 50, 100, 200, 500]
316 if int(val[0])%1000!=0
and not int(val[0])
in allowed_minevents_lt1000:
317 logerr(
'- '+dictkey+
" "+name+
' = ',
"".join(val)+
" <-- ERROR: Not an acceptable number of events for production")
318 elif int(val[0]) != int(generateDict[
'minevents']):
319 logerr(
'- '+dictkey+
" "+name+
' = ',
"".join(val)+
" <-- ERROR: This is not equal to minevents")
321 loggood(
'- '+dictkey+
" "+name+
' = ',
"".join(val))
325 if dictkey==
"EvgenFilterSeq":
326 if float(val[0].
split()[0])<0.01:
327 logerr(
'- '+dictkey+
" "+name+
' = ',
"".join(val))
329 loggood(
'- '+dictkey+
" "+name+
' = ',
"".join(val))
332 if dictkey==
"TestHepMC" and name==
"Efficiency":
333 if float(val[0].
replace(
'%',
''))<100.:
334 logerr(
'- '+dictkey+
" "+name+
' = ',
"".join(val))
336 loggood(
'- '+dictkey+
" "+name+
' = ',
"".join(val))
340 loginfo(
'- '+dictkey+
" "+name+
' = ',
"".join(val))
343 print(
"---------------------")
344 print(
"Failed tests:")
346 if i ==
"SimTimeEstimate RUN INFORMATION":
347 logwarn(
"",
"WARNING: %s is missing!"%i)
349 logerr(
"",
"ERROR: %s is missing!"%i)
353 if opts.TOTAL_EVENTS:
356 print(
"---------------------")
359 if opts.TOTAL_EVENTS:
360 xs_nb=float(metaDataDict[
'cross-section (nb)'][0])
361 eff_lumi_fb=float(opts.TOTAL_EVENTS)/(1.E+06*xs_nb)
362 if eff_lumi_fb > 1000.:
363 logwarn(
"- Effective lumi (fb-1):",str(eff_lumi_fb))
364 elif eff_lumi_fb < 40.:
365 logwarn(
"- Effective lumi (fb-1):",str(eff_lumi_fb))
367 loggood(
"- Effective lumi (fb-1):",str(eff_lumi_fb))
368 minevents=int(generateDict[
'minevents'])
370 loginfo(
"- Number of jobs:",int(opts.TOTAL_EVENTS)/minevents)
372 if not opts.TOTAL_EVENTS
or opts.NO_SVN:
375 print(
"---------------------")
377 if not opts.TOTAL_EVENTS:
378 logwarn(
"",
"WARNING: --Ntotal (-N) flag is not used - total number of events not given - impossible to calculated effective lumi.")
380 logwarn(
"",
"WARNING: --nosvn (-x) flag is used - could not check that SVN JOs are registered or whether release is blocklisted.")
401 user = getpass.getuser()
409 blocklist =
'svn export svn+ssh://svn.cern.ch/reps/atlasoff/Generators/'+MCJobOptions+
'/trunk/common/BlackList_caches.txt'
410 tmpblockfile =
"%s/BlackList_caches.txt" % (outnamedir)
413 if 'MC15' in MCJobOptions :
414 svnexcomm=
'%s %s' % (blocklist,tmpblockfile)
415 retcode = subprocess.Popen(svnexcomm, shell=
True,stdout=subprocess.PIPE,stderr=subprocess.PIPE).communicate()
416 if retcode[1].
find(
"exist") != -1
or retcode[1].
find(
"cannot") != -1 :
417 logerr(
"",
"export failed= BlackList_caches.txt" )
420 bfile = open(tmpblockfile)
425 bad =
"".join(line.split()).
split(
",")
428 if any( bad[2]
in s
for s
in aJOs )
and branch
in bad[0]:
431 for i,c
in enumerate(cache.split(
'.')):
432 if not c == bad[1].
split(
'.')[i]:
482 if lineIdentifier
in line:
485 if len(line.split(splitby))==0:
486 raise RuntimeError(
"Found bad entry %s"%line)
488 thing=
"".join(line.split(lineIdentifier)[1].
split(splitby)[1:]).
strip()
489 dict[param].append(thing)