4 from Configuration.PyReleaseValidation.WorkFlow
import WorkFlow
43 'relval_highstats':
'hi-' ,
44 'relval_pileup':
'PU-' ,
45 'relval_generator':
'gen-',
46 'relval_extendedgen':
'genExt-',
47 'relval_production':
'prod-' ,
49 'relval_upgrade':
'upg-',
50 'relval_identity':
'id-',
51 'relval_machine':
'mach-',
52 'relval_unsch':
'unsch-'
55 self.
files = [
'relval_standard' ,
77 for k,v
in step.items():
78 if 'no_exec' in k :
continue
79 if k.lower() ==
'cfg':
82 if k.lower() ==
'input':
89 cmd +=
' ' + k +
' ' + str(v)
90 return cfg, input, cmd
92 def readMatrix(self, fileNameIn, useInput=None, refRel=None, fromScratch=None):
96 print "processing ", fileNameIn
99 _tmpMod = __import__(
'Configuration.PyReleaseValidation.'+fileNameIn )
100 self.
relvalModule = sys.modules[
'Configuration.PyReleaseValidation.'+fileNameIn]
102 print "ERROR importing file ", fileNameIn, str(e)
105 print "request for INPUT for ", useInput
115 for k
in self.relvalModule.workflows.keys():
116 fromInput[float(k)]=int(il)
118 fromInput[float(ik)]=int(il)
121 for k
in self.relvalModule.workflows.keys():
122 fromInput[float(k)]=0
124 fromInput[float(i)]=0
127 fromScratch=
map(float,fromScratch)
128 for num
in fromScratch:
134 self.relvalModule.steps.overwrite(p)
139 refRels=refRel.split(
',')
140 if len(refRels)!=len(self.relvalModule.baseDataSetRelease):
142 self.relvalModule.changeRefRelease(
143 self.relvalModule.steps,
144 zip(self.relvalModule.baseDataSetRelease,refRels)
147 self.relvalModule.changeRefRelease(
148 self.relvalModule.steps,
149 [(x,refRel)
for x
in self.relvalModule.baseDataSetRelease]
153 for num, wfInfo
in self.relvalModule.workflows.items():
158 if wfName.strip() ==
'': wfName = stepList[0]
164 if not type(addCom)==list: addCom=[addCom]
169 while len(addTo)!=len(stepList):
178 ilevel=fromInput[num]
180 for (stepIr,step)
in enumerate(reversed(stepList)):
182 stepI=(len(stepList)-stepIr)-1
188 testName=
'__'.
join(stepList[0:stepI+1])+
'INPUT'
190 testName=step+
'INPUT'
192 if testName
in self.relvalModule.steps.keys():
194 stepList[stepI]=testName
197 for p
in range(stepI):
203 for (stepI,step)
in enumerate(stepList):
209 'RECODFROMRAWRECO',
'SKIMD',
'SKIMCOSD',
'SKIMDreHLT'
215 if len(name) > 0 : name +=
'+'
220 if step+'INPUT' in self.relvalModule.steps.keys():
221 stepName = step+"INPUT"
222 stepList.remove(step)
223 stepList.insert(stepIndex,stepName)
227 if addCom
and (
not addTo
or addTo[stepIndex]==1):
229 copyStep=
merge(addCom+[self.relvalModule.steps[stepName]])
230 cfg, input, opts = self.
makeCmd(copyStep)
232 cfg, input, opts = self.
makeCmd(self.relvalModule.steps[stepName])
235 msg =
"FATAL ERROR: found both cfg and input for workflow "+str(num)+
' step '+stepName
244 cmd =
'cmsDriver.py '+cfg+
' '+opts
246 cmd =
'cmsDriver.py step'+str(stepIndex+1)+
' '+opts
248 cmd+=
' --io %s.io --python %s.py'%(stepName,stepName)
251 if stepIndex
in self.
apply or stepName
in self.
apply:
256 cmd=cmd.replace(
'DQMIO',
'DQM')
257 cmd=cmd.replace(
'--filetype DQM',
'')
259 ranStepList.append(stepName)
262 self.
workFlowSteps[(num,prefix)] = (num, name, commands, ranStepList)
267 def showRaw(self, useInput, refRel=None, fromScratch=None, what='all',step1Only=False,selected=None):
270 selected=
map(float,selected)
271 for matrixFile
in self.
files:
275 if self.
what !=
'all' and self.
what not in matrixFile:
276 print "ignoring non-requested file",matrixFile
280 self.
readMatrix(matrixFile, useInput, refRel, fromScratch)
282 print "ERROR reading file:", matrixFile, str(e)
287 dataFileName = matrixFile.replace(
'relval_',
'cmsDriver_')+
'_hlt.txt'
288 outFile = open(dataFileName,
'w')
290 print "found ", len(self.workFlowSteps.keys()),
' workflows for ', dataFileName
291 ids = self.workFlowSteps.keys()
297 if selected
and not (key[0]
in selected):
300 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
303 wfName,stepNames= name.split(
'+',1)
305 stepNames=stepNames.replace(
'+RECODFROMRAWRECO',
'')
306 stepNames=stepNames.replace(
'+SKIMCOSD',
'')
307 stepNames=stepNames.replace(
'+SKIMD',
'')
308 if 'HARVEST' in stepNames:
310 exactb=stepNames.index(
'+HARVEST')
311 exacte=stepNames.index(
'+',exactb+1)
if (
'+' in stepNames[exactb+1:])
else (len(stepNames))
312 stepNames=stepNames.replace(stepNames[exactb:exacte],
'')
315 step1,otherSteps = stepNames.split(
'+',1)
317 line = str(num) +
' ++ '+ wfName
318 if otherSteps
and not step1Only:
319 line +=
' ++ ' +otherSteps.replace(
'+',
',')
323 if not isinstance(commands[0],str):
324 inputInfo=commands[0]
326 for (i,c)
in enumerate(otherSteps.split(
'+')):
328 for p
in range(len(indexAndSteps),i+2):
329 indexAndSteps.append(set())
330 indexAndSteps[i+1].
add((c,commands[i+1]))
334 if step1Only:
continue
335 line +=
' ++ REALDATA: '+inputInfo.dataSet
336 if inputInfo.run!=[]: line +=
', RUN:'+
'|'.
join(
map(str,inputInfo.run))
337 line +=
', FILES: ' +str(inputInfo.files)
338 line +=
', EVENTS: '+str(inputInfo.events)
339 if inputInfo.label!=
'':
340 line +=
', LABEL: ' +inputInfo.label
341 line +=
', LOCATION:'+inputInfo.location
344 line +=
' @@@ '+commands[0]
346 line=line.replace(
'DQMIO',
'DQM')
348 outFile.write(line+
'\n')
351 outFile.write(
'\n'+
'\n')
352 if step1Only:
continue
354 for (index,s)
in enumerate(indexAndSteps):
355 for (stepName,cmd)
in s:
357 if 'dasquery.log' in cmd:
continue
358 line =
'STEP%d ++ '%(stepIndex,) +stepName +
' @@@ '+cmd
360 line=line.replace(
'DQMIO',
'DQM')
361 outFile.write(line+
'\n')
362 outFile.write(
'\n'+
'\n')
364 print "wrote ",writtenWF,
' workflow'+(
's' if (writtenWF!=1)
else ''),
' to ', outFile.name
369 if selected: selected =
map(float,selected)
371 fmt1 =
"%-6s %-35s [1]: %s ..."
372 fmt2 =
" %35s [%d]: %s ..."
373 print "\nfound a total of ", len(self.
workFlows),
' workflows:'
375 print " of which the following", len(selected),
'were selected:'
378 fmt1 =
"%-6s %-35s [1]: %s "
379 fmt2 =
" %35s [%d]: %s"
383 if selected
and float(wf.numId)
not in selected:
continue
384 if extended:
print ''
386 for i
in range(len(N),len(wf.cmds)): N.append(0)
388 wfName, stepNames = wf.nameId.split(
'+',1)
389 for i,s
in enumerate(wf.cmds):
392 print fmt1 % (wf.numId, stepNames, (str(s)+
' ')[:maxLen])
394 print fmt2 % (
' ', i+1, (str(s)+
' ')[:maxLen])
396 print "%-6s %-35s "% (wf.numId, stepNames)
399 for i,n
in enumerate(N):
400 if n:
print n,
'workflows with',i+1,
'steps'
409 keyList = self.workFlowSteps.keys()
413 if pref != prefixIn :
continue
418 num, name, commands, stepList = val
419 nameId = str(num)+
'_'+name
421 print "==> duplicate name found for ", nameId
422 print ' keeping : ', self.
nameList[nameId]
423 print ' ignoring : ', val
427 self.workFlows.append(
WorkFlow(num, name, commands=commands))
431 def prepare(self, useInput=None, refRel='', fromScratch=None):
433 for matrixFile
in self.
files:
434 if self.
what !=
'all' and self.
what not in matrixFile:
435 print "ignoring non-requested file",matrixFile
437 if self.
what ==
'all' and (
'upgrade' in matrixFile):
438 print "ignoring",matrixFile,
"from default matrix"
442 self.
readMatrix(matrixFile, useInput, refRel, fromScratch)
444 print "ERROR reading file:", matrixFile, str(e)
450 print "ERROR creating workflows :", str(e)
454 def show(self, selected=None, extended=True):
457 print '\n',
'-'*80,
'\n'
463 pickle.dump(self.
workFlows, open(
'theMatrix.pkl',
'w') )
revertDqmio
maybe we want too level deep input
void add(const std::vector< const T * > &source, std::vector< const T * > &dest)
static std::string join(char **cmd)