CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
MatrixReader.MatrixReader Class Reference
Inheritance diagram for MatrixReader.MatrixReader:

Public Member Functions

def __init__ (self, opt)
 
def createWorkFlows (self, fileNameIn)
 
def makeCmd (self, step)
 
def makeStep (self, step, overrides)
 
def prepare (self, useInput=None, refRel='', fromScratch=None)
 
def readMatrix (self, fileNameIn, useInput=None, refRel=None, fromScratch=None)
 
def reset (self, what='all')
 
def show (self, selected=None, extended=True, cafVeto=True)
 
def showRaw (self, useInput, refRel=None, fromScratch=None, what='all', step1Only=False, selected=None)
 
def showWorkFlows (self, selected=None, extended=True, cafVeto=True)
 
def updateDB (self)
 
def workFlowsByLocation (self, cafVeto=True)
 

Public Attributes

 addCommand
 
 apply
 
 commandLineWf
 
 files
 
 filesDefault
 
 filesPrefMap
 
 nameList
 
 noRun
 
 overWrite
 
 relvalModule
 
 revertDqmio
 maybe we want too level deep input More...
 
 what
 
 wm
 
 workFlows
 
 workFlowSteps
 

Detailed Description

Definition at line 17 of file MatrixReader.py.

Constructor & Destructor Documentation

◆ __init__()

def MatrixReader.MatrixReader.__init__ (   self,
  opt 
)

Definition at line 19 of file MatrixReader.py.

References PuppiAlgo.reset(), TPedResult.reset(), BinningPointByMap.reset(), AlcaBeamSpotManager.reset(), RPCFebConnector.reset(), EcalCondHeader.reset(), VEcalCalibBlock.reset(), ApvLatencyAnalysis.reset(), SiPixelStatusManager.reset(), SiStripMiscalibrate::Entry.reset(), MatrixReader.MatrixReader.reset(), TB06Tree.reset(), IMACalibBlock.reset(), SamplingAnalysis.reset(), FactorizedJetCorrectorCalculator::VariableValues.reset(), L3CalibBlock.reset(), pos::PixelROCStatus.reset(), FedTimingAnalysis.reset(), L1MuDTTFParameters.reset(), L1MuDTTFMasks.reset(), L1MuDTPtaLut.reset(), L1MuDTPhiLut.reset(), RPCAMCLink.reset(), RPCDCCLink.reset(), EcalPhiSymRecHit.reset(), FedCablingAnalysis.reset(), L1MuDTEtaPatternLut.reset(), L1MuDTQualPatternLut.reset(), SiStripPI::Entry.reset(), PedsOnlyAnalysis.reset(), L1MuDTExtLut.reset(), TB06Reco.reset(), PhysicsTools::Calibration::Histogram2D< Value_t, AxisX_t, AxisY_t >.reset(), VpspScanAnalysis.reset(), PhysicsTools::Calibration::Histogram< Value_t, Axis_t >.reset(), NoiseAnalysis.reset(), PedestalsAnalysis.reset(), OptoScanAnalysis.reset(), coral_bridge::AuthenticationCredentialSet.reset(), CalibrationScanAnalysis.reset(), TB06TreeH2.reset(), ApvTimingAnalysis.reset(), DaqScopeModeAnalysis.reset(), cond::persistency::RunInfoProxy.reset(), FastFedCablingAnalysis.reset(), PhysicsTools::Calibration::Histogram3D< Value_t, AxisX_t, AxisY_t, AxisZ_t >.reset(), RPCLBLink.reset(), cond::persistency::GTProxy.reset(), AlignableBeamSpot.reset(), PedsFullNoiseAnalysis.reset(), CalibrationAnalysis.reset(), CommissioningAnalysis.reset(), cond::XMLAuthenticationService::XMLAuthenticationService.reset(), TB06RecoH2.reset(), cond::persistency::IOVProxy.reset(), TrackerMap.reset(), LHCInfoImpl::LumiSectionFilter.reset(), data_sources.json_list.reset(), DTTFBitArray< N >.reset(), and tkal_create_file_lists._DasCache.reset().

