CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes
MatrixInjector.MatrixInjector Class Reference
Inheritance diagram for MatrixInjector.MatrixInjector:

Public Member Functions

def __init__
 
def prepare
 
def submit
 
def upload
 
def uploadConf
 provide the number of tasks More...
 

Static Public Member Functions

def get_wmsplit
 

Public Attributes

 batchName
 
 batchTime
 
 candidateWFName
 
 chainDicts
 
 couch
 
 couchCache
 
 count
 
 CUDACapabilities
 
 CUDADriverVersion
 
 CUDARuntime
 
 CUDARuntimeVersion
 
 DbsUrl
 
 defaultChain
 
 defaultGPUParams
 
 defaultHarvest
 
 defaultInput
 
 defaultScratch
 
 defaultTask
 
 dqmgui
 
 GPUMemoryMB
 
 GPUName
 
 group
 
 keep
 
 label
 
 longWFName
 
 memoryOffset
 
 memPerCore
 
 numberEventsInLuminosityBlock
 
 numberOfStreams
 
 RequiresGPU
 Checking and setting up GPU attributes. More...
 
 speciallabel
 
 testMode
 
 user
 
 version
 
 wmagent
 

Static Public Attributes

int itask = 0
 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...
 
list primary = t_second['nowmIO']
 
list t_input = chainDict['nowmTasklist']
 
list t_second = chainDict['nowmTasklist']
 

Detailed Description

Definition at line 41 of file MatrixInjector.py.

Constructor & Destructor Documentation

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

Definition at line 43 of file MatrixInjector.py.

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

Member Function Documentation

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

Definition at line 212 of file MatrixInjector.py.

References print(), and str.

