CMS 3D CMS Logo

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

Public Member Functions

def __init__ (self, opt, mode='init', options='')
 
def prepare (self, mReader, directories, mode='init')
 
def submit (self)
 
def upload (self)
 
def uploadConf (self, filePath, label, where)
 the info are not in the task specific dict but in the general dict t_input.update(copy.deepcopy(self.defaultHarvest)) t_input['DQMConfigCacheID']=t_second['ConfigCacheID'] More...
 

Static Public Member Functions

def get_wmsplit ()
 

Public Attributes

 batchName
 
 batchTime
 
 candidateWFName
 
 chainDicts
 
 couch
 
 couchCache
 
 count
 
 DbsUrl
 
 defaultChain
 
 defaultHarvest
 
 defaultInput
 
 defaultScratch
 
 defaultTask
 
 dqmgui
 
 group
 
 keep
 
 label
 
 longWFName
 
 memoryOffset
 
 memPerCore
 
 numberEventsInLuminosityBlock
 
 numberOfStreams
 
 speciallabel
 
 testMode
 
 user
 
 version
 
 wmagent
 

Detailed Description

Definition at line 41 of file MatrixInjector.py.

Constructor & Destructor Documentation

◆ __init__()

def MatrixInjector.MatrixInjector.__init__ (   self,
  opt,
  mode = 'init',
  options = '' 
)

Definition at line 43 of file MatrixInjector.py.

43  def __init__(self,opt,mode='init',options=''):
44  self.count=1040
45 
46  self.dqmgui=None
47  self.wmagent=None
48  for k in options.split(','):
49  if k.startswith('dqm:'):
50  self.dqmgui=k.split(':',1)[-1]
51  elif k.startswith('wma:'):
52  self.wmagent=k.split(':',1)[-1]
53 
54  self.testMode=((mode!='submit') and (mode!='force'))
55  self.version =1
56  self.keep = opt.keep
57  self.memoryOffset = opt.memoryOffset
58  self.memPerCore = opt.memPerCore
59  self.numberEventsInLuminosityBlock = opt.numberEventsInLuminosityBlock
60  self.numberOfStreams = 0
61  if(opt.nStreams>0):
62  self.numberOfStreams = opt.nStreams
63  self.batchName = ''
64  self.batchTime = str(int(time.time()))
65  if(opt.batchName):
66  self.batchName = '__'+opt.batchName+'-'+self.batchTime
67 
68  # WMagent url
69  if not self.wmagent:
70  # Overwrite with env variable
71  self.wmagent = os.getenv('WMAGENT_REQMGR')
72 
73  if not self.wmagent:
74  # Default values
75  if not opt.testbed:
76  self.wmagent = 'cmsweb.cern.ch'
77  else:
78  self.wmagent = 'cmsweb-testbed.cern.ch'
79 
80  # DBSReader url
81  if opt.dbsUrl is not None:
82  self.DbsUrl = opt.dbsUrl
83  elif os.getenv('CMS_DBSREADER_URL') is not None:
84  self.DbsUrl = os.getenv('CMS_DBSREADER_URL')
85  else:
86  # Default values
87  if not opt.testbed:
88  self.DbsUrl = "https://cmsweb-prod.cern.ch/dbs/prod/global/DBSReader"
89  else:
90  self.DbsUrl = "https://cmsweb-testbed.cern.ch/dbs/int/global/DBSReader"
91 
92  if not self.dqmgui:
93  self.dqmgui="https://cmsweb.cern.ch/dqm/relval"
94  #couch stuff
95  self.couch = 'https://'+self.wmagent+'/couchdb'
96 # self.couchDB = 'reqmgr_config_cache'
97  self.couchCache={} # so that we do not upload like crazy, and recyle cfgs
98  self.user = os.getenv('USER')
99  self.group = 'ppd'
100  self.label = 'RelValSet_'+os.getenv('CMSSW_VERSION').replace('-','')+'_v'+str(self.version)
101  self.speciallabel=''
102  if opt.label:
103  self.speciallabel= '_'+opt.label
104  self.longWFName = []
105 
106  if not os.getenv('WMCORE_ROOT'):
107  print('\n\twmclient is not setup properly. Will not be able to upload or submit requests.\n')
108  if not self.testMode:
109  print('\n\t QUIT\n')
110  sys.exit(-18)
111  else:
112  print('\n\tFound wmclient\n')
113 
114  self.defaultChain={
115  "RequestType" : "TaskChain", #this is how we handle relvals
116  "SubRequestType" : "RelVal", #this is how we handle relvals, now that TaskChain is also used for central MC production
117  "RequestPriority": 500000,
118  "Requestor": self.user, #Person responsible
119  "Group": self.group, #group for the request
120  "CMSSWVersion": os.getenv('CMSSW_VERSION'), #CMSSW Version (used for all tasks in chain)
121  "Campaign": os.getenv('CMSSW_VERSION'), # = AcquisitionEra, will be reset later to the one of first task, will both be the CMSSW_VERSION
122  "ScramArch": os.getenv('SCRAM_ARCH'), #Scram Arch (used for all tasks in chain)
123  "ProcessingVersion": self.version, #Processing Version (used for all tasks in chain)
124  "GlobalTag": None, #Global Tag (overridden per task)
125  "ConfigCacheUrl": self.couch, #URL of CouchDB containing Config Cache
126  "DbsUrl": self.DbsUrl,
127  #- Will contain all configs for all Tasks
128  #"SiteWhitelist" : ["T2_CH_CERN", "T1_US_FNAL"], #Site whitelist
129  "TaskChain" : None, #Define number of tasks in chain.
130  "nowmTasklist" : [], #a list of tasks as we put them in
131  "Multicore" : 1, # do not set multicore for the whole chain
132  "Memory" : 3000,
133  "SizePerEvent" : 1234,
134  "TimePerEvent" : 10,
135  "PrepID": os.getenv('CMSSW_VERSION')
136  }
137 
138  self.defaultHarvest={
139  "EnableHarvesting" : "True",
140  "DQMUploadUrl" : self.dqmgui,
141  "DQMConfigCacheID" : None,
142  "Multicore" : 1 # hardcode Multicore to be 1 for Harvest
143  }
144 
145  self.defaultScratch={
146  "TaskName" : None, #Task Name
147  "ConfigCacheID" : None, #Generator Config id
148  "GlobalTag": None,
149  "SplittingAlgo" : "EventBased", #Splitting Algorithm
150  "EventsPerJob" : None, #Size of jobs in terms of splitting algorithm
151  "EventsPerLumi" : None,
152  "RequestNumEvents" : None, #Total number of events to generate
153  "Seeding" : "AutomaticSeeding", #Random seeding method
154  "PrimaryDataset" : None, #Primary Dataset to be created
155  "nowmIO": {},
156  "Multicore" : opt.nThreads, # this is the per-taskchain Multicore; it's the default assigned to a task if it has no value specified
157  "EventStreams": self.numberOfStreams,
158  "KeepOutput" : False
159  }
160  self.defaultInput={
161  "TaskName" : "DigiHLT", #Task Name
162  "ConfigCacheID" : None, #Processing Config id
163  "GlobalTag": None,
164  "InputDataset" : None, #Input Dataset to be processed
165  "SplittingAlgo" : "LumiBased", #Splitting Algorithm
166  "LumisPerJob" : 10, #Size of jobs in terms of splitting algorithm
167  "nowmIO": {},
168  "Multicore" : opt.nThreads, # this is the per-taskchain Multicore; it's the default assigned to a task if it has no value specified
169  "EventStreams": self.numberOfStreams,
170  "KeepOutput" : False
171  }
172  self.defaultTask={
173  "TaskName" : None, #Task Name
174  "InputTask" : None, #Input Task Name (Task Name field of a previous Task entry)
175  "InputFromOutputModule" : None, #OutputModule name in the input task that will provide files to process
176  "ConfigCacheID" : None, #Processing Config id
177  "GlobalTag": None,
178  "SplittingAlgo" : "LumiBased", #Splitting Algorithm
179  "LumisPerJob" : 10, #Size of jobs in terms of splitting algorithm
180  "nowmIO": {},
181  "Multicore" : opt.nThreads, # this is the per-taskchain Multicore; it's the default assigned to a task if it has no value specified
182  "EventStreams": self.numberOfStreams,
183  "KeepOutput" : False
184  }
185 
186  self.chainDicts={}
187 