19  def __init__(self, opt):
20 
21  self.reset(opt.what)
22 
23  self.wm=opt.wmcontrol
24  self.revertDqmio=opt.revertDqmio
25  self.addCommand=opt.command
26  self.apply=opt.apply
27  self.commandLineWf=opt.workflow
28  self.overWrite=opt.overWrite
29 
30  self.noRun = opt.noRun
31  return
32 
def __init__(self, dataset, job_number, job_id, job_name, isDA, isMC, applyBOWS, applyEXTRACOND, extraconditions, runboundary, lumilist, intlumi, maxevents, gt, allFromGT, alignmentDB, alignmentTAG, apeDB, apeTAG, bowDB, bowTAG, vertextype, tracktype, refittertype, ttrhtype, applyruncontrol, ptcut, CMSSW_dir, the_dir)

Member Function Documentation

◆ createWorkFlows()

def MatrixReader.MatrixReader.createWorkFlows (   self,
  fileNameIn 
)

Definition at line 471 of file MatrixReader.py.

References mps_setup.append, MatrixReader.MatrixReader.filesPrefMap, relativeConstraints.keys, MatrixReader.MatrixReader.nameList, print(), str, MatrixReader.MatrixReader.workFlows, and MatrixReader.MatrixReader.workFlowSteps.

Referenced by MatrixReader.MatrixReader.prepare().

471  def createWorkFlows(self, fileNameIn):
472 
473  prefixIn = self.filesPrefMap[fileNameIn]
474 
475  # get through the list of items and update the requested workflows only
476  keyList = self.workFlowSteps.keys()
477  ids = []
478  for item in keyList:
479  id, pref = item
480  if pref != prefixIn : continue
481  ids.append(id)
482  ids.sort()
483  for key in ids:
484  val = self.workFlowSteps[(key,prefixIn)]
485  num, name, commands, stepList = val
486  nameId = str(num)+'_'+name
487  if nameId in self.nameList:
488  print("==> duplicate name found for ", nameId)
489  print(' keeping : ', self.nameList[nameId])
490  print(' ignoring : ', val)
491  else:
492  self.nameList[nameId] = val
493 
494  self.workFlows.append(WorkFlow(num, name, commands=commands))
495 
496  return
497 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
#define str(s)

◆ makeCmd()

def MatrixReader.MatrixReader.makeCmd (   self,
  step 
)

Definition at line 100 of file MatrixReader.py.

References str.

Referenced by MatrixReader.MatrixReader.readMatrix().

100  def makeCmd(self, step):
101 
102  cmd = ''
103  cfg = None
104  input = None
105  for k,v in step.items():
106  if 'no_exec' in k : continue # we want to really run it ...
107  if k.lower() == 'cfg':
108  cfg = v
109  continue # do not append to cmd, return separately
110  if k.lower() == 'input':
111  input = v
112  continue # do not append to cmd, return separately
113 
114  #chain the configs
115  #if k.lower() == '--python':
116  # v = 'step%d_%s'%(index,v)
117  cmd += ' ' + k + ' ' + str(v)
118  return cfg, input, cmd
119 
#define str(s)

◆ makeStep()

def MatrixReader.MatrixReader.makeStep (   self,
  step,
  overrides 
)

Definition at line 120 of file MatrixReader.py.

Referenced by MatrixReader.MatrixReader.readMatrix().

120  def makeStep(self,step,overrides):
122  if len(overrides) > 0:
123  copyStep=merge([overrides]+[step])
124  return copyStep
125  else:
126  return step
127 
Definition: merge.py:1

◆ prepare()

def MatrixReader.MatrixReader.prepare (   self,
  useInput = None,
  refRel = '',
  fromScratch = None 
)

Definition at line 498 of file MatrixReader.py.

References any(), MatrixReader.MatrixReader.createWorkFlows(), MatrixReader.MatrixReader.files, MatrixReader.MatrixReader.filesDefault, print(), MatrixReader.MatrixReader.readMatrix(), submitPVValidationJobs.split(), str, and MatrixReader.MatrixReader.what.