213  def get_wmsplit():
214  """
215  Return a "wmsplit" dictionary that contain non-default LumisPerJob values
216  """
217  wmsplit = {}
218  try:
219  wmsplit['DIGIHI'] = 5
220  wmsplit['RECOHI'] = 5
221  wmsplit['HLTD'] = 5
222  wmsplit['RECODreHLT'] = 2
223  wmsplit['DIGIPU'] = 4
224  wmsplit['DIGIPU1'] = 4
225  wmsplit['RECOPU1'] = 1
226  wmsplit['DIGIUP15_PU50'] = 1
227  wmsplit['RECOUP15_PU50'] = 1
228  wmsplit['DIGIUP15_PU25'] = 1
229  wmsplit['RECOUP15_PU25'] = 1
230  wmsplit['DIGIUP15_PU25HS'] = 1
231  wmsplit['RECOUP15_PU25HS'] = 1
232  wmsplit['DIGIHIMIX'] = 5
233  wmsplit['RECOHIMIX'] = 5
234  wmsplit['RECODSplit'] = 1
235  wmsplit['SingleMuPt10_UP15_ID'] = 1
236  wmsplit['DIGIUP15_ID'] = 1
237  wmsplit['RECOUP15_ID'] = 1
238  wmsplit['TTbar_13_ID'] = 1
239  wmsplit['SingleMuPt10FS_ID'] = 1
240  wmsplit['TTbarFS_ID'] = 1
241  wmsplit['RECODR2_50nsreHLT'] = 5
242  wmsplit['RECODR2_25nsreHLT'] = 5
243  wmsplit['RECODR2_2016reHLT'] = 5
244  wmsplit['RECODR2_50nsreHLT_HIPM'] = 5
245  wmsplit['RECODR2_25nsreHLT_HIPM'] = 5
246  wmsplit['RECODR2_2016reHLT_HIPM'] = 1
247  wmsplit['RECODR2_2016reHLT_skimSingleMu'] = 1
248  wmsplit['RECODR2_2016reHLT_skimDoubleEG'] = 1
249  wmsplit['RECODR2_2016reHLT_skimMuonEG'] = 1
250  wmsplit['RECODR2_2016reHLT_skimJetHT'] = 1
251  wmsplit['RECODR2_2016reHLT_skimMET'] = 1
252  wmsplit['RECODR2_2016reHLT_skimSinglePh'] = 1
253  wmsplit['RECODR2_2016reHLT_skimMuOnia'] = 1
254  wmsplit['RECODR2_2016reHLT_skimSingleMu_HIPM'] = 1
255  wmsplit['RECODR2_2016reHLT_skimDoubleEG_HIPM'] = 1
256  wmsplit['RECODR2_2016reHLT_skimMuonEG_HIPM'] = 1
257  wmsplit['RECODR2_2016reHLT_skimJetHT_HIPM'] = 1
258  wmsplit['RECODR2_2016reHLT_skimMET_HIPM'] = 1
259  wmsplit['RECODR2_2016reHLT_skimSinglePh_HIPM'] = 1
260  wmsplit['RECODR2_2016reHLT_skimMuOnia_HIPM'] = 1
261  wmsplit['RECODR2_2017reHLT_Prompt'] = 1
262  wmsplit['RECODR2_2017reHLT_skimSingleMu_Prompt_Lumi'] = 1
263  wmsplit['RECODR2_2017reHLT_skimDoubleEG_Prompt'] = 1
264  wmsplit['RECODR2_2017reHLT_skimMET_Prompt'] = 1
265  wmsplit['RECODR2_2017reHLT_skimMuOnia_Prompt'] = 1
266  wmsplit['RECODR2_2017reHLT_Prompt_L1TEgDQM'] = 1
267  wmsplit['RECODR2_2018reHLT_Prompt'] = 1
268  wmsplit['RECODR2_2018reHLT_skimSingleMu_Prompt_Lumi'] = 1
269  wmsplit['RECODR2_2018reHLT_skimDoubleEG_Prompt'] = 1
270  wmsplit['RECODR2_2018reHLT_skimJetHT_Prompt'] = 1
271  wmsplit['RECODR2_2018reHLT_skimMET_Prompt'] = 1
272  wmsplit['RECODR2_2018reHLT_skimMuOnia_Prompt'] = 1
273  wmsplit['RECODR2_2018reHLT_skimEGamma_Prompt_L1TEgDQM'] = 1
274  wmsplit['RECODR2_2018reHLT_skimMuonEG_Prompt'] = 1
275  wmsplit['RECODR2_2018reHLT_skimCharmonium_Prompt'] = 1
276  wmsplit['RECODR2_2018reHLT_skimJetHT_Prompt_HEfail'] = 1
277  wmsplit['RECODR2_2018reHLT_skimJetHT_Prompt_BadHcalMitig'] = 1
278  wmsplit['RECODR2_2018reHLTAlCaTkCosmics_Prompt'] = 1
279  wmsplit['RECODR2_2018reHLT_skimDisplacedJet_Prompt'] = 1
280  wmsplit['RECODR2_2018reHLT_ZBPrompt'] = 1
281  wmsplit['RECODR2_2018reHLT_Offline'] = 1
282  wmsplit['RECODR2_2018reHLT_skimSingleMu_Offline_Lumi'] = 1
283  wmsplit['RECODR2_2018reHLT_skimDoubleEG_Offline'] = 1
284  wmsplit['RECODR2_2018reHLT_skimJetHT_Offline'] = 1
285  wmsplit['RECODR2_2018reHLT_skimMET_Offline'] = 1
286  wmsplit['RECODR2_2018reHLT_skimMuOnia_Offline'] = 1
287  wmsplit['RECODR2_2018reHLT_skimEGamma_Offline_L1TEgDQM'] = 1
288  wmsplit['RECODR2_2018reHLT_skimMuonEG_Offline'] = 1
289  wmsplit['RECODR2_2018reHLT_skimCharmonium_Offline'] = 1
290  wmsplit['RECODR2_2018reHLT_skimJetHT_Offline_HEfail'] = 1
291  wmsplit['RECODR2_2018reHLT_skimJetHT_Offline_BadHcalMitig'] = 1
292  wmsplit['RECODR2_2018reHLTAlCaTkCosmics_Offline'] = 1
293  wmsplit['RECODR2_2018reHLT_skimDisplacedJet_Offline'] = 1
294  wmsplit['RECODR2_2018reHLT_ZBOffline'] = 1
295  wmsplit['HLTDR2_50ns'] = 1
296  wmsplit['HLTDR2_25ns'] = 1
297  wmsplit['HLTDR2_2016'] = 1
298  wmsplit['HLTDR2_2017'] = 1
299  wmsplit['HLTDR2_2018'] = 1
300  wmsplit['HLTDR2_2018_BadHcalMitig'] = 1
301  wmsplit['Hadronizer'] = 1
302  wmsplit['DIGIUP15'] = 1
303  wmsplit['RECOUP15'] = 1
304  wmsplit['RECOAODUP15'] = 5
305  wmsplit['DBLMINIAODMCUP15NODQM'] = 5
306  wmsplit['Digi'] = 5
307  wmsplit['Reco'] = 5
308  wmsplit['DigiPU'] = 1
309  wmsplit['RecoPU'] = 1
310  wmsplit['RECOHID11'] = 1
311  wmsplit['DIGIUP17'] = 1
312  wmsplit['RECOUP17'] = 1
313  wmsplit['DIGIUP17_PU25'] = 1
314  wmsplit['RECOUP17_PU25'] = 1
315  wmsplit['DIGICOS_UP16'] = 1
316  wmsplit['RECOCOS_UP16'] = 1
317  wmsplit['DIGICOS_UP17'] = 1
318  wmsplit['RECOCOS_UP17'] = 1
319  wmsplit['DIGICOS_UP18'] = 1
320  wmsplit['RECOCOS_UP18'] = 1
321  wmsplit['DIGICOS_UP21'] = 1
322  wmsplit['RECOCOS_UP21'] = 1
323  wmsplit['HYBRIDRepackHI2015VR'] = 1
324  wmsplit['HYBRIDZSHI2015'] = 1
325  wmsplit['RECOHID15'] = 1
326  wmsplit['RECOHID18'] = 1
327  # automate for phase 2
328  from .upgradeWorkflowComponents import upgradeKeys
329  for key in upgradeKeys[2026]:
330  if 'PU' not in key:
331  continue
332 
333  wmsplit['DigiTriggerPU_' + key] = 1
334  wmsplit['RecoGlobalPU_' + key] = 1
335 
336  except Exception as ex:
337  print('Exception while building a wmsplit dictionary: %s' % (str(ex)))
338  return {}
339 
340  return wmsplit
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
#define str(s)
def MatrixInjector.MatrixInjector.prepare (   self,
  mReader,
  directories,
  mode = 'init' 
)