Member Function Documentation

◆ get_wmsplit()

def MatrixInjector.MatrixInjector.get_wmsplit ( )
static
Return a "wmsplit" dictionary that contain non-default LumisPerJob values

Definition at line 189 of file MatrixInjector.py.

189  def get_wmsplit():
190  """
191  Return a "wmsplit" dictionary that contain non-default LumisPerJob values
192  """
193  wmsplit = {}
194  try:
195  wmsplit['DIGIHI'] = 5
196  wmsplit['RECOHI'] = 5
197  wmsplit['HLTD'] = 5
198  wmsplit['RECODreHLT'] = 2
199  wmsplit['DIGIPU'] = 4
200  wmsplit['DIGIPU1'] = 4
201  wmsplit['RECOPU1'] = 1
202  wmsplit['DIGIUP15_PU50'] = 1
203  wmsplit['RECOUP15_PU50'] = 1
204  wmsplit['DIGIUP15_PU25'] = 1
205  wmsplit['RECOUP15_PU25'] = 1
206  wmsplit['DIGIUP15_PU25HS'] = 1
207  wmsplit['RECOUP15_PU25HS'] = 1
208  wmsplit['DIGIHIMIX'] = 5
209  wmsplit['RECOHIMIX'] = 5
210  wmsplit['RECODSplit'] = 1
211  wmsplit['SingleMuPt10_UP15_ID'] = 1
212  wmsplit['DIGIUP15_ID'] = 1
213  wmsplit['RECOUP15_ID'] = 1
214  wmsplit['TTbar_13_ID'] = 1
215  wmsplit['SingleMuPt10FS_ID'] = 1
216  wmsplit['TTbarFS_ID'] = 1
217  wmsplit['RECODR2_50nsreHLT'] = 5
218  wmsplit['RECODR2_25nsreHLT'] = 5
219  wmsplit['RECODR2_2016reHLT'] = 5
220  wmsplit['RECODR2_50nsreHLT_HIPM'] = 5
221  wmsplit['RECODR2_25nsreHLT_HIPM'] = 5
222  wmsplit['RECODR2_2016reHLT_HIPM'] = 1
223  wmsplit['RECODR2_2016reHLT_skimSingleMu'] = 1
224  wmsplit['RECODR2_2016reHLT_skimDoubleEG'] = 1
225  wmsplit['RECODR2_2016reHLT_skimMuonEG'] = 1
226  wmsplit['RECODR2_2016reHLT_skimJetHT'] = 1
227  wmsplit['RECODR2_2016reHLT_skimMET'] = 1
228  wmsplit['RECODR2_2016reHLT_skimSinglePh'] = 1
229  wmsplit['RECODR2_2016reHLT_skimMuOnia'] = 1
230  wmsplit['RECODR2_2016reHLT_skimSingleMu_HIPM'] = 1
231  wmsplit['RECODR2_2016reHLT_skimDoubleEG_HIPM'] = 1
232  wmsplit['RECODR2_2016reHLT_skimMuonEG_HIPM'] = 1
233  wmsplit['RECODR2_2016reHLT_skimJetHT_HIPM'] = 1
234  wmsplit['RECODR2_2016reHLT_skimMET_HIPM'] = 1
235  wmsplit['RECODR2_2016reHLT_skimSinglePh_HIPM'] = 1
236  wmsplit['RECODR2_2016reHLT_skimMuOnia_HIPM'] = 1
237  wmsplit['RECODR2_2017reHLT_Prompt'] = 1
238  wmsplit['RECODR2_2017reHLT_skimSingleMu_Prompt_Lumi'] = 1
239  wmsplit['RECODR2_2017reHLT_skimDoubleEG_Prompt'] = 1
240  wmsplit['RECODR2_2017reHLT_skimMET_Prompt'] = 1
241  wmsplit['RECODR2_2017reHLT_skimMuOnia_Prompt'] = 1
242  wmsplit['RECODR2_2017reHLT_Prompt_L1TEgDQM'] = 1
243  wmsplit['RECODR2_2018reHLT_Prompt'] = 1
244  wmsplit['RECODR2_2018reHLT_skimSingleMu_Prompt_Lumi'] = 1
245  wmsplit['RECODR2_2018reHLT_skimDoubleEG_Prompt'] = 1
246  wmsplit['RECODR2_2018reHLT_skimJetHT_Prompt'] = 1
247  wmsplit['RECODR2_2018reHLT_skimMET_Prompt'] = 1
248  wmsplit['RECODR2_2018reHLT_skimMuOnia_Prompt'] = 1
249  wmsplit['RECODR2_2018reHLT_skimEGamma_Prompt_L1TEgDQM'] = 1
250  wmsplit['RECODR2_2018reHLT_skimMuonEG_Prompt'] = 1
251  wmsplit['RECODR2_2018reHLT_skimCharmonium_Prompt'] = 1
252  wmsplit['RECODR2_2018reHLT_skimJetHT_Prompt_HEfail'] = 1
253  wmsplit['RECODR2_2018reHLT_skimJetHT_Prompt_BadHcalMitig'] = 1
254  wmsplit['RECODR2_2018reHLTAlCaTkCosmics_Prompt'] = 1
255  wmsplit['RECODR2_2018reHLT_skimDisplacedJet_Prompt'] = 1
256  wmsplit['RECODR2_2018reHLT_ZBPrompt'] = 1
257  wmsplit['RECODR2_2018reHLT_Offline'] = 1
258  wmsplit['RECODR2_2018reHLT_skimSingleMu_Offline_Lumi'] = 1
259  wmsplit['RECODR2_2018reHLT_skimDoubleEG_Offline'] = 1
260  wmsplit['RECODR2_2018reHLT_skimJetHT_Offline'] = 1
261  wmsplit['RECODR2_2018reHLT_skimMET_Offline'] = 1
262  wmsplit['RECODR2_2018reHLT_skimMuOnia_Offline'] = 1
263  wmsplit['RECODR2_2018reHLT_skimEGamma_Offline_L1TEgDQM'] = 1
264  wmsplit['RECODR2_2018reHLT_skimMuonEG_Offline'] = 1
265  wmsplit['RECODR2_2018reHLT_skimCharmonium_Offline'] = 1
266  wmsplit['RECODR2_2018reHLT_skimJetHT_Offline_HEfail'] = 1
267  wmsplit['RECODR2_2018reHLT_skimJetHT_Offline_BadHcalMitig'] = 1
268  wmsplit['RECODR2_2018reHLTAlCaTkCosmics_Offline'] = 1
269  wmsplit['RECODR2_2018reHLT_skimDisplacedJet_Offline'] = 1
270  wmsplit['RECODR2_2018reHLT_ZBOffline'] = 1
271  wmsplit['HLTDR2_50ns'] = 1
272  wmsplit['HLTDR2_25ns'] = 1
273  wmsplit['HLTDR2_2016'] = 1
274  wmsplit['HLTDR2_2017'] = 1
275  wmsplit['HLTDR2_2018'] = 1
276  wmsplit['HLTDR2_2018_BadHcalMitig'] = 1
277  wmsplit['Hadronizer'] = 1
278  wmsplit['DIGIUP15'] = 1
279  wmsplit['RECOUP15'] = 1
280  wmsplit['RECOAODUP15'] = 5
281  wmsplit['DBLMINIAODMCUP15NODQM'] = 5
282  wmsplit['Digi'] = 5
283  wmsplit['Reco'] = 5
284  wmsplit['DigiPU'] = 1
285  wmsplit['RecoPU'] = 1
286  wmsplit['RECOHID11'] = 1
287  wmsplit['DIGIUP17'] = 1
288  wmsplit['RECOUP17'] = 1
289  wmsplit['DIGIUP17_PU25'] = 1
290  wmsplit['RECOUP17_PU25'] = 1
291  wmsplit['DIGICOS_UP16'] = 1
292  wmsplit['RECOCOS_UP16'] = 1
293  wmsplit['DIGICOS_UP17'] = 1
294  wmsplit['RECOCOS_UP17'] = 1
295  wmsplit['DIGICOS_UP18'] = 1
296  wmsplit['RECOCOS_UP18'] = 1
297  wmsplit['DIGICOS_UP21'] = 1
298  wmsplit['RECOCOS_UP21'] = 1
299  wmsplit['HYBRIDRepackHI2015VR'] = 1
300  wmsplit['HYBRIDZSHI2015'] = 1
301  wmsplit['RECOHID15'] = 1
302  wmsplit['RECOHID18'] = 1
303  # automate for phase 2
304  from .upgradeWorkflowComponents import upgradeKeys
305  for key in upgradeKeys[2026]:
306  if 'PU' not in key:
307  continue
308 
309  wmsplit['DigiTriggerPU_' + key] = 1
310  wmsplit['RecoGlobalPU_' + key] = 1
311 
312  except Exception as ex:
313  print('Exception while building a wmsplit dictionary: %s' % (str(ex)))
314  return {}
315 
316  return wmsplit
317 