498  def prepare(self, useInput=None, refRel='', fromScratch=None):
499 
500  for matrixFile in self.files:
501  if self.what != 'all' and not any('_'+el in matrixFile for el in self.what.split(",")):
502  print("ignoring non-requested file",matrixFile)
503  continue
504  if self.what == 'all' and not self.filesDefault[matrixFile]:
505  print("ignoring",matrixFile,"from default matrix")
506  continue
507 
508  try:
509  self.readMatrix(matrixFile, useInput, refRel, fromScratch)
510  except Exception as e:
511  print("ERROR reading file:", matrixFile, str(e))
512  raise
513 
514  try:
515  self.createWorkFlows(matrixFile)
516  except Exception as e:
517  print("ERROR creating workflows :", str(e))
518  raise
519 
520 
bool any(const std::vector< T > &v, const T &what)
Definition: ECalSD.cc:37
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
#define str(s)

◆ readMatrix()

def MatrixReader.MatrixReader.readMatrix (   self,
  fileNameIn,
  useInput = None,
  refRel = None,
  fromScratch = None 
)

Definition at line 128 of file MatrixReader.py.

References MatrixReader.MatrixReader.addCommand, MatrixReader.MatrixReader.apply, MatrixUtil.changeRefRelease(), MatrixReader.MatrixReader.filesPrefMap, dqmMemoryStats.float, createfilelist.int, join(), MatrixReader.MatrixReader.makeCmd(), MatrixReader.MatrixReader.makeStep(), genParticles_cff.map, MatrixReader.MatrixReader.noRun, MatrixReader.MatrixReader.overWrite, print(), FastTimerService_cff.range, MatrixReader.MatrixReader.relvalModule, MatrixReader.MatrixReader.revertDqmio, str, MatrixReader.MatrixReader.wm, MatrixReader.MatrixReader.workFlowSteps, and ComparisonHelper.zip().

Referenced by MatrixReader.MatrixReader.prepare(), and MatrixReader.MatrixReader.showRaw().