Definition at line 341 of file MatrixInjector.py.

References bitset_utilities.append(), MatrixInjector.MatrixInjector.batchName, MatrixInjector.MatrixInjector.defaultChain, MatrixInjector.MatrixInjector.defaultGPUParams, MatrixInjector.MatrixInjector.defaultInput, MatrixInjector.MatrixInjector.defaultScratch, MatrixInjector.MatrixInjector.defaultTask, spr.find(), if(), MatrixInjector.MatrixInjector.memoryOffset, MatrixInjector.MatrixInjector.memPerCore, MatrixInjector.MatrixInjector.numberEventsInLuminosityBlock, print(), SiPixelLorentzAngle_cfi.read, python.rootplot.root2matplotlib.replace(), MatrixInjector.MatrixInjector.RequiresGPU, MatrixInjector.MatrixInjector.speciallabel, and submitPVValidationJobs.split().

342  def prepare(self, mReader, directories, mode='init'):
343  wmsplit = MatrixInjector.get_wmsplit()
344  acqEra=False
345  for (n,dir) in directories.items():
346  chainDict=copy.deepcopy(self.defaultChain)
347  print("inspecting",dir)
348  nextHasDSInput=None
349  for (x,s) in mReader.workFlowSteps.items():
350  #x has the format (num, prefix)
351  #s has the format (num, name, commands, stepList)
352  if x[0]==n:
353  #print "found",n,s[3]
354  #chainDict['RequestString']='RV'+chainDict['CMSSWVersion']+s[1].split('+')[0]
355  index=0
356  splitForThisWf=None
357  thisLabel=self.speciallabel
358  #if 'HARVESTGEN' in s[3]:
359  if len( [step for step in s[3] if "HARVESTGEN" in step] )>0:
360  chainDict['TimePerEvent']=0.01
361  thisLabel=thisLabel+"_gen"
362  # for double miniAOD test
363  if len( [step for step in s[3] if "DBLMINIAODMCUP15NODQM" in step] )>0:
364  thisLabel=thisLabel+"_dblMiniAOD"
365  processStrPrefix=''
366  setPrimaryDs=None
367  nanoedmGT=''
368  for step in s[3]:
369 
370  if 'INPUT' in step or (not isinstance(s[2][index],str)):
371  nextHasDSInput=s[2][index]
372 
373  else:
374 
375  if (index==0):
376  #first step and not input -> gen part
377  chainDict['nowmTasklist'].append(copy.deepcopy(self.defaultScratch))
378  try:
379  chainDict['nowmTasklist'][-1]['nowmIO']=json.loads(open('%s/%s.io'%(dir,step)).read())
380  except:
381  print("Failed to find",'%s/%s.io'%(dir,step),".The workflows were probably not run on cfg not created")
382  return -15
383 
384  chainDict['nowmTasklist'][-1]['PrimaryDataset']='RelVal'+s[1].split('+')[0]
385  if not '--relval' in s[2][index]:
386  print('Impossible to create task from scratch without splitting information with --relval')
387  return -12
388  else:
389  arg=s[2][index].split()
390  ns=list(map(int,arg[len(arg) - arg[-1::-1].index('--relval')].split(',')))
391  chainDict['nowmTasklist'][-1]['RequestNumEvents'] = ns[0]
392  chainDict['nowmTasklist'][-1]['EventsPerJob'] = ns[1]
393  chainDict['nowmTasklist'][-1]['EventsPerLumi'] = ns[1]
394  #overwrite EventsPerLumi if numberEventsInLuminosityBlock is set in cmsDriver
395  if 'numberEventsInLuminosityBlock' in s[2][index]:
396  nEventsInLuminosityBlock = re.findall('process.source.numberEventsInLuminosityBlock=cms.untracked.uint32\(([ 0-9 ]*)\)', s[2][index],re.DOTALL)
397  if nEventsInLuminosityBlock[-1].isdigit() and int(nEventsInLuminosityBlock[-1]) < ns[1]:
398  chainDict['nowmTasklist'][-1]['EventsPerLumi'] = int(nEventsInLuminosityBlock[-1])
400  chainDict['nowmTasklist'][-1]['EventsPerLumi'] = self.numberEventsInLuminosityBlock
401  if 'FASTSIM' in s[2][index] or '--fast' in s[2][index]:
402  thisLabel+='_FastSim'
403  if 'lhe' in s[2][index] in s[2][index]:
404  chainDict['nowmTasklist'][-1]['LheInputFiles'] =True
405 
406  elif nextHasDSInput:
407  chainDict['nowmTasklist'].append(copy.deepcopy(self.defaultInput))
408  try:
409  chainDict['nowmTasklist'][-1]['nowmIO']=json.loads(open('%s/%s.io'%(dir,step)).read())
410  except:
411  print("Failed to find",'%s/%s.io'%(dir,step),".The workflows were probably not run on cfg not created")
412  return -15
413  chainDict['nowmTasklist'][-1]['InputDataset']=nextHasDSInput.dataSet
414  if ('DQMHLTonRAWAOD' in step) :
415  chainDict['nowmTasklist'][-1]['IncludeParents']=True
416  splitForThisWf=nextHasDSInput.split
417  chainDict['nowmTasklist'][-1]['LumisPerJob']=splitForThisWf
418  if step in wmsplit:
419  chainDict['nowmTasklist'][-1]['LumisPerJob']=wmsplit[step]
420  # get the run numbers or #events
421  if len(nextHasDSInput.run):
422  chainDict['nowmTasklist'][-1]['RunWhitelist']=nextHasDSInput.run
423  if len(nextHasDSInput.ls):
424  chainDict['nowmTasklist'][-1]['LumiList']=nextHasDSInput.ls
425  #print "what is s",s[2][index]
426  if '--data' in s[2][index] and nextHasDSInput.label:
427  thisLabel+='_RelVal_%s'%nextHasDSInput.label
428  if 'filter' in chainDict['nowmTasklist'][-1]['nowmIO']:
429  print("This has an input DS and a filter sequence: very likely to be the PyQuen sample")
430  processStrPrefix='PU_'
431  setPrimaryDs = 'RelVal'+s[1].split('+')[0]
432  if setPrimaryDs:
433  chainDict['nowmTasklist'][-1]['PrimaryDataset']=setPrimaryDs
434  nextHasDSInput=None
435  if 'GPU' in step and self.RequiresGPU != 'forbidden':
436  chainDict['nowmTasklist'][-1]['RequiresGPU'] = self.RequiresGPU
437  chainDict['nowmTasklist'][-1]['GPUParams']=json.dumps(self.defaultGPUParams)
438  else:
439  #not first step and no inputDS
440  chainDict['nowmTasklist'].append(copy.deepcopy(self.defaultTask))
441  try:
442  chainDict['nowmTasklist'][-1]['nowmIO']=json.loads(open('%s/%s.io'%(dir,step)).read())
443  except:
444  print("Failed to find",'%s/%s.io'%(dir,step),".The workflows were probably not run on cfg not created")
445  return -15
446  if splitForThisWf:
447  chainDict['nowmTasklist'][-1]['LumisPerJob']=splitForThisWf
448  if step in wmsplit:
449  chainDict['nowmTasklist'][-1]['LumisPerJob']=wmsplit[step]
450  if 'GPU' in step and self.RequiresGPU != 'forbidden':
451  chainDict['nowmTasklist'][-1]['RequiresGPU'] = self.RequiresGPU
452  chainDict['nowmTasklist'][-1]['GPUParams']=json.dumps(self.defaultGPUParams)
453 
454  # change LumisPerJob for Hadronizer steps.
455  if 'Hadronizer' in step:
456  chainDict['nowmTasklist'][-1]['LumisPerJob']=wmsplit['Hadronizer']
457 
458  #print step
459  chainDict['nowmTasklist'][-1]['TaskName']=step
460  if setPrimaryDs:
461  chainDict['nowmTasklist'][-1]['PrimaryDataset']=setPrimaryDs
462  chainDict['nowmTasklist'][-1]['ConfigCacheID']='%s/%s.py'%(dir,step)
463  chainDict['nowmTasklist'][-1]['GlobalTag']=chainDict['nowmTasklist'][-1]['nowmIO']['GT'] # copy to the proper parameter name
464  chainDict['GlobalTag']=chainDict['nowmTasklist'][-1]['nowmIO']['GT'] #set in general to the last one of the chain
465  if 'NANOEDM' in step :
466  nanoedmGT = chainDict['nowmTasklist'][-1]['nowmIO']['GT']
467  if 'NANOMERGE' in step :
468  chainDict['GlobalTag'] = nanoedmGT
469  if 'pileup' in chainDict['nowmTasklist'][-1]['nowmIO']:
470  chainDict['nowmTasklist'][-1]['MCPileup']=chainDict['nowmTasklist'][-1]['nowmIO']['pileup']
471  if '--pileup ' in s[2][index]: # catch --pileup (scenarion) and not --pileup_ (dataset to be mixed) => works also making PRE-MIXed dataset
472  pileupString = s[2][index].split()[s[2][index].split().index('--pileup')+1]
473  processStrPrefix='PU_' # take care of pu overlay done with GEN-SIM mixing
474  if pileupString.find('25ns') > 0 :
475  processStrPrefix='PU25ns_'
476  elif pileupString.find('50ns') > 0 :
477  processStrPrefix='PU50ns_'
478  elif 'nopu' in pileupString.lower():
479  processStrPrefix=''
480  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
481  if s[2][index].split()[ s[2][index].split().index('--pileup_input')+1 ].find('25ns') > 0 :
482  processStrPrefix='PUpmx25ns_'
483  elif s[2][index].split()[ s[2][index].split().index('--pileup_input')+1 ].find('50ns') > 0 :
484  processStrPrefix='PUpmx50ns_'
485 
486  if acqEra:
487  #chainDict['AcquisitionEra'][step]=(chainDict['CMSSWVersion']+'-PU_'+chainDict['nowmTasklist'][-1]['GlobalTag']).replace('::All','')+thisLabel
488  chainDict['AcquisitionEra'][step]=chainDict['CMSSWVersion']
489  chainDict['ProcessingString'][step]=processStrPrefix+chainDict['nowmTasklist'][-1]['GlobalTag'].replace('::All','').replace('-','_')+thisLabel
490  if 'NANOMERGE' in step :
491  chainDict['ProcessingString'][step]=processStrPrefix+nanoedmGT.replace('::All','').replace('-','_')+thisLabel
492  else:
493  #chainDict['nowmTasklist'][-1]['AcquisitionEra']=(chainDict['CMSSWVersion']+'-PU_'+chainDict['nowmTasklist'][-1]['GlobalTag']).replace('::All','')+thisLabel
494  chainDict['nowmTasklist'][-1]['AcquisitionEra']=chainDict['CMSSWVersion']
495  chainDict['nowmTasklist'][-1]['ProcessingString']=processStrPrefix+chainDict['nowmTasklist'][-1]['GlobalTag'].replace('::All','').replace('-','_')+thisLabel
496  if 'NANOMERGE' in step :
497  chainDict['nowmTasklist'][-1]['ProcessingString']=processStrPrefix+nanoedmGT.replace('::All','').replace('-','_')+thisLabel
498 
499  if (self.batchName):
500  chainDict['nowmTasklist'][-1]['Campaign'] = chainDict['nowmTasklist'][-1]['AcquisitionEra']+self.batchName
501 
502  # specify different ProcessingString for double miniAOD dataset
503  if ('DBLMINIAODMCUP15NODQM' in step):
504  chainDict['nowmTasklist'][-1]['ProcessingString']=chainDict['nowmTasklist'][-1]['ProcessingString']+'_miniAOD'
505 
506  if( chainDict['nowmTasklist'][-1]['Multicore'] ):
507  # the scaling factor of 1.2GB / thread is empirical and measured on a SECOND round of tests with PU samples
508  # the number of threads is NO LONGER assumed to be the same for all tasks
509  # https://hypernews.cern.ch/HyperNews/CMS/get/edmFramework/3509/1/1/1.html
510  # now change to 1.5GB / additional thread according to discussion:
511  # https://hypernews.cern.ch/HyperNews/CMS/get/relval/4817/1/1.html
512 # chainDict['nowmTasklist'][-1]['Memory'] = 3000 + int( chainDict['nowmTasklist'][-1]['Multicore'] -1 )*1500
513  chainDict['nowmTasklist'][-1]['Memory'] = self.memoryOffset + int( chainDict['nowmTasklist'][-1]['Multicore'] -1 ) * self.memPerCore
514 
515  index+=1
516  #end of loop through steps
517  chainDict['RequestString']='RV'+chainDict['CMSSWVersion']+s[1].split('+')[0]
518  if processStrPrefix or thisLabel:
519  chainDict['RequestString']+='_'+processStrPrefix+thisLabel
520  #check candidate WF name
521  self.candidateWFName = self.user+'_'+chainDict['RequestString']
522  if (len(self.candidateWFName)>MAXWORKFLOWLENGTH):
523  self.longWFName.append(self.candidateWFName)
boost::dynamic_bitset append(const boost::dynamic_bitset<> &bs1, const boost::dynamic_bitset<> &bs2)
this method takes two bitsets bs1 and bs2 and returns result of bs2 appended to the end of bs1 ...
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
if(conf_.getParameter< bool >("UseStripCablingDB"))
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
RequiresGPU
Checking and setting up GPU attributes.
def MatrixInjector.MatrixInjector.submit (   self)