References print(), and str.

◆ prepare()

def MatrixInjector.MatrixInjector.prepare (   self,
  mReader,
  directories,
  mode = 'init' 
)

Definition at line 318 of file MatrixInjector.py.

318  def prepare(self, mReader, directories, mode='init'):
319  wmsplit = MatrixInjector.get_wmsplit()
320  acqEra=False
321  for (n,dir) in directories.items():
322  chainDict=copy.deepcopy(self.defaultChain)
323  print("inspecting",dir)
324  nextHasDSInput=None
325  for (x,s) in mReader.workFlowSteps.items():
326  #x has the format (num, prefix)
327  #s has the format (num, name, commands, stepList)
328  if x[0]==n:
329  #print "found",n,s[3]
330  #chainDict['RequestString']='RV'+chainDict['CMSSWVersion']+s[1].split('+')[0]
331  index=0
332  splitForThisWf=None
333  thisLabel=self.speciallabel
334  #if 'HARVESTGEN' in s[3]:
335  if len( [step for step in s[3] if "HARVESTGEN" in step] )>0:
336  chainDict['TimePerEvent']=0.01
337  thisLabel=thisLabel+"_gen"
338  # for double miniAOD test
339  if len( [step for step in s[3] if "DBLMINIAODMCUP15NODQM" in step] )>0:
340  thisLabel=thisLabel+"_dblMiniAOD"
341  processStrPrefix=''
342  setPrimaryDs=None
343  nanoedmGT=''
344  for step in s[3]:
345 
346  if 'INPUT' in step or (not isinstance(s[2][index],str)):
347  nextHasDSInput=s[2][index]
348 
349  else:
350 
351  if (index==0):
352  #first step and not input -> gen part
353  chainDict['nowmTasklist'].append(copy.deepcopy(self.defaultScratch))
354  try:
355  chainDict['nowmTasklist'][-1]['nowmIO']=json.loads(open('%s/%s.io'%(dir,step)).read())
356  except:
357  print("Failed to find",'%s/%s.io'%(dir,step),".The workflows were probably not run on cfg not created")
358  return -15
359 
360  chainDict['nowmTasklist'][-1]['PrimaryDataset']='RelVal'+s[1].split('+')[0]
361  if not '--relval' in s[2][index]:
362  print('Impossible to create task from scratch without splitting information with --relval')
363  return -12
364  else:
365  arg=s[2][index].split()
366  ns=list(map(int,arg[len(arg) - arg[-1::-1].index('--relval')].split(',')))
367  chainDict['nowmTasklist'][-1]['RequestNumEvents'] = ns[0]
368  chainDict['nowmTasklist'][-1]['EventsPerJob'] = ns[1]
369  chainDict['nowmTasklist'][-1]['EventsPerLumi'] = ns[1]
370  #overwrite EventsPerLumi if numberEventsInLuminosityBlock is set in cmsDriver
371  if 'numberEventsInLuminosityBlock' in s[2][index]:
372  nEventsInLuminosityBlock = re.findall('process.source.numberEventsInLuminosityBlock=cms.untracked.uint32\(([ 0-9 ]*)\)', s[2][index],re.DOTALL)
373  if nEventsInLuminosityBlock[-1].isdigit() and int(nEventsInLuminosityBlock[-1]) < ns[1]:
374  chainDict['nowmTasklist'][-1]['EventsPerLumi'] = int(nEventsInLuminosityBlock[-1])
375  if(self.numberEventsInLuminosityBlock > 0 and self.numberEventsInLuminosityBlock <= ns[1]):
376  chainDict['nowmTasklist'][-1]['EventsPerLumi'] = self.numberEventsInLuminosityBlock
377  if 'FASTSIM' in s[2][index] or '--fast' in s[2][index]:
378  thisLabel+='_FastSim'
379  if 'lhe' in s[2][index] in s[2][index]:
380  chainDict['nowmTasklist'][-1]['LheInputFiles'] =True
381 
382  elif nextHasDSInput:
383  chainDict['nowmTasklist'].append(copy.deepcopy(self.defaultInput))
384  try:
385  chainDict['nowmTasklist'][-1]['nowmIO']=json.loads(open('%s/%s.io'%(dir,step)).read())
386  except:
387  print("Failed to find",'%s/%s.io'%(dir,step),".The workflows were probably not run on cfg not created")
388  return -15
389  chainDict['nowmTasklist'][-1]['InputDataset']=nextHasDSInput.dataSet
390  if ('DQMHLTonRAWAOD' in step) :
391  chainDict['nowmTasklist'][-1]['IncludeParents']=True
392  splitForThisWf=nextHasDSInput.split
393  chainDict['nowmTasklist'][-1]['LumisPerJob']=splitForThisWf
394  if step in wmsplit:
395  chainDict['nowmTasklist'][-1]['LumisPerJob']=wmsplit[step]
396  # get the run numbers or #events
397  if len(nextHasDSInput.run):
398  chainDict['nowmTasklist'][-1]['RunWhitelist']=nextHasDSInput.run
399  if len(nextHasDSInput.ls):
400  chainDict['nowmTasklist'][-1]['LumiList']=nextHasDSInput.ls
401  #print "what is s",s[2][index]
402  if '--data' in s[2][index] and nextHasDSInput.label:
403  thisLabel+='_RelVal_%s'%nextHasDSInput.label
404  if 'filter' in chainDict['nowmTasklist'][-1]['nowmIO']:
405  print("This has an input DS and a filter sequence: very likely to be the PyQuen sample")
406  processStrPrefix='PU_'
407  setPrimaryDs = 'RelVal'+s[1].split('+')[0]
408  if setPrimaryDs:
409  chainDict['nowmTasklist'][-1]['PrimaryDataset']=setPrimaryDs
410  nextHasDSInput=None
411  else:
412  #not first step and no inputDS
413  chainDict['nowmTasklist'].append(copy.deepcopy(self.defaultTask))
414  try:
415  chainDict['nowmTasklist'][-1]['nowmIO']=json.loads(open('%s/%s.io'%(dir,step)).read())
416  except:
417  print("Failed to find",'%s/%s.io'%(dir,step),".The workflows were probably not run on cfg not created")
418  return -15
419  if splitForThisWf:
420  chainDict['nowmTasklist'][-1]['LumisPerJob']=splitForThisWf
421  if step in wmsplit:
422  chainDict['nowmTasklist'][-1]['LumisPerJob']=wmsplit[step]
423 
424  # change LumisPerJob for Hadronizer steps.
425  if 'Hadronizer' in step:
426  chainDict['nowmTasklist'][-1]['LumisPerJob']=wmsplit['Hadronizer']
427 
428  #print step
429  chainDict['nowmTasklist'][-1]['TaskName']=step
430  if setPrimaryDs:
431  chainDict['nowmTasklist'][-1]['PrimaryDataset']=setPrimaryDs
432  chainDict['nowmTasklist'][-1]['ConfigCacheID']='%s/%s.py'%(dir,step)
433  chainDict['nowmTasklist'][-1]['GlobalTag']=chainDict['nowmTasklist'][-1]['nowmIO']['GT'] # copy to the proper parameter name
434  chainDict['GlobalTag']=chainDict['nowmTasklist'][-1]['nowmIO']['GT'] #set in general to the last one of the chain
435  if 'NANOEDM' in step :
436  nanoedmGT = chainDict['nowmTasklist'][-1]['nowmIO']['GT']
437  if 'NANOMERGE' in step :
438  chainDict['GlobalTag'] = nanoedmGT
439  if 'pileup' in chainDict['nowmTasklist'][-1]['nowmIO']:
440  chainDict['nowmTasklist'][-1]['MCPileup']=chainDict['nowmTasklist'][-1]['nowmIO']['pileup']
441  if '--pileup ' in s[2][index]: # catch --pileup (scenarion) and not --pileup_ (dataset to be mixed) => works also making PRE-MIXed dataset
442  processStrPrefix='PU_' # take care of pu overlay done with GEN-SIM mixing
443  if ( s[2][index].split()[ s[2][index].split().index('--pileup')+1 ] ).find('25ns') > 0 :
444  processStrPrefix='PU25ns_'
445  elif ( s[2][index].split()[ s[2][index].split().index('--pileup')+1 ] ).find('50ns') > 0 :
446  processStrPrefix='PU50ns_'
447  if 'premix_stage2' in s[2][index] and '--pileup_input' in s[2][index]: # take care of pu overlay done with DIGI mixing of premixed events
448  if s[2][index].split()[ s[2][index].split().index('--pileup_input')+1 ].find('25ns') > 0 :
449  processStrPrefix='PUpmx25ns_'
450  elif s[2][index].split()[ s[2][index].split().index('--pileup_input')+1 ].find('50ns') > 0 :
451  processStrPrefix='PUpmx50ns_'
452 
453  if acqEra:
454  #chainDict['AcquisitionEra'][step]=(chainDict['CMSSWVersion']+'-PU_'+chainDict['nowmTasklist'][-1]['GlobalTag']).replace('::All','')+thisLabel
455  chainDict['AcquisitionEra'][step]=chainDict['CMSSWVersion']
456  chainDict['ProcessingString'][step]=processStrPrefix+chainDict['nowmTasklist'][-1]['GlobalTag'].replace('::All','').replace('-','_')+thisLabel
457  if 'NANOMERGE' in step :
458  chainDict['ProcessingString'][step]=processStrPrefix+nanoedmGT.replace('::All','').replace('-','_')+thisLabel
459  else:
460  #chainDict['nowmTasklist'][-1]['AcquisitionEra']=(chainDict['CMSSWVersion']+'-PU_'+chainDict['nowmTasklist'][-1]['GlobalTag']).replace('::All','')+thisLabel
461  chainDict['nowmTasklist'][-1]['AcquisitionEra']=chainDict['CMSSWVersion']
462  chainDict['nowmTasklist'][-1]['ProcessingString']=processStrPrefix+chainDict['nowmTasklist'][-1]['GlobalTag'].replace('::All','').replace('-','_')+thisLabel
463  if 'NANOMERGE' in step :
464  chainDict['nowmTasklist'][-1]['ProcessingString']=processStrPrefix+nanoedmGT.replace('::All','').replace('-','_')+thisLabel
465 
466  if (self.batchName):
467  chainDict['nowmTasklist'][-1]['Campaign'] = chainDict['nowmTasklist'][-1]['AcquisitionEra']+self.batchName
468 
469  # specify different ProcessingString for double miniAOD dataset
470  if ('DBLMINIAODMCUP15NODQM' in step):
471  chainDict['nowmTasklist'][-1]['ProcessingString']=chainDict['nowmTasklist'][-1]['ProcessingString']+'_miniAOD'
472 
473  if( chainDict['nowmTasklist'][-1]['Multicore'] ):
474  # the scaling factor of 1.2GB / thread is empirical and measured on a SECOND round of tests with PU samples
475  # the number of threads is NO LONGER assumed to be the same for all tasks
476  # https://hypernews.cern.ch/HyperNews/CMS/get/edmFramework/3509/1/1/1.html
477  # now change to 1.5GB / additional thread according to discussion:
478  # https://hypernews.cern.ch/HyperNews/CMS/get/relval/4817/1/1.html
479 # chainDict['nowmTasklist'][-1]['Memory'] = 3000 + int( chainDict['nowmTasklist'][-1]['Multicore'] -1 )*1500
480  chainDict['nowmTasklist'][-1]['Memory'] = self.memoryOffset + int( chainDict['nowmTasklist'][-1]['Multicore'] -1 ) * self.memPerCore
481 
482  index+=1
483  #end of loop through steps
484  chainDict['RequestString']='RV'+chainDict['CMSSWVersion']+s[1].split('+')[0]
485  if processStrPrefix or thisLabel:
486  chainDict['RequestString']+='_'+processStrPrefix+thisLabel
487  #check candidate WF name
488  self.candidateWFName = self.user+'_'+chainDict['RequestString']
489  if (len(self.candidateWFName)>MAXWORKFLOWLENGTH):
490  self.longWFName.append(self.candidateWFName)
491 