128  def readMatrix(self, fileNameIn, useInput=None, refRel=None, fromScratch=None):
129 
130  prefix = self.filesPrefMap[fileNameIn]
131 
132  print("processing", fileNameIn)
133 
134  try:
135  _tmpMod = __import__( 'Configuration.PyReleaseValidation.'+fileNameIn )
136  self.relvalModule = sys.modules['Configuration.PyReleaseValidation.'+fileNameIn]
137  except Exception as e:
138  print("ERROR importing file ", fileNameIn, str(e))
139  return
140 
141  if useInput is not None:
142  print("request for INPUT for ", useInput)
143 
144 
145  fromInput={}
146 
147  if useInput:
148  for i in useInput:
149  if ':' in i:
150  (ik,il)=i.split(':')
151  if ik=='all':
152  for k in self.relvalModule.workflows.keys():
153  fromInput[float(k)]=int(il)
154  else:
155  fromInput[float(ik)]=int(il)
156  else:
157  if i=='all':
158  for k in self.relvalModule.workflows.keys():
159  fromInput[float(k)]=0
160  else:
161  fromInput[float(i)]=0
162 
163  if fromScratch:
164  fromScratch=map(float,fromScratch)
165  for num in fromScratch:
166  if num in fromInput:
167  fromInput.pop(num)
168  #overwrite steps
169  if self.overWrite:
170  for p in self.overWrite:
171  self.relvalModule.steps.overwrite(p)
172 
173  #change the origin of dataset on the fly
174  if refRel:
175  if ',' in refRel:
176  refRels=refRel.split(',')
177  if len(refRels)!=len(self.relvalModule.baseDataSetRelease):
178  return
179  self.relvalModule.changeRefRelease(
180  self.relvalModule.steps,
181  list(zip(self.relvalModule.baseDataSetRelease,refRels))
182  )
183  else:
184  self.relvalModule.changeRefRelease(
185  self.relvalModule.steps,
186  [(x,refRel) for x in self.relvalModule.baseDataSetRelease]
187  )
188 
189 
190  for num, wfInfo in self.relvalModule.workflows.items():
191  commands=[]
192  wfName = wfInfo[0]
193  stepList = wfInfo[1]
194  stepOverrides=wfInfo.overrides
195  # upgrade case: workflow has basic name, key[, suffix (only special workflows)]
196  wfKey = ""
197  wfSuffix = ""
198  if isinstance(wfName, list) and len(wfName)>1:
199  if len(wfName)>2: wfSuffix = wfName[2]
200  wfKey = wfName[1]
201  wfName = wfName[0]
202  # if no explicit name given for the workflow, use the name of step1
203  if wfName.strip() == '': wfName = stepList[0]
204  # option to specialize the wf as the third item in the WF list
205  addTo=None
206  addCom=None
207  if len(wfInfo)>=3:
208  addCom=wfInfo[2]
209  if not isinstance(addCom, list): addCom=[addCom]
210  #print 'added dict',addCom
211  if len(wfInfo)>=4:
212  addTo=wfInfo[3]
213  #pad with 0
214  while len(addTo)!=len(stepList):
215  addTo.append(0)
216 
217  name=wfName
218  # separate suffixes by + because show() excludes first part of name
219  if len(wfKey)>0:
220  name = name+'+'+wfKey
221  if len(wfSuffix)>0: name = name+wfSuffix
222  stepIndex=0
223  ranStepList=[]
224 
225  #first resolve INPUT possibilities
226  if num in fromInput:
227  ilevel=fromInput[num]
228  #print num,ilevel
229  for (stepIr,step) in enumerate(reversed(stepList)):
230  stepName=step
231  stepI=(len(stepList)-stepIr)-1
232  #print stepIr,step,stepI,ilevel
233  if stepI>ilevel:
234  #print "ignoring"
235  continue
236  if stepI!=0:
237  testName='__'.join(stepList[0:stepI+1])+'INPUT'
238  else:
239  testName=step+'INPUT'
240  #print "JR",stepI,stepIr,testName,stepList
241  if testName in self.relvalModule.steps:
242  #print "JR",stepI,stepIr
243  stepList[stepI]=testName
244  #pop the rest in the list
245  #print "\tmod prepop",stepList
246  for p in range(stepI):
247  stepList.pop(0)
248  #print "\t\tmod",stepList
249  break
250 
251 
252  for (stepI,step) in enumerate(stepList):
253  stepName=step
254  if self.relvalModule.steps[stepName] is None:
255  continue
256  if self.wm:
257  #cannot put a certain number of things in wm
258  if stepName in ['SKIMD','SKIMCOSD','SKIMDreHLT']:
259  continue
260 
261  #replace stepName is needed
262  #if stepName in self.replaceStep
263  if len(name) > 0 : name += '+'
264  #any step can be mirrored with INPUT
265 
266  """
267  if num in fromInput:
268  if step+'INPUT' in self.relvalModule.steps.keys():
269  stepName = step+"INPUT"
270  stepList.remove(step)
271  stepList.insert(stepIndex,stepName)
272  """
273  stepNameTmp = stepName
274  if len(wfKey)>0: stepNameTmp = stepNameTmp.replace('_'+wfKey,"")
275  if len(wfSuffix)>0: stepNameTmp = stepNameTmp.replace(wfSuffix,"")
276  name += stepNameTmp
277  if addCom and (not addTo or addTo[stepIndex]==1):
279  copyStep=merge(addCom+[self.makeStep(self.relvalModule.steps[stepName],stepOverrides)])
280  cfg, input, opts = self.makeCmd(copyStep)
281  else:
282  cfg, input, opts = self.makeCmd(self.makeStep(self.relvalModule.steps[stepName],stepOverrides))
283 
284  if input and cfg :
285  msg = "FATAL ERROR: found both cfg and input for workflow "+str(num)+' step '+stepName
286  raise MatrixException(msg)
287 
288  if input:
289  cmd = input
290  if self.noRun:
291  cmd.run=[]
292  else:
293  if cfg:
294  cmd = 'cmsDriver.py '+cfg+' '+opts
295  else:
296  cmd = 'cmsDriver.py step'+str(stepIndex+1)+' '+opts
297  if self.wm:
298  cmd+=' --io %s.io --python %s.py'%(stepName,stepName)
299  if self.addCommand:
300  if self.apply:
301  if stepIndex in self.apply or stepName in self.apply:
302  cmd +=' '+self.addCommand
303  else:
304  cmd +=' '+self.addCommand
305  if self.wm and self.revertDqmio=='yes':
306  cmd=cmd.replace('DQMIO','DQM')
307  cmd=cmd.replace('--filetype DQM','')
308  commands.append(cmd)
309  ranStepList.append(stepName)
310  stepIndex+=1
311 
312  self.workFlowSteps[(num,prefix)] = (num, name, commands, ranStepList)
313 
314  return
315 
316 
Definition: merge.py:1
OutputIterator zip(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp)
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
static std::string join(char **cmd)
Definition: RemoteFile.cc:19
def changeRefRelease(steps, listOfPairs)
Definition: MatrixUtil.py:240
#define str(s)