Definition at line 669 of file MatrixInjector.py.

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

670  def submit(self):
671  try:
672  from modules.wma import makeRequest,approveRequest
673  from wmcontrol import random_sleep
674  print('\n\tFound wmcontrol\n')
675  except:
676  print('\n\tUnable to find wmcontrol modules. Please include it in your python path\n')
677  if not self.testMode:
678  print('\n\t QUIT\n')
679  sys.exit(-17)
680 
681  import pprint
682  for (n,d) in self.chainDicts.items():
683  if self.testMode:
684  print("Only viewing request",n)
685  print(pprint.pprint(d))
686  else:
687  #submit to wmagent each dict
688  print("For eyes before submitting",n)
689  print(pprint.pprint(d))
690  print("Submitting",n,"...........")
691  workFlow=makeRequest(self.wmagent,d,encodeDict=True)
692  print("...........",n,"submitted")
693  random_sleep()
694  if self.testMode and len(self.longWFName)>0:
695  print("\n*** WARNING: "+str(len(self.longWFName))+" workflows have too long names for submission (>"+str(MAXWORKFLOWLENGTH)+ "characters) ***")
696  print('\n'.join(self.longWFName))
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
#define str(s)
def MatrixInjector.MatrixInjector.upload (   self)

Definition at line 649 of file MatrixInjector.py.