References mps_setup.append, MatrixInjector.MatrixInjector.batchName, MatrixInjector.MatrixInjector.defaultChain, MatrixInjector.MatrixInjector.defaultInput, MatrixInjector.MatrixInjector.defaultScratch, MatrixInjector.MatrixInjector.defaultTask, spr.find(), if(), createfilelist.int, genParticles_cff.map, MatrixInjector.MatrixInjector.memoryOffset, MatrixInjector.MatrixInjector.memPerCore, MatrixInjector.MatrixInjector.numberEventsInLuminosityBlock, print(), readEcalDQMStatus.read, python.rootplot.root2matplotlib.replace(), MatrixInjector.MatrixInjector.speciallabel, and submitPVValidationJobs.split().

◆ submit()

def MatrixInjector.MatrixInjector.submit (   self)

Definition at line 637 of file MatrixInjector.py.

637  def submit(self):
638  try:
639  from modules.wma import makeRequest,approveRequest
640  from wmcontrol import random_sleep
641  print('\n\tFound wmcontrol\n')
642  except:
643  print('\n\tUnable to find wmcontrol modules. Please include it in your python path\n')
644  if not self.testMode:
645  print('\n\t QUIT\n')
646  sys.exit(-17)
647 
648  import pprint
649  for (n,d) in self.chainDicts.items():
650  if self.testMode:
651  print("Only viewing request",n)
652  print(pprint.pprint(d))
653  else:
654  #submit to wmagent each dict
655  print("For eyes before submitting",n)
656  print(pprint.pprint(d))
657  print("Submitting",n,"...........")
658  workFlow=makeRequest(self.wmagent,d,encodeDict=True)
659  print("...........",n,"submitted")
660  random_sleep()
661  if self.testMode and len(self.longWFName)>0:
662  print("\n*** WARNING: "+str(len(self.longWFName))+" workflows have too long names for submission (>"+str(MAXWORKFLOWLENGTH)+ "characters) ***")
663  print('\n'.join(self.longWFName))