◆ reset()

def MatrixReader.MatrixReader.reset (   self,
  what = 'all' 
)

Definition at line 33 of file MatrixReader.py.

Referenced by MatrixReader.MatrixReader.__init__(), and MatrixReader.MatrixReader.showRaw().

33  def reset(self, what='all'):
34 
35  self.what = what
36 
37  #a bunch of information, but not yet the WorkFlow object
38  self.workFlowSteps = {}
39  #the actual WorkFlow objects
40  self.workFlows = []
41  self.nameList = {}
42 
43  self.filesPrefMap = {'relval_standard' : 'std-' ,
44  'relval_highstats': 'hi-' ,
45  'relval_pileup': 'PU-' ,
46  'relval_generator': 'gen-',
47  'relval_extendedgen': 'genExt-',
48  'relval_production': 'prod-' ,
49  'relval_ged': 'ged-',
50  'relval_upgrade':'upg-',
51  'relval_cleanedupgrade':'clnupg-',
52  'relval_gpu':'gpu-',
53  'relval_2017':'2017-',
54  'relval_2026':'2026-',
55  'relval_identity':'id-',
56  'relval_machine': 'mach-',
57  'relval_premix': 'premix-',
58  'relval_nano':'nano-'
59  }
60 
61  self.files = ['relval_standard' ,
62  'relval_highstats',
63  'relval_pileup',
64  'relval_generator',
65  'relval_extendedgen',
66  'relval_production',
67  'relval_ged',
68  'relval_upgrade',
69  'relval_cleanedupgrade',
70  'relval_gpu',
71  'relval_2017',
72  'relval_2026',
73  'relval_identity',
74  'relval_machine',
75  'relval_premix',
76  'relval_nano'
77  ]
78  self.filesDefault = {'relval_standard':True ,
79  'relval_highstats':True ,
80  'relval_pileup':True,
81  'relval_generator':True,
82  'relval_extendedgen':True,
83  'relval_production':True,
84  'relval_ged':True,
85  'relval_upgrade':False,
86  'relval_cleanedupgrade':False,
87  'relval_gpu':False,
88  'relval_2017':True,
89  'relval_2026':True,
90  'relval_identity':False,
91  'relval_machine':True,
92  'relval_premix':True,
93  'relval_nano':True
94  }
95 
96  self.relvalModule = None
97 
98  return
99 
void reset(double vett[256])
Definition: TPedValues.cc:11

◆ show()

def MatrixReader.MatrixReader.show (   self,
  selected = None,
  extended = True,
  cafVeto = True 
)

Definition at line 521 of file MatrixReader.py.

References print(), and MatrixReader.MatrixReader.showWorkFlows().

521  def show(self, selected=None, extended=True, cafVeto=True):
522 
523  self.showWorkFlows(selected, extended, cafVeto)
524  print('\n','-'*80,'\n')
525 
526 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47

◆ showRaw()

def MatrixReader.MatrixReader.showRaw (   self,
  useInput,
  refRel = None,
  fromScratch = None,
  what = 'all',
  step1Only = False,
  selected = None 
)

Definition at line 317 of file MatrixReader.py.

