1 from __future__
import print_function
4 from Configuration.PyReleaseValidation.WorkFlow
import WorkFlow
5 from Configuration.PyReleaseValidation.MatrixUtil
import InputInfo
44 'relval_highstats':
'hi-' ,
45 'relval_pileup':
'PU-' ,
46 'relval_generator':
'gen-',
47 'relval_extendedgen':
'genExt-',
48 'relval_production':
'prod-' ,
50 'relval_upgrade':
'upg-',
51 'relval_2017':
'2017-',
52 'relval_2023':
'2023-',
53 'relval_identity':
'id-',
54 'relval_machine':
'mach-',
55 'relval_unsch':
'unsch-',
56 'relval_premix':
'premix-' 59 self.
files = [
'relval_standard' ,
75 'relval_highstats':
True ,
77 'relval_generator':
True,
78 'relval_extendedgen':
True,
79 'relval_production':
True,
81 'relval_upgrade':
False,
84 'relval_identity':
False,
85 'relval_machine':
True,
99 for k,v
in step.items():
100 if 'no_exec' in k :
continue 101 if k.lower() ==
'cfg':
104 if k.lower() ==
'input':
111 cmd +=
' ' + k +
' ' +
str(v)
112 return cfg, input, cmd
116 if len(overrides) > 0:
117 copyStep=
merge([overrides]+[step])
122 def readMatrix(self, fileNameIn, useInput=None, refRel=None, fromScratch=None):
126 print(
"processing", fileNameIn)
129 _tmpMod = __import__(
'Configuration.PyReleaseValidation.'+fileNameIn )
130 self.
relvalModule = sys.modules[
'Configuration.PyReleaseValidation.'+fileNameIn]
131 except Exception
as e:
132 print(
"ERROR importing file ", fileNameIn,
str(e))
135 if useInput
is not None:
136 print(
"request for INPUT for ", useInput)
146 for k
in self.relvalModule.workflows.keys():
152 for k
in self.relvalModule.workflows.keys():
153 fromInput[
float(k)]=0
155 fromInput[
float(i)]=0
158 fromScratch=
map(float,fromScratch)
159 for num
in fromScratch:
165 self.relvalModule.steps.overwrite(p)
170 refRels=refRel.split(
',')
171 if len(refRels)!=len(self.relvalModule.baseDataSetRelease):
173 self.relvalModule.changeRefRelease(
174 self.relvalModule.steps,
175 list(
zip(self.relvalModule.baseDataSetRelease,refRels))
178 self.relvalModule.changeRefRelease(
179 self.relvalModule.steps,
180 [(x,refRel)
for x
in self.relvalModule.baseDataSetRelease]
184 for num, wfInfo
in self.relvalModule.workflows.items():
188 stepOverrides=wfInfo.overrides
190 if wfName.strip() ==
'': wfName = stepList[0]
196 if not isinstance(addCom, list): addCom=[addCom]
201 while len(addTo)!=len(stepList):
210 ilevel=fromInput[num]
212 for (stepIr,step)
in enumerate(reversed(stepList)):
214 stepI=(len(stepList)-stepIr)-1
220 testName=
'__'.
join(stepList[0:stepI+1])+
'INPUT' 222 testName=step+
'INPUT' 224 if testName
in self.relvalModule.steps.keys():
226 stepList[stepI]=testName
229 for p
in range(stepI):
235 for (stepI,step)
in enumerate(stepList):
241 'RECODFROMRAWRECO',
'SKIMD',
'SKIMCOSD',
'SKIMDreHLT' 247 if len(name) > 0 : name +=
'+' 252 if step+'INPUT' in self.relvalModule.steps.keys(): 253 stepName = step+"INPUT" 254 stepList.remove(step) 255 stepList.insert(stepIndex,stepName) 258 if addCom
and (
not addTo
or addTo[stepIndex]==1):
260 copyStep=
merge(addCom+[self.
makeStep(self.relvalModule.steps[stepName],stepOverrides)])
261 cfg, input, opts = self.
makeCmd(copyStep)
263 cfg, input, opts = self.
makeCmd(self.
makeStep(self.relvalModule.steps[stepName],stepOverrides))
266 msg =
"FATAL ERROR: found both cfg and input for workflow "+
str(num)+
' step '+stepName
275 cmd =
'cmsDriver.py '+cfg+
' '+opts
277 cmd =
'cmsDriver.py step'+
str(stepIndex+1)+
' '+opts
279 cmd+=
' --io %s.io --python %s.py'%(stepName,stepName)
282 if stepIndex
in self.
apply or stepName
in self.
apply:
287 cmd=cmd.replace(
'DQMIO',
'DQM')
288 cmd=cmd.replace(
'--filetype DQM',
'')
290 ranStepList.append(stepName)
293 self.
workFlowSteps[(num,prefix)] = (num, name, commands, ranStepList)
298 def showRaw(self, useInput, refRel=None, fromScratch=None, what='all',step1Only=False,selected=None):
301 selected=
map(float,selected)
302 for matrixFile
in self.
files:
306 if self.
what !=
'all' and self.
what not in matrixFile:
307 print(
"ignoring non-requested file",matrixFile)
311 print(
"ignoring file not used by default (enable with -w)",matrixFile)
315 self.
readMatrix(matrixFile, useInput, refRel, fromScratch)
316 except Exception
as e:
317 print(
"ERROR reading file:", matrixFile,
str(e))
322 dataFileName = matrixFile.replace(
'relval_',
'cmsDriver_')+
'_hlt.txt' 323 outFile = open(dataFileName,
'w')
326 ids = sorted(self.workFlowSteps.keys())
331 if selected
and not (key[0]
in selected):
334 if key[0]==203.1
or key[0]==204.1
or key[0]==205.1
or key[0]==4.51
or key[0]==4.52:
continue 337 wfName,stepNames= name.split(
'+',1)
339 stepNames=stepNames.replace(
'+RECODFROMRAWRECO',
'')
340 stepNames=stepNames.replace(
'+SKIMCOSD',
'')
341 stepNames=stepNames.replace(
'+SKIMD',
'')
342 if 'HARVEST' in stepNames:
344 exactb=stepNames.index(
'+HARVEST')
345 exacte=stepNames.index(
'+',exactb+1)
if (
'+' in stepNames[exactb+1:])
else (len(stepNames))
346 stepNames=stepNames.replace(stepNames[exactb:exacte],
'')
349 step1,otherSteps = stepNames.split(
'+',1)
351 line =
str(num) +
' ++ '+ wfName
352 if otherSteps
and not step1Only:
353 line +=
' ++ ' +otherSteps.replace(
'+',
',')
357 if not isinstance(commands[0],str):
358 inputInfo=commands[0]
360 for (i,c)
in enumerate(otherSteps.split(
'+')):
362 for p
in range(len(indexAndSteps),i+2):
363 indexAndSteps.append(set())
364 indexAndSteps[i+1].
add((c,commands[i+1]))
368 if step1Only:
continue 369 line +=
' ++ REALDATA: '+inputInfo.dataSet
370 if inputInfo.run!=[]: line +=
', RUN:'+
'|'.
join(
map(str,inputInfo.run))
371 line +=
', FILES: ' +
str(inputInfo.files)
372 line +=
', EVENTS: '+
str(inputInfo.events)
373 if inputInfo.label!=
'':
374 line +=
', LABEL: ' +inputInfo.label
375 line +=
', LOCATION:'+inputInfo.location
378 line +=
' @@@ '+commands[0]
380 line=line.replace(
'DQMIO',
'DQM')
382 outFile.write(line+
'\n')
385 outFile.write(
'\n'+
'\n')
386 if step1Only:
continue 388 for (index,s)
in enumerate(indexAndSteps):
389 for (stepName,cmd)
in s:
391 if 'dasquery.log' in cmd:
continue 392 line =
'STEP%d ++ '%(stepIndex,) +stepName +
' @@@ '+cmd
394 line=line.replace(
'DQMIO',
'DQM')
395 outFile.write(line+
'\n')
396 outFile.write(
'\n'+
'\n')
398 print(
"wrote ",writtenWF,
' workflow'+(
's' if (writtenWF!=1)
else ''),
' to ', outFile.name)
404 if 'cms/caf/cms' in os.environ[
'CMS_PATH']:
409 if isinstance(workflow.cmds[0], InputInfo):
410 if cafVeto
and (workflow.cmds[0].location ==
'CAF' and not onCAF):
412 workflows.append(workflow)
417 if selected: selected =
map(float,selected)
420 fmt1 =
"%-6s %-35s [1]: %s ..." 421 fmt2 =
" %35s [%d]: %s ..." 422 print(
"\nfound a total of ", len(wfs),
' workflows:')
424 print(
" of which the following", len(selected),
'were selected:')
427 fmt1 =
"%-6s %-35s [1]: %s " 428 fmt2 =
" %35s [%d]: %s" 432 if selected
and float(wf.numId)
not in selected:
continue 433 if extended:
print(
'')
435 for i
in range(len(N),len(wf.cmds)): N.append(0)
437 wfName, stepNames = wf.nameId.split(
'+',1)
438 for i,s
in enumerate(wf.cmds):
441 print(fmt1 % (wf.numId, stepNames, (
str(s)+
' ')[:maxLen]))
443 print(fmt2 % (
' ', i+1, (
str(s)+
' ')[:maxLen]))
445 print(
"%-6s %-35s "% (wf.numId, stepNames))
448 for i,n
in enumerate(N):
449 if n:
print(n,
'workflows with',i+1,
'steps')
458 keyList = self.workFlowSteps.keys()
462 if pref != prefixIn :
continue 467 num, name, commands, stepList = val
468 nameId =
str(num)+
'_'+name
470 print(
"==> duplicate name found for ", nameId)
472 print(
' ignoring : ', val)
476 self.workFlows.append(
WorkFlow(num, name, commands=commands))
480 def prepare(self, useInput=None, refRel='', fromScratch=None):
482 for matrixFile
in self.
files:
483 if self.
what !=
'all' and self.
what not in matrixFile:
484 print(
"ignoring non-requested file",matrixFile)
487 print(
"ignoring",matrixFile,
"from default matrix")
491 self.
readMatrix(matrixFile, useInput, refRel, fromScratch)
492 except Exception
as e:
493 print(
"ERROR reading file:", matrixFile,
str(e))
498 except Exception
as e:
499 print(
"ERROR creating workflows :",
str(e))
503 def show(self, selected=None, extended=True, cafVeto=True):
506 print(
'\n',
'-'*80,
'\n')
512 pickle.dump(self.
workFlows, open(
'theMatrix.pkl',
'w') )
revertDqmio
maybe we want too level deep input
def prepare(self, useInput=None, refRel='', fromScratch=None)
S & print(S &os, JobReport::InputFile const &f)
def readMatrix(self, fileNameIn, useInput=None, refRel=None, fromScratch=None)
OutputIterator zip(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp)
def makeStep(self, step, overrides)
def showWorkFlows(self, selected=None, extended=True, cafVeto=True)
def show(self, selected=None, extended=True, cafVeto=True)
def showRaw(self, useInput, refRel=None, fromScratch=None, what='all', step1Only=False, selected=None)
def reset(self, what='all')
void add(std::map< std::string, TH1 * > &h, TH1 *hist)
static std::string join(char **cmd)
def createWorkFlows(self, fileNameIn)
def workFlowsByLocation(self, cafVeto=True)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run