References MatrixInjector.MatrixInjector.chainDicts, mps_monitormerge.items, join(), MatrixInjector.MatrixInjector.longWFName, print(), str, MatrixInjector.MatrixInjector.testMode, and MatrixInjector.MatrixInjector.wmagent.

◆ upload()

def MatrixInjector.MatrixInjector.upload (   self)

Definition at line 617 of file MatrixInjector.py.

617  def upload(self):
618  for (n,d) in self.chainDicts.items():
619  for it in d:
620  if it.startswith("Task") and it!='TaskChain':
621  #upload
622  couchID=self.uploadConf(d[it]['ConfigCacheID'],
623  str(n)+d[it]['TaskName'],
624  d['ConfigCacheUrl']
625  )
626  print(d[it]['ConfigCacheID']," uploaded to couchDB for",str(n),"with ID",couchID)
627  d[it]['ConfigCacheID']=couchID
628  if it =='DQMConfigCacheID':
629  couchID=self.uploadConf(d['DQMConfigCacheID'],
630  str(n)+'harvesting',
631  d['ConfigCacheUrl']
632  )
633  print(d['DQMConfigCacheID'],"uploaded to couchDB for",str(n),"with ID",couchID)
634  d['DQMConfigCacheID']=couchID
635 
636 

References MatrixInjector.MatrixInjector.chainDicts, mps_monitormerge.items, print(), str, and MatrixInjector.MatrixInjector.uploadConf().