References PVValHelper.add(), any(), MatrixReader.MatrixReader.files, MatrixReader.MatrixReader.filesDefault, join(), relativeConstraints.keys, genParticles_cff.map, print(), FastTimerService_cff.range, MatrixReader.MatrixReader.readMatrix(), PuppiAlgo.reset(), TPedResult.reset(), BinningPointByMap.reset(), AlcaBeamSpotManager.reset(), RPCFebConnector.reset(), EcalCondHeader.reset(), VEcalCalibBlock.reset(), ApvLatencyAnalysis.reset(), SiPixelStatusManager.reset(), SiStripMiscalibrate::Entry.reset(), MatrixReader.MatrixReader.reset(), IMACalibBlock.reset(), TB06Tree.reset(), SamplingAnalysis.reset(), FactorizedJetCorrectorCalculator::VariableValues.reset(), L3CalibBlock.reset(), pos::PixelROCStatus.reset(), FedTimingAnalysis.reset(), L1MuDTTFMasks.reset(), L1MuDTTFParameters.reset(), L1MuDTPtaLut.reset(), RPCAMCLink.reset(), RPCDCCLink.reset(), L1MuDTPhiLut.reset(), EcalPhiSymRecHit.reset(), FedCablingAnalysis.reset(), L1MuDTEtaPatternLut.reset(), L1MuDTQualPatternLut.reset(), SiStripPI::Entry.reset(), PedsOnlyAnalysis.reset(), L1MuDTExtLut.reset(), TB06Reco.reset(), PhysicsTools::Calibration::Histogram2D< Value_t, AxisX_t, AxisY_t >.reset(), VpspScanAnalysis.reset(), PhysicsTools::Calibration::Histogram< Value_t, Axis_t >.reset(), NoiseAnalysis.reset(), PedestalsAnalysis.reset(), OptoScanAnalysis.reset(), coral_bridge::AuthenticationCredentialSet.reset(), CalibrationScanAnalysis.reset(), TB06TreeH2.reset(), ApvTimingAnalysis.reset(), DaqScopeModeAnalysis.reset(), cond::persistency::RunInfoProxy.reset(), FastFedCablingAnalysis.reset(), RPCLBLink.reset(), PhysicsTools::Calibration::Histogram3D< Value_t, AxisX_t, AxisY_t, AxisZ_t >.reset(), cond::persistency::GTProxy.reset(), AlignableBeamSpot.reset(), PedsFullNoiseAnalysis.reset(), CalibrationAnalysis.reset(), CommissioningAnalysis.reset(), cond::XMLAuthenticationService::XMLAuthenticationService.reset(), TB06RecoH2.reset(), cond::persistency::IOVProxy.reset(), TrackerMap.reset(), LHCInfoImpl::LumiSectionFilter.reset(), data_sources.json_list.reset(), DTTFBitArray< N >.reset(), tkal_create_file_lists._DasCache.reset(), MatrixReader.MatrixReader.revertDqmio, submitPVValidationJobs.split(), str, MatrixReader.MatrixReader.what, and MatrixReader.MatrixReader.workFlowSteps.