References print(), str, and MatrixInjector.MatrixInjector.uploadConf().

650  def upload(self):
651  for (n,d) in self.chainDicts.items():
652  for it in d:
653  if it.startswith("Task") and it!='TaskChain':
654  #upload
655  couchID=self.uploadConf(d[it]['ConfigCacheID'],
656  str(n)+d[it]['TaskName'],
657  d['ConfigCacheUrl']
658  )
659  print(d[it]['ConfigCacheID']," uploaded to couchDB for",str(n),"with ID",couchID)
660  d[it]['ConfigCacheID']=couchID
661  if it =='DQMConfigCacheID':
662  couchID=self.uploadConf(d['DQMConfigCacheID'],
663  str(n)+'harvesting',
664  d['ConfigCacheUrl']
665  )
666  print(d['DQMConfigCacheID'],"uploaded to couchDB for",str(n),"with ID",couchID)
667  d['DQMConfigCacheID']=couchID
668 
def uploadConf
provide the number of tasks
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
#define str(s)
def MatrixInjector.MatrixInjector.uploadConf (   self,
  filePath,
  label,
  where 
)

provide the number of tasks

Definition at line 622 of file MatrixInjector.py.

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, PPSAlignmentConfigurationESSource.label, L1GtConditionTypeStringToEnum.label, ValidationMisalignedTracker.label, L1GtConditionCategoryStringToEnum.label, HcalDbProducer::ServiceToken< ProductType, LABEL, EffectiveType >.label, MatrixInjector.MatrixInjector.label, cond::payloadInspector::ModuleVersion.label, print(), MatrixInjector.MatrixInjector.testMode, EcalTPGParamReaderFromDB.user, popcon::RpcDataT.user, popcon::RpcObGasData.user, popcon::RPCObPVSSmapData.user, popcon::RpcDataV.user, popcon::RpcDataGasMix.user, popcon::RpcDataFebmap.user, popcon::RpcDataI.user, popcon::RpcDataS.user, popcon::RpcDataUXC.user, and MatrixInjector.MatrixInjector.user.