◆ uploadConf()

def MatrixInjector.MatrixInjector.uploadConf (   self,
  filePath,
  label,
  where 
)

the info are not in the task specific dict but in the general dict t_input.update(copy.deepcopy(self.defaultHarvest)) t_input['DQMConfigCacheID']=t_second['ConfigCacheID']

batch name appended to Campaign name chainDict['Campaign'] = chainDict['AcquisitionEra'] clean things up now provide the number of tasks

Definition at line 590 of file MatrixInjector.py.

590  def uploadConf(self,filePath,label,where):
591  labelInCouch=self.label+'_'+label
592  cacheName=filePath.split('/')[-1]
593  if self.testMode:
594  self.count+=1
595  print('\tFake upload of',filePath,'to couch with label',labelInCouch)
596  return self.count
597  else:
598  try:
599  from modules.wma import upload_to_couch,DATABASE_NAME
600  except:
601  print('\n\tUnable to find wmcontrol modules. Please include it in your python path\n')
602  print('\n\t QUIT\n')
603  sys.exit(-16)
604 
605  if cacheName in self.couchCache:
606  print("Not re-uploading",filePath,"to",where,"for",label)
607  cacheId=self.couchCache[cacheName]
608  else:
609  print("Loading",filePath,"to",where,"for",label)
610 
611  pool = multiprocessing.Pool(1)
612  cacheIds = pool.map( upload_to_couch_oneArg, [(filePath,labelInCouch,self.user,self.group,where)] )
613  cacheId = cacheIds[0]
614  self.couchCache[cacheName]=cacheId
615  return cacheId
616 