317  def showRaw(self, useInput, refRel=None, fromScratch=None, what='all',step1Only=False,selected=None):
318 
319  if selected:
320  selected=map(float,selected)
321  for matrixFile in self.files:
322 
323  self.reset(what)
324 
325  if self.what != 'all' and not any('_'+el in matrixFile for el in self.what.split(",")):
326  print("ignoring non-requested file",matrixFile)
327  continue
328 
329  if self.what == 'all' and not self.filesDefault[matrixFile]:
330  print("ignoring file not used by default (enable with -w)",matrixFile)
331  continue
332 
333  try:
334  self.readMatrix(matrixFile, useInput, refRel, fromScratch)
335  except Exception as e:
336  print("ERROR reading file:", matrixFile, str(e))
337  raise
338 
339  if not self.workFlowSteps: continue
340 
341  dataFileName = matrixFile.replace('relval_', 'cmsDriver_')+'_hlt.txt'
342  outFile = open(dataFileName,'w')
343 
344  print("found ", len(self.workFlowSteps), ' workflows for ', dataFileName)
345  ids = sorted(self.workFlowSteps.keys())
346  indexAndSteps=[]
347 
348  writtenWF=0
349  for key in ids:
350  if selected and not (key[0] in selected):
351  continue
352  #trick to skip the HImix IB test
353  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
354  num, name, commands, stepList = self.workFlowSteps[key]
355 
356  wfName,stepNames= name.split('+',1)
357 
358  stepNames=stepNames.replace('+SKIMCOSD','')
359  stepNames=stepNames.replace('+SKIMD','')
360  if 'HARVEST' in stepNames:
361  #find out automatically what to remove
362  exactb=stepNames.index('+HARVEST')
363  exacte=stepNames.index('+',exactb+1) if ('+' in stepNames[exactb+1:]) else (len(stepNames))
364  stepNames=stepNames.replace(stepNames[exactb:exacte],'')
365  otherSteps = None
366  if '+' in stepNames:
367  step1,otherSteps = stepNames.split('+',1)
368 
369  line = str(num) + ' ++ '+ wfName
370  if otherSteps and not step1Only:
371  line += ' ++ ' +otherSteps.replace('+',',')
372  else:
373  line += ' ++ none'
374  inputInfo=None
375  if not isinstance(commands[0],str):
376  inputInfo=commands[0]
377  if otherSteps:
378  for (i,c) in enumerate(otherSteps.split('+')):
379  #pad with set
380  for p in range(len(indexAndSteps),i+2):
381  indexAndSteps.append(set())
382  indexAndSteps[i+1].add((c,commands[i+1]))
383 
384  if inputInfo :
385  #skip the samples from INPUT when step1Only is on
386  if step1Only: continue
387  line += ' ++ REALDATA: '+inputInfo.dataSet
388  if inputInfo.run!=[]: line += ', RUN:'+'|'.join(map(str,inputInfo.run))
389  line += ', FILES: ' +str(inputInfo.files)
390  line += ', EVENTS: '+str(inputInfo.events)
391  if inputInfo.label!='':
392  line += ', LABEL: ' +inputInfo.label
393  line += ', LOCATION:'+inputInfo.location
394  line += ' @@@'
395  else:
396  line += ' @@@ '+commands[0]
397  if self.revertDqmio=='yes':
398  line=line.replace('DQMIO','DQM')
399  writtenWF+=1
400  outFile.write(line+'\n')
401 
402 
403  outFile.write('\n'+'\n')
404  if step1Only: continue
405 
406  for (index,s) in enumerate(indexAndSteps):
407  for (stepName,cmd) in s:
408  stepIndex=index+1
409  if 'dasquery.log' in cmd: continue
410  line = 'STEP%d ++ '%(stepIndex,) +stepName + ' @@@ '+cmd
411  if self.revertDqmio=='yes':
412  line=line.replace('DQMIO','DQM')
413  outFile.write(line+'\n')
414  outFile.write('\n'+'\n')
415  outFile.close()
416  print("wrote ",writtenWF, ' workflow'+('s' if (writtenWF!=1) else ''),' to ', outFile.name)
417  return
418 
bool any(const std::vector< T > &v, const T &what)
Definition: ECalSD.cc:37
def showRaw(opt)
Definition: runTheMatrix.py:11
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
static std::string join(char **cmd)
Definition: RemoteFile.cc:19
void add(std::map< std::string, TH1 *> &h, TH1 *hist)
#define str(s)

◆ showWorkFlows()

def MatrixReader.MatrixReader.showWorkFlows (   self,
  selected = None,
  extended = True,
  cafVeto = True 
)

Definition at line 434 of file MatrixReader.py.

References dqmMemoryStats.float, genParticles_cff.map, print(), FastTimerService_cff.range, str, and MatrixReader.MatrixReader.workFlowsByLocation().

Referenced by MatrixReader.MatrixReader.show().