Referenced by MatrixInjector.MatrixInjector.upload().

623  def uploadConf(self,filePath,label,where):
624  labelInCouch=self.label+'_'+label
625  cacheName=filePath.split('/')[-1]
626  if self.testMode:
627  self.count+=1
628  print('\tFake upload of',filePath,'to couch with label',labelInCouch)
629  return self.count
630  else:
631  try:
632  from modules.wma import upload_to_couch,DATABASE_NAME
633  except:
634  print('\n\tUnable to find wmcontrol modules. Please include it in your python path\n')
635  print('\n\t QUIT\n')
636  sys.exit(-16)
637 
638  if cacheName in self.couchCache:
639  print("Not re-uploading",filePath,"to",where,"for",label)
640  cacheId=self.couchCache[cacheName]
641  else:
642  print("Loading",filePath,"to",where,"for",label)
643  ## totally fork the upload to couch to prevent cross loading of process configurations
644  pool = multiprocessing.Pool(1)
645  cacheIds = pool.map( upload_to_couch_oneArg, [(filePath,labelInCouch,self.user,self.group,where)] )
646  cacheId = cacheIds[0]
647  self.couchCache[cacheName]=cacheId
648  return cacheId
def uploadConf
provide the number of tasks
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47

Member Data Documentation

MatrixInjector.MatrixInjector.batchName