References MatrixInjector.MatrixInjector.couchCache, TmCcu.count, TmModule.count, TmApvPair.count, TmPsu.count, MatrixInjector.MatrixInjector.count, ValidationMisalignedTracker.count, SiStripDetSummary::Values.count, MatrixInjector.MatrixInjector.group, ElectronLikelihoodCategoryData.label, entry< T >.label, classes.PlotData.label, SiPixelFedFillerWordEventNumber.label, L1GtBoardTypeStringToEnum.label, HcalLutSet.label, TtEvent::HypoClassKeyStringToEnum.label, L1GtPsbQuadStringToEnum.label, L1GtConditionTypeStringToEnum.label, ValidationMisalignedTracker.label, PPSAlignmentConfigESSource.label, MatrixInjector.MatrixInjector.label, L1GtConditionCategoryStringToEnum.label, HcalDbProducer::ServiceToken< ProductType, LABEL, EffectiveType >.label, cond::payloadInspector::ModuleVersion.label, print(), MatrixInjector.MatrixInjector.testMode, EcalTPGParamReaderFromDB.user, popcon::RPCObPVSSmapData.user, popcon::RpcDataV.user, popcon::RpcDataT.user, popcon::RpcObGasData.user, popcon::RpcDataGasMix.user, popcon::RpcDataS.user, popcon::RpcDataI.user, popcon::RpcDataFebmap.user, popcon::RpcDataUXC.user, and MatrixInjector.MatrixInjector.user.