434  def showWorkFlows(self, selected=None, extended=True, cafVeto=True):
435  if selected: selected = list(map(float,selected))
436  wfs = self.workFlowsByLocation(cafVeto)
437  maxLen = 100 # for summary, limit width of output
438  fmt1 = "%-6s %-35s [1]: %s ..."
439  fmt2 = " %35s [%d]: %s ..."
440  print("\nfound a total of ", len(wfs), ' workflows:')
441  if selected:
442  print(" of which the following", len(selected), 'were selected:')
443  #-ap for now:
444  maxLen = -1 # for individual listing, no limit on width
445  fmt1 = "%-6s %-35s [1]: %s "
446  fmt2 = " %35s [%d]: %s"
447 
448  N=[]
449  for wf in wfs:
450  if selected and float(wf.numId) not in selected: continue
451  if extended: print('')
452  #pad with zeros
453  for i in range(len(N),len(wf.cmds)): N.append(0)
454  N[len(wf.cmds)-1]+=1
455  wfName, stepNames = wf.nameId.split('+',1)
456  for i,s in enumerate(wf.cmds):
457  if extended:
458  if i==0:
459  print(fmt1 % (wf.numId, stepNames, (str(s)+' ')[:maxLen]))
460  else:
461  print(fmt2 % ( ' ', i+1, (str(s)+' ')[:maxLen]))
462  else:
463  print("%-6s %-35s "% (wf.numId, stepNames))
464  break
465  print('')
466  for i,n in enumerate(N):
467  if n: print(n,'workflows with',i+1,'steps')
468 
469  return
470 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
#define str(s)

◆ updateDB()

def MatrixReader.MatrixReader.updateDB (   self)

Definition at line 527 of file MatrixReader.py.

References MatrixReader.MatrixReader.workFlows.

527  def updateDB(self):
528 
529  import pickle
530  pickle.dump(self.workFlows, open('theMatrix.pkl', 'w') )
531 
532  return
533 
534 

◆ workFlowsByLocation()

def MatrixReader.MatrixReader.workFlowsByLocation (   self,
  cafVeto = True 
)

Definition at line 419 of file MatrixReader.py.

References MatrixReader.MatrixReader.workFlows.

Referenced by MatrixReader.MatrixReader.showWorkFlows().

419  def workFlowsByLocation(self, cafVeto=True):
420  # Check if we are on CAF
421  onCAF = False
422  if 'cms/caf/cms' in os.environ['CMS_PATH']:
423  onCAF = True
424 
425  workflows = []
426  for workflow in self.workFlows:
427  if isinstance(workflow.cmds[0], InputInfo):
428  if cafVeto and (workflow.cmds[0].location == 'CAF' and not onCAF):
429  continue
430  workflows.append(workflow)
431 
432  return workflows
433 

Member Data Documentation

◆ addCommand

MatrixReader.MatrixReader.addCommand

Definition at line 25 of file MatrixReader.py.

Referenced by MatrixReader.MatrixReader.readMatrix().

◆ apply

◆ commandLineWf

MatrixReader.MatrixReader.commandLineWf

Definition at line 27 of file MatrixReader.py.

◆ files

◆ filesDefault

MatrixReader.MatrixReader.filesDefault

◆ filesPrefMap

MatrixReader.MatrixReader.filesPrefMap

◆ nameList

MatrixReader.MatrixReader.nameList

Definition at line 41 of file MatrixReader.py.

Referenced by MatrixReader.MatrixReader.createWorkFlows().

◆ noRun

MatrixReader.MatrixReader.noRun

Definition at line 30 of file MatrixReader.py.

Referenced by MatrixReader.MatrixReader.readMatrix().

◆ overWrite

MatrixReader.MatrixReader.overWrite

Definition at line 28 of file MatrixReader.py.

Referenced by MatrixReader.MatrixReader.readMatrix().

◆ relvalModule

MatrixReader.MatrixReader.relvalModule

Definition at line 96 of file MatrixReader.py.

Referenced by MatrixReader.MatrixReader.readMatrix().

◆ revertDqmio

MatrixReader.MatrixReader.revertDqmio

maybe we want too level deep input

Definition at line 24 of file MatrixReader.py.

Referenced by MatrixReader.MatrixReader.readMatrix(), and MatrixReader.MatrixReader.showRaw().

◆ what

MatrixReader.MatrixReader.what

◆ wm

MatrixReader.MatrixReader.wm

Definition at line 23 of file MatrixReader.py.

Referenced by MatrixReader.MatrixReader.readMatrix().

◆ workFlows

◆ workFlowSteps

MatrixReader.MatrixReader.workFlowSteps