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-'
56 self.
files = [
'relval_standard' ,
79 for k,v
in step.items():
80 if 'no_exec' in k :
continue
81 if k.lower() ==
'cfg':
84 if k.lower() ==
'input':
91 cmd +=
' ' + k +
' ' + str(v)
92 return cfg, input, cmd
94 def readMatrix(self, fileNameIn, useInput=None, refRel=None, fromScratch=None):
98 print "processing ", fileNameIn
101 _tmpMod = __import__(
'Configuration.PyReleaseValidation.'+fileNameIn )
102 self.
relvalModule = sys.modules[
'Configuration.PyReleaseValidation.'+fileNameIn]
104 print "ERROR importing file ", fileNameIn, str(e)
107 print "request for INPUT for ", useInput
117 for k
in self.relvalModule.workflows.keys():
118 fromInput[float(k)]=int(il)
120 fromInput[float(ik)]=int(il)
123 for k
in self.relvalModule.workflows.keys():
124 fromInput[float(k)]=0
126 fromInput[float(i)]=0
129 fromScratch=
map(float,fromScratch)
130 for num
in fromScratch:
136 self.relvalModule.steps.overwrite(p)
141 refRels=refRel.split(
',')
142 if len(refRels)!=len(self.relvalModule.baseDataSetRelease):
144 self.relvalModule.changeRefRelease(
145 self.relvalModule.steps,
146 zip(self.relvalModule.baseDataSetRelease,refRels)
149 self.relvalModule.changeRefRelease(
150 self.relvalModule.steps,
151 [(x,refRel)
for x
in self.relvalModule.baseDataSetRelease]
155 for num, wfInfo
in self.relvalModule.workflows.items():
160 if wfName.strip() ==
'': wfName = stepList[0]
166 if not type(addCom)==list: addCom=[addCom]
171 while len(addTo)!=len(stepList):
180 ilevel=fromInput[num]
182 for (stepIr,step)
in enumerate(reversed(stepList)):
184 stepI=(len(stepList)-stepIr)-1
190 testName=
'__'.
join(stepList[0:stepI+1])+
'INPUT'
192 testName=step+
'INPUT'
194 if testName
in self.relvalModule.steps.keys():
196 stepList[stepI]=testName
199 for p
in range(stepI):
205 for (stepI,step)
in enumerate(stepList):
211 'RECODFROMRAWRECO',
'SKIMD',
'SKIMCOSD',
'SKIMDreHLT'
217 if len(name) > 0 : name +=
'+'
222 if step+'INPUT' in self.relvalModule.steps.keys():
223 stepName = step+"INPUT"
224 stepList.remove(step)
225 stepList.insert(stepIndex,stepName)
229 if addCom
and (
not addTo
or addTo[stepIndex]==1):
231 copyStep=
merge(addCom+[self.relvalModule.steps[stepName]])
232 cfg, input, opts = self.
makeCmd(copyStep)
234 cfg, input, opts = self.
makeCmd(self.relvalModule.steps[stepName])
237 msg =
"FATAL ERROR: found both cfg and input for workflow "+str(num)+
' step '+stepName
246 cmd =
'cmsDriver.py '+cfg+
' '+opts
248 cmd =
'cmsDriver.py step'+str(stepIndex+1)+
' '+opts
250 cmd+=
' --io %s.io --python %s.py'%(stepName,stepName)
253 if stepIndex
in self.
apply or stepName
in self.
apply:
258 cmd=cmd.replace(
'DQMIO',
'DQM')
259 cmd=cmd.replace(
'--filetype DQM',
'')
261 ranStepList.append(stepName)
264 self.
workFlowSteps[(num,prefix)] = (num, name, commands, ranStepList)
269 def showRaw(self, useInput, refRel=None, fromScratch=None, what='all',step1Only=False,selected=None):
272 selected=
map(float,selected)
273 for matrixFile
in self.
files:
277 if self.
what !=
'all' and self.
what not in matrixFile:
278 print "ignoring non-requested file",matrixFile
282 self.
readMatrix(matrixFile, useInput, refRel, fromScratch)
284 print "ERROR reading file:", matrixFile, str(e)
289 dataFileName = matrixFile.replace(
'relval_',
'cmsDriver_')+
'_hlt.txt'
290 outFile = open(dataFileName,
'w')
292 print "found ", len(self.workFlowSteps.keys()),
' workflows for ', dataFileName
293 ids = self.workFlowSteps.keys()
299 if selected
and not (key[0]
in selected):
302 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
305 wfName,stepNames= name.split(
'+',1)
307 stepNames=stepNames.replace(
'+RECODFROMRAWRECO',
'')
308 stepNames=stepNames.replace(
'+SKIMCOSD',
'')
309 stepNames=stepNames.replace(
'+SKIMD',
'')
310 if 'HARVEST' in stepNames:
312 exactb=stepNames.index(
'+HARVEST')
313 exacte=stepNames.index(
'+',exactb+1)
if (
'+' in stepNames[exactb+1:])
else (len(stepNames))
314 stepNames=stepNames.replace(stepNames[exactb:exacte],
'')
317 step1,otherSteps = stepNames.split(
'+',1)
319 line = str(num) +
' ++ '+ wfName
320 if otherSteps
and not step1Only:
321 line +=
' ++ ' +otherSteps.replace(
'+',
',')
325 if not isinstance(commands[0],str):
326 inputInfo=commands[0]
328 for (i,c)
in enumerate(otherSteps.split(
'+')):
330 for p
in range(len(indexAndSteps),i+2):
331 indexAndSteps.append(set())
332 indexAndSteps[i+1].
add((c,commands[i+1]))
336 if step1Only:
continue
337 line +=
' ++ REALDATA: '+inputInfo.dataSet
338 if inputInfo.run!=[]: line +=
', RUN:'+
'|'.
join(
map(str,inputInfo.run))
339 line +=
', FILES: ' +str(inputInfo.files)
340 line +=
', EVENTS: '+str(inputInfo.events)
341 if inputInfo.label!=
'':
342 line +=
', LABEL: ' +inputInfo.label
343 line +=
', LOCATION:'+inputInfo.location
346 line +=
' @@@ '+commands[0]
348 line=line.replace(
'DQMIO',
'DQM')
350 outFile.write(line+
'\n')
353 outFile.write(
'\n'+
'\n')
354 if step1Only:
continue
356 for (index,s)
in enumerate(indexAndSteps):
357 for (stepName,cmd)
in s:
359 if 'dasquery.log' in cmd:
continue
360 line =
'STEP%d ++ '%(stepIndex,) +stepName +
' @@@ '+cmd
362 line=line.replace(
'DQMIO',
'DQM')
363 outFile.write(line+
'\n')
364 outFile.write(
'\n'+
'\n')
366 print "wrote ",writtenWF,
' workflow'+(
's' if (writtenWF!=1)
else ''),
' to ', outFile.name
371 if selected: selected =
map(float,selected)
373 fmt1 =
"%-6s %-35s [1]: %s ..."
374 fmt2 =
" %35s [%d]: %s ..."
375 print "\nfound a total of ", len(self.
workFlows),
' workflows:'
377 print " of which the following", len(selected),
'were selected:'
380 fmt1 =
"%-6s %-35s [1]: %s "
381 fmt2 =
" %35s [%d]: %s"
385 if selected
and float(wf.numId)
not in selected:
continue
386 if extended:
print ''
388 for i
in range(len(N),len(wf.cmds)): N.append(0)
390 wfName, stepNames = wf.nameId.split(
'+',1)
391 for i,s
in enumerate(wf.cmds):
394 print fmt1 % (wf.numId, stepNames, (str(s)+
' ')[:maxLen])
396 print fmt2 % (
' ', i+1, (str(s)+
' ')[:maxLen])
398 print "%-6s %-35s "% (wf.numId, stepNames)
401 for i,n
in enumerate(N):
402 if n:
print n,
'workflows with',i+1,
'steps'
411 keyList = self.workFlowSteps.keys()
415 if pref != prefixIn :
continue
420 num, name, commands, stepList = val
421 nameId = str(num)+
'_'+name
423 print "==> duplicate name found for ", nameId
424 print ' keeping : ', self.
nameList[nameId]
425 print ' ignoring : ', val
429 self.workFlows.append(
WorkFlow(num, name, commands=commands))
433 def prepare(self, useInput=None, refRel='', fromScratch=None):
435 for matrixFile
in self.
files:
436 if self.
what !=
'all' and self.
what not in matrixFile:
437 print "ignoring non-requested file",matrixFile
439 if self.
what ==
'all' and (
'upgrade' in matrixFile):
440 print "ignoring",matrixFile,
"from default matrix"
444 self.
readMatrix(matrixFile, useInput, refRel, fromScratch)
446 print "ERROR reading file:", matrixFile, str(e)
452 print "ERROR creating workflows :", str(e)
456 def show(self, selected=None, extended=True):
459 print '\n',
'-'*80,
'\n'
465 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)