Referenced by MatrixInjector.MatrixInjector.upload().

Member Data Documentation

◆ batchName

MatrixInjector.MatrixInjector.batchName

Definition at line 63 of file MatrixInjector.py.

Referenced by MatrixInjector.MatrixInjector.prepare().

◆ batchTime

MatrixInjector.MatrixInjector.batchTime

Definition at line 64 of file MatrixInjector.py.

◆ candidateWFName

MatrixInjector.MatrixInjector.candidateWFName

Definition at line 488 of file MatrixInjector.py.

◆ chainDicts

MatrixInjector.MatrixInjector.chainDicts

◆ couch

MatrixInjector.MatrixInjector.couch

Definition at line 95 of file MatrixInjector.py.

◆ couchCache

MatrixInjector.MatrixInjector.couchCache

Definition at line 97 of file MatrixInjector.py.

Referenced by MatrixInjector.MatrixInjector.uploadConf().

◆ count

MatrixInjector.MatrixInjector.count

◆ DbsUrl

MatrixInjector.MatrixInjector.DbsUrl

Definition at line 82 of file MatrixInjector.py.

◆ defaultChain

MatrixInjector.MatrixInjector.defaultChain

Definition at line 114 of file MatrixInjector.py.

Referenced by MatrixInjector.MatrixInjector.prepare().

◆ defaultHarvest

MatrixInjector.MatrixInjector.defaultHarvest

Definition at line 138 of file MatrixInjector.py.

◆ defaultInput

MatrixInjector.MatrixInjector.defaultInput

Definition at line 160 of file MatrixInjector.py.

Referenced by MatrixInjector.MatrixInjector.prepare().

◆ defaultScratch

MatrixInjector.MatrixInjector.defaultScratch

Definition at line 145 of file MatrixInjector.py.

Referenced by MatrixInjector.MatrixInjector.prepare().

◆ defaultTask

MatrixInjector.MatrixInjector.defaultTask

Definition at line 172 of file MatrixInjector.py.

Referenced by MatrixInjector.MatrixInjector.prepare().

◆ dqmgui

MatrixInjector.MatrixInjector.dqmgui

Definition at line 46 of file MatrixInjector.py.

◆ group

MatrixInjector.MatrixInjector.group

Definition at line 99 of file MatrixInjector.py.

Referenced by MatrixInjector.MatrixInjector.uploadConf().

◆ keep

MatrixInjector.MatrixInjector.keep

Definition at line 56 of file MatrixInjector.py.

◆ label

MatrixInjector.MatrixInjector.label

◆ longWFName

MatrixInjector.MatrixInjector.longWFName

Definition at line 104 of file MatrixInjector.py.

Referenced by MatrixInjector.MatrixInjector.submit().

◆ memoryOffset

MatrixInjector.MatrixInjector.memoryOffset

Definition at line 57 of file MatrixInjector.py.

Referenced by MatrixInjector.MatrixInjector.prepare().

◆ memPerCore

MatrixInjector.MatrixInjector.memPerCore

Definition at line 58 of file MatrixInjector.py.

Referenced by MatrixInjector.MatrixInjector.prepare().

◆ numberEventsInLuminosityBlock

MatrixInjector.MatrixInjector.numberEventsInLuminosityBlock

Definition at line 59 of file MatrixInjector.py.

Referenced by MatrixInjector.MatrixInjector.prepare().

◆ numberOfStreams

MatrixInjector.MatrixInjector.numberOfStreams

Definition at line 60 of file MatrixInjector.py.

◆ speciallabel

MatrixInjector.MatrixInjector.speciallabel

Definition at line 101 of file MatrixInjector.py.

Referenced by MatrixInjector.MatrixInjector.prepare().

◆ testMode

MatrixInjector.MatrixInjector.testMode

◆ user

MatrixInjector.MatrixInjector.user

◆ version

MatrixInjector.MatrixInjector.version

◆ wmagent

MatrixInjector.MatrixInjector.wmagent

Definition at line 47 of file MatrixInjector.py.

Referenced by MatrixInjector.MatrixInjector.submit().

join
static std::string join(char **cmd)
Definition: RemoteFile.cc:17
if
if(0==first)
Definition: CAHitNtupletGeneratorKernelsImpl.h:58
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
mps_monitormerge.items
list items
Definition: mps_monitormerge.py:29
submitPVValidationJobs.split
def split(sequence, size)
Definition: submitPVValidationJobs.py:352
str
#define str(s)
Definition: TestProcessor.cc:53
print
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:46
mps_setup.append
append
Definition: mps_setup.py:85
createfilelist.int
int
Definition: createfilelist.py:10
readEcalDQMStatus.read
read
Definition: readEcalDQMStatus.py:38
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
alcaDQMUpload.upload
def upload(url, args, files)
Definition: alcaDQMUpload.py:65
genParticles_cff.map
map
Definition: genParticles_cff.py:11
python.rootplot.root2matplotlib.replace
def replace(string, replacements)
Definition: root2matplotlib.py:444