Definition at line 63 of file MatrixInjector.py.

Referenced by MatrixInjector.MatrixInjector.prepare().

MatrixInjector.MatrixInjector.batchTime

Definition at line 64 of file MatrixInjector.py.

MatrixInjector.MatrixInjector.candidateWFName

Definition at line 520 of file MatrixInjector.py.

MatrixInjector.MatrixInjector.chainDicts

Definition at line 209 of file MatrixInjector.py.

MatrixInjector.MatrixInjector.couch

Definition at line 108 of file MatrixInjector.py.

MatrixInjector.MatrixInjector.couchCache

Definition at line 110 of file MatrixInjector.py.

Referenced by MatrixInjector.MatrixInjector.uploadConf().

MatrixInjector.MatrixInjector.count

Definition at line 44 of file MatrixInjector.py.

Referenced by MatrixInjector.MatrixInjector.uploadConf().

MatrixInjector.MatrixInjector.CUDACapabilities

Definition at line 74 of file MatrixInjector.py.

MatrixInjector.MatrixInjector.CUDADriverVersion

Definition at line 78 of file MatrixInjector.py.

MatrixInjector.MatrixInjector.CUDARuntime

Definition at line 75 of file MatrixInjector.py.

MatrixInjector.MatrixInjector.CUDARuntimeVersion

Definition at line 79 of file MatrixInjector.py.

MatrixInjector.MatrixInjector.DbsUrl

Definition at line 95 of file MatrixInjector.py.

MatrixInjector.MatrixInjector.defaultChain

Definition at line 127 of file MatrixInjector.py.

Referenced by MatrixInjector.MatrixInjector.prepare().

MatrixInjector.MatrixInjector.defaultGPUParams

Definition at line 200 of file MatrixInjector.py.

Referenced by MatrixInjector.MatrixInjector.prepare().

MatrixInjector.MatrixInjector.defaultHarvest

Definition at line 151 of file MatrixInjector.py.

MatrixInjector.MatrixInjector.defaultInput

Definition at line 173 of file MatrixInjector.py.

Referenced by MatrixInjector.MatrixInjector.prepare().

MatrixInjector.MatrixInjector.defaultScratch

Definition at line 158 of file MatrixInjector.py.

Referenced by MatrixInjector.MatrixInjector.prepare().

MatrixInjector.MatrixInjector.defaultTask

Definition at line 185 of file MatrixInjector.py.

Referenced by MatrixInjector.MatrixInjector.prepare().

MatrixInjector.MatrixInjector.dqmgui

Definition at line 46 of file MatrixInjector.py.

MatrixInjector.MatrixInjector.GPUMemoryMB

Definition at line 73 of file MatrixInjector.py.

MatrixInjector.MatrixInjector.GPUName

Definition at line 77 of file MatrixInjector.py.

MatrixInjector.MatrixInjector.group

Definition at line 112 of file MatrixInjector.py.

Referenced by MatrixInjector.MatrixInjector.uploadConf().

int MatrixInjector.MatrixInjector.itask = 0
static

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

Definition at line 591 of file MatrixInjector.py.

MatrixInjector.MatrixInjector.keep

Definition at line 56 of file MatrixInjector.py.

MatrixInjector.MatrixInjector.label

Definition at line 113 of file MatrixInjector.py.

Referenced by python.rootplot.root2matplotlib.Hist.bar(), python.rootplot.root2matplotlib.Hist.barh(), python.rootplot.root2matplotlib.Hist.errorbar(), python.rootplot.root2matplotlib.Hist.errorbarh(), core.TriggerMatchAnalyzer.TriggerMatchAnalyzer.process(), core.AutoHandle.AutoHandle.ReallyLoad(), and MatrixInjector.MatrixInjector.uploadConf().

MatrixInjector.MatrixInjector.longWFName

Definition at line 117 of file MatrixInjector.py.

Referenced by MatrixInjector.MatrixInjector.submit().

MatrixInjector.MatrixInjector.memoryOffset

Definition at line 57 of file MatrixInjector.py.

Referenced by MatrixInjector.MatrixInjector.prepare().

MatrixInjector.MatrixInjector.memPerCore

Definition at line 58 of file MatrixInjector.py.

Referenced by MatrixInjector.MatrixInjector.prepare().

MatrixInjector.MatrixInjector.numberEventsInLuminosityBlock

Definition at line 59 of file MatrixInjector.py.

Referenced by MatrixInjector.MatrixInjector.prepare().

MatrixInjector.MatrixInjector.numberOfStreams

Definition at line 60 of file MatrixInjector.py.

list MatrixInjector.MatrixInjector.primary = t_second['nowmIO']
static

Definition at line 541 of file MatrixInjector.py.

MatrixInjector.MatrixInjector.RequiresGPU

Checking and setting up GPU attributes.

Mendatory

Definition at line 72 of file MatrixInjector.py.

Referenced by MatrixInjector.MatrixInjector.prepare().

MatrixInjector.MatrixInjector.speciallabel

Definition at line 114 of file MatrixInjector.py.

Referenced by MatrixInjector.MatrixInjector.prepare().

list MatrixInjector.MatrixInjector.t_input = chainDict['nowmTasklist']
static

Definition at line 543 of file MatrixInjector.py.

list MatrixInjector.MatrixInjector.t_second = chainDict['nowmTasklist']
static

Definition at line 537 of file MatrixInjector.py.

MatrixInjector.MatrixInjector.testMode

Definition at line 54 of file MatrixInjector.py.

Referenced by MatrixInjector.MatrixInjector.submit(), and MatrixInjector.MatrixInjector.uploadConf().

MatrixInjector.MatrixInjector.user

Definition at line 111 of file MatrixInjector.py.

Referenced by dataset.BaseDataset.printInfo(), DTWorkflow.DTWorkflow.remote_out_path(), production_tasks.CheckDatasetExists.run(), production_tasks.GenerateMask.run(), production_tasks.SourceCFG.run(), production_tasks.FullCFG.run(), production_tasks.MonitorJobs.run(), production_tasks.CleanJobFiles.run(), and MatrixInjector.MatrixInjector.uploadConf().

MatrixInjector.MatrixInjector.version

Definition at line 55 of file MatrixInjector.py.

Referenced by validation.Sample.datasetpattern(), and validation.Sample.filename().

MatrixInjector.MatrixInjector.wmagent

Definition at line 47 of file MatrixInjector.py.

Referenced by MatrixInjector.MatrixInjector.submit().