CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Public Attributes | Properties | Private Member Functions | Private Attributes | Static Private Attributes
Config.Process Class Reference
Inheritance diagram for Config.Process:

Public Member Functions

def __delattr__
 
def __init__
 
def __setattr__
 
def __setstate__ (self, pkldict)
 
def add_ (self, value)
 
def addSubProcess (self, mod)
 
def aliases_ (self)
 
def analyzerNames (self)
 
def analyzers_ (self)
 
def conditionaltasks_ (self)
 
def dumpConfig
 
def dumpPython (self, options=PrintOptions())
 
def endpaths_ (self)
 
def es_prefers_ (self)
 
def es_producers_ (self)
 
def es_sources_ (self)
 
def extend (self, other, items=())
 
def fillProcessDesc (self, processPSet)
 
def filterNames (self)
 
def filters_ (self)
 
def finalpaths_ (self)
 
def globalReplace
 
def handleProcessAccelerators (self, parameterSet)
 
def isUsingModifier (self, mod)
 
def load
 
def looper_ (self)
 
def name_ (self)
 
def outputModules_ (self)
 
def pathNames (self)
 
def paths_ (self)
 
def prefer (self, esmodule, args, kargs)
 
def processAccelerators_ (self)
 
def producerNames (self)
 
def producers_ (self)
 
def prune
 
def psets_ (self)
 
def resolve
 
def schedule_ (self)
 
def sequences_ (self)
 
def services_ (self)
 
def setLooper_ (self, lpr)
 
def setName_
 
def setPartialSchedule_
 
def setSchedule_
 
def setSource_ (self, src)
 
def setStrict
 
def source_ (self)
 
def splitPython
 
def subProcesses_ (self)
 
def switchProducerNames (self)
 
def switchProducers_ (self)
 
def tasks_ (self)
 
def validate (self)
 
def vpsets_ (self)
 

Static Public Member Functions

def defaultMaxEvents_ ()
 
def defaultMaxLuminosityBlocks_ ()
 
def defaultOptions_ ()
 

Public Attributes

 maxLuminosityBlocks
 
 MessageLogger
 

Properties

 aliases = property(aliases_,doc="dictionary containing the aliases for the process")
 
 analyzers = property(analyzers_,doc="dictionary containing the analyzers for the process")
 
 conditionaltasks = property(conditionaltasks_,doc="dictionary containing the conditionatasks for the process")
 
 endpaths = property(endpaths_,doc="dictionary containing the endpaths for the process")
 
 es_prefers = property(es_prefers_,doc="dictionary containing the es_prefers for the process")
 
 es_producers = property(es_producers_,doc="dictionary containing the es_producers for the process")
 
 es_sources = property(es_sources_,doc="dictionary containing the es_sources for the process")
 
 filters = property(filters_, doc="dictionary containing the filters for the process")
 
 finalpaths = property(finalpaths_,doc="dictionary containing the finalpaths for the process")
 
 looper = property(looper_,setLooper_,doc='the main looper or None if not set')
 
 outputModules = property(outputModules_,doc="dictionary containing the output_modules for the process")
 
 paths = property(paths_,doc="dictionary containing the paths for the process")
 
 process = property(name_,setName_, doc="name of the process")
 
 processAccelerators = property(processAccelerators_,doc="dictionary containing the ProcessAccelerators for the process")
 
 producers = property(producers_,doc="dictionary containing the producers for the process")
 
 psets = property(psets_,doc="dictionary containing the PSets for the process")
 
 schedule = property(schedule_,setSchedule_,doc='the schedule or None if not set')
 
 sequences = property(sequences_,doc="dictionary containing the sequences for the process")
 
 services = property(services_,doc="dictionary containing the services for the process")
 
 source = property(source_,setSource_,doc='the main source or None if not set')
 
 subProcesses = property(subProcesses_,doc='the SubProcesses that have been added to the Process')
 
 switchProducers = property(switchProducers_,doc="dictionary containing the SwitchProducers for the process")
 
 tasks = property(tasks_,doc="dictionary containing the tasks for the process")
 
 vpsets = property(vpsets_,doc="dictionary containing the PSets for the process")
 

Private Member Functions

def __findFirstUsingModule (self, seqsOrTasks, mod)
 
def __injectValidValue
 
def __setObjectLabel
 
def __updateMaxEvents
 
def __updateOptions (self, opt)
 
def _delattrFromSetattr
 
def _delHelper
 
def _dumpConfigESPrefers
 
def _dumpConfigNamedList
 
def _dumpConfigOptionallyNamedList
 
def _dumpConfigUnnamedList
 
def _dumpPython
 
def _dumpPythonList
 
def _dumpPythonSubProcesses
 
def _findPreferred
 
def _insertInto (self, parameterSet, itemDict)
 
def _insertManyInto
 
def _insertOneInto
 
def _insertPaths (self, processPSet, nodeVisitor)
 
def _insertSubProcessesInto
 
def _insertSwitchProducersInto
 
def _itemsInDependencyOrder (self, processDictionaryOfItems)
 
def _okToPlace
 
def _place
 
def _placeAccelerator
 
def _placeAlias
 
def _placeAnalyzer
 
def _placeConditionalTask
 
def _placeEndPath
 
def _placeESPrefer
 
def _placeESProducer
 
def _placeESSource
 
def _placeFilter
 
def _placeFinalPath
 
def _placeLooper
 
def _placeOutputModule
 
def _placePath
 
def _placeProducer
 
def _placePSet
 
def _placeSequence
 
def _placeService
 
def _placeSource
 
def _placeSubProcess
 
def _placeSwitchProducer
 
def _placeTask
 
def _placeVPSet
 
def _pruneModules (self, d, scheduledNames)
 
def _replaceInConditionalTasks
 
def _replaceInSchedule
 
def _replaceInScheduleDirectly
 
def _replaceInSequences
 
def _replaceInTasks
 
def _splitPython
 
def _splitPythonList
 
def _validateConditionalTask
 
def _validateSequence (self, sequence, label)
 
def _validateTask
 

Private Attributes

 __isStrict
 
 __ppset
 
 __process
 
 __processPSet
 
 __thelist
 

Static Private Attributes

 _firstProcess
 

Detailed Description

Root class for a CMS configuration process

Definition at line 114 of file Config.py.

Constructor & Destructor Documentation

◆ __init__()

def Config.Process.__init__ (   self,
  name 
)

Definition at line 117 of file Config.py.

Referenced by Config.Process.fillProcessDesc().

117  def __init__(self,name: str, *Mods):
118  """The argument 'name' will be the name applied to this Process
119  Can optionally pass as additional arguments cms.Modifier instances
120  that will be used to modify the Process as it is built
121  """
122  self.__dict__['_Process__name'] = name
123  if not name.isalnum():
124  raise RuntimeError("Error: The process name is an empty string or contains non-alphanumeric characters")
125  self.__dict__['_Process__filters'] = {}
126  self.__dict__['_Process__producers'] = {}
127  self.__dict__['_Process__switchproducers'] = {}
128  self.__dict__['_Process__source'] = None
129  self.__dict__['_Process__looper'] = None
130  self.__dict__['_Process__subProcesses'] = []
131  self.__dict__['_Process__schedule'] = None
132  self.__dict__['_Process__analyzers'] = {}
133  self.__dict__['_Process__outputmodules'] = {}
134  self.__dict__['_Process__paths'] = DictTypes.SortedKeysDict() # have to keep the order
135  self.__dict__['_Process__endpaths'] = DictTypes.SortedKeysDict() # of definition
136  self.__dict__['_Process__finalpaths'] = DictTypes.SortedKeysDict() # of definition
137  self.__dict__['_Process__sequences'] = {}
138  self.__dict__['_Process__tasks'] = {}
139  self.__dict__['_Process__conditionaltasks'] = {}
140  self.__dict__['_Process__services'] = {}
141  self.__dict__['_Process__essources'] = {}
142  self.__dict__['_Process__esproducers'] = {}
143  self.__dict__['_Process__esprefers'] = {}
144  self.__dict__['_Process__aliases'] = {}
145  self.__dict__['_Process__psets']={}
146  self.__dict__['_Process__vpsets']={}
147  self.__dict__['_cloneToObjectDict'] = {}
148  # policy switch to avoid object overwriting during extend/load
149  self.__dict__['_Process__InExtendCall'] = False
150  self.__dict__['_Process__partialschedules'] = {}
151  self.__isStrict = False
152  self.__dict__['_Process__modifiers'] = Mods
153  self.__dict__['_Process__accelerators'] = {}
154  self.__injectValidValue('options', Process.defaultOptions_())
155  self.__injectValidValue('maxEvents', Process.defaultMaxEvents_())
156  self.maxLuminosityBlocks = Process.defaultMaxLuminosityBlocks_()
157  # intentionally not cloned to ensure that everyone taking
158  # MessageLogger still via
159  # FWCore.Message(Logger|Service).MessageLogger_cfi
160  # use the very same MessageLogger object.
161  self.MessageLogger = MessageLogger
162  if Process._firstProcess:
163  Process._firstProcess = False
164  else:
165  if len(Mods) > 0:
166  for m in self.__modifiers:
167  if not m._isChosen():
168  raise RuntimeError("The Process {} tried to redefine which Modifiers to use after another Process was already started".format(name))
169  for m in self.__modifiers:
170  m._setChosen()
171 
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

◆ __delattr__()

def Config.Process.__delattr__ (   self,
  name 
)

Definition at line 602 of file Config.py.

References Config.Process._delHelper(), Config.Process._replaceInConditionalTasks(), Config.Process._replaceInSchedule(), Config.Process._replaceInScheduleDirectly(), Config.Process._replaceInSequences(), and Config.Process._replaceInTasks().

602  def __delattr__(self,name:str):
603  self._delHelper(name)
604  obj = getattr(self,name)
605  if not obj is None:
606  if not isinstance(obj, Sequence) and not isinstance(obj, Task) and not isinstance(obj,ConditionalTask):
607  # For modules, ES modules and services we can also remove
608  # the deleted object from Sequences, Paths, EndPaths, and
609  # Tasks. Note that for Sequences and Tasks that cannot be done
610  # reliably as the places where the Sequence or Task was used
611  # might have been expanded so we do not even try. We considered
612  # raising an exception if a Sequences or Task was explicitly
613  # deleted, but did not because when done carefully deletion
614  # is sometimes OK (for example in the prune function where it
615  # has been checked that the deleted Sequence is not used).
616  if obj._isTaskComponent():
617  self._replaceInTasks(name, None)
618  self._replaceInConditionalTasks(name, None)
619  self._replaceInSchedule(name, None)
620  if isinstance(obj, _Sequenceable) or obj._isTaskComponent():
621  self._replaceInSequences(name, None)
622  if Schedule._itemIsValid(obj) or isinstance(obj, Task):
623  self._replaceInScheduleDirectly(name, None)
624  # now remove it from the process itself
625  try:
626  del self.__dict__[name]
627  except:
628  pass
629 

◆ __findFirstUsingModule()

def Config.Process.__findFirstUsingModule (   self,
  seqsOrTasks,
  mod 
)
private
Given a container of sequences or tasks, find the first sequence or task
containing mod and return it. If none is found, return None

Definition at line 572 of file Config.py.

Referenced by Config.Process.__setattr__().

572  def __findFirstUsingModule(self, seqsOrTasks, mod):
573  """Given a container of sequences or tasks, find the first sequence or task
574  containing mod and return it. If none is found, return None"""
575  from FWCore.ParameterSet.SequenceTypes import ModuleNodeVisitor
576  l = list()
577  for seqOrTask in seqsOrTasks.values():
578  l[:] = []
579  v = ModuleNodeVisitor(l)
580  seqOrTask.visit(v)
581  if mod in l:
582  return seqOrTask
583  return None
584 

◆ __injectValidValue()

def Config.Process.__injectValidValue (   self,
  name 
)
private

Definition at line 562 of file Config.py.

References Config.Process.__setObjectLabel(), and EcalPhiSymFlatTableProducers_cfi.id.

Referenced by Config.Process.__setattr__().

562  def __injectValidValue(self, name:str, value, newValue = None):
563  if newValue is None:
564  newValue = value
565  self.__dict__[name]=newValue
566  if isinstance(newValue,_Labelable):
567  self.__setObjectLabel(newValue, name)
568  self._cloneToObjectDict[id(value)] = newValue
569  self._cloneToObjectDict[id(newValue)] = newValue
570  #now put in proper bucket
571  newValue._place(name,self)

◆ __setattr__()

def Config.Process.__setattr__ (   self,
  name 
)

Definition at line 421 of file Config.py.

References Config.Process.__findFirstUsingModule(), Config.Process.__injectValidValue(), Config.Process.__isStrict, Config.Process.__updateMaxEvents(), Config.Process.__updateOptions(), Config.Process._delattrFromSetattr(), Config.Process._okToPlace(), Config.Process._replaceInConditionalTasks(), Config.Process._replaceInSchedule(), Config.Process._replaceInScheduleDirectly(), Config.Process._replaceInSequences(), Config.Process._replaceInTasks(), Config.Process.add_(), Config.Process.endpaths, Config.Process.finalpaths, Config.Process.paths, Config.Process.sequences, str, and Config.Process.tasks.

Referenced by Config.Process._findPreferred(), Config.Process.extend(), and GenObject.GenObject.setValue().

421  def __setattr__(self,name:str,value):
422  # check if the name is well-formed (only _ and alphanumerics are allowed)
423  if not name.replace('_','').isalnum():
424  raise ValueError('The label '+name+' contains forbiden characters')
425 
426  if name == 'options':
427  value = self.__updateOptions(value)
428  if name == 'maxEvents':
429  value = self.__updateMaxEvents(value)
430 
431  # private variable exempt from all this
432  if name.startswith('_Process__'):
433  self.__dict__[name]=value
434  return
435  if not isinstance(value,_ConfigureComponent):
436  raise TypeError("can only assign labels to an object that inherits from '_ConfigureComponent'\n"
437  +"an instance of "+str(type(value))+" will not work - requested label is "+name)
438  if not isinstance(value,_Labelable) and not isinstance(value,Source) and not isinstance(value,Looper) and not isinstance(value,Schedule):
439  if name == value.type_():
440  if hasattr(self,name) and (getattr(self,name)!=value):
441  self._replaceInTasks(name, value)
442  self._replaceInConditionalTasks(name, value)
443  # Only Services get handled here
444  self.add_(value)
445  return
446  else:
447  raise TypeError("an instance of "+str(type(value))+" can not be assigned the label '"+name+"'.\n"+
448  "Please either use the label '"+value.type_()+" or use the 'add_' method instead.")
449  #clone the item
450  if self.__isStrict:
451  newValue =value.copy()
452  try:
453  newValue._filename = value._filename
454  except:
455  pass
456  value.setIsFrozen()
457  else:
458  newValue =value
459  if not self._okToPlace(name, value, self.__dict__):
460  newFile='top level config'
461  if hasattr(value,'_filename'):
462  newFile = value._filename
463  oldFile='top level config'
464  oldValue = getattr(self,name)
465  if hasattr(oldValue,'_filename'):
466  oldFile = oldValue._filename
467  msg = "Trying to override definition of process."+name
468  msg += "\n new object defined in: "+newFile
469  msg += "\n existing object defined in: "+oldFile
470  raise ValueError(msg)
471  # remove the old object of the name (if there is one)
472  if hasattr(self,name) and not (getattr(self,name)==newValue):
473  # Complain if items in sequences or tasks from load() statements have
474  # degenerate names, but if the user overwrites a name in the
475  # main config, replace it everywhere
476  if newValue._isTaskComponent():
477  if not self.__InExtendCall:
478  self._replaceInTasks(name, newValue)
479  self._replaceInConditionalTasks(name, newValue)
480  self._replaceInSchedule(name, newValue)
481  else:
482  if not isinstance(newValue, Task):
483  #should check to see if used in task before complaining
484  newFile='top level config'
485  if hasattr(value,'_filename'):
486  newFile = value._filename
487  oldFile='top level config'
488  oldValue = getattr(self,name)
489  if hasattr(oldValue,'_filename'):
490  oldFile = oldValue._filename
491  msg1 = "Trying to override definition of "+name+" while it is used by the task "
492  msg2 = "\n new object defined in: "+newFile
493  msg2 += "\n existing object defined in: "+oldFile
494  s = self.__findFirstUsingModule(self.tasks,oldValue)
495  if s is not None:
496  raise ValueError(msg1+s.label_()+msg2)
497 
498  if isinstance(newValue, _Sequenceable) or newValue._isTaskComponent() or isinstance(newValue, ConditionalTask):
499  if not self.__InExtendCall:
500  if isinstance(newValue, ConditionalTask):
501  self._replaceInConditionalTasks(name, newValue)
502  self._replaceInSequences(name, newValue)
503  else:
504  #should check to see if used in sequence before complaining
505  newFile='top level config'
506  if hasattr(value,'_filename'):
507  newFile = value._filename
508  oldFile='top level config'
509  oldValue = getattr(self,name)
510  if hasattr(oldValue,'_filename'):
511  oldFile = oldValue._filename
512  msg1 = "Trying to override definition of "+name+" while it is used by the "
513  msg2 = "\n new object defined in: "+newFile
514  msg2 += "\n existing object defined in: "+oldFile
515  s = self.__findFirstUsingModule(self.sequences,oldValue)
516  if s is not None:
517  raise ValueError(msg1+"sequence "+s.label_()+msg2)
518  s = self.__findFirstUsingModule(self.paths,oldValue)
519  if s is not None:
520  raise ValueError(msg1+"path "+s.label_()+msg2)
521  s = self.__findFirstUsingModule(self.endpaths,oldValue)
522  if s is not None:
523  raise ValueError(msg1+"endpath "+s.label_()+msg2)
524  s = self.__findFirstUsingModule(self.finalpaths,oldValue)
525  if s is not None:
526  raise ValueError(msg1+"finalpath "+s.label_()+msg2)
527 
528  # In case of EDAlias, raise Exception always to avoid surprises
529  if isinstance(newValue, EDAlias):
530  oldValue = getattr(self, name)
531  #should check to see if used in task/sequence before complaining
532  newFile='top level config'
533  if hasattr(value,'_filename'):
534  newFile = value._filename
535  oldFile='top level config'
536  if hasattr(oldValue,'_filename'):
537  oldFile = oldValue._filename
538  msg1 = "Trying to override definition of "+name+" with an EDAlias while it is used by the "
539  msg2 = "\n new object defined in: "+newFile
540  msg2 += "\n existing object defined in: "+oldFile
541  s = self.__findFirstUsingModule(self.tasks,oldValue)
542  if s is not None:
543  raise ValueError(msg1+"task "+s.label_()+msg2)
544  s = self.__findFirstUsingModule(self.sequences,oldValue)
545  if s is not None:
546  raise ValueError(msg1+"sequence "+s.label_()+msg2)
547  s = self.__findFirstUsingModule(self.paths,oldValue)
548  if s is not None:
549  raise ValueError(msg1+"path "+s.label_()+msg2)
550  s = self.__findFirstUsingModule(self.endpaths,oldValue)
551  if s is not None:
552  raise ValueError(msg1+"endpath "+s.label_()+msg2)
553  s = self.__findFirstUsingModule(self.finalpaths,oldValue)
554  if s is not None:
555  raise ValueError(msg1+"finalpath "+s.label_()+msg2)
556 
557  if not self.__InExtendCall and (Schedule._itemIsValid(newValue) or isinstance(newValue, Task)):
558  self._replaceInScheduleDirectly(name, newValue)
559 
560  self._delattrFromSetattr(name)
561  self.__injectValidValue(name, value, newValue)
#define str(s)

◆ __setObjectLabel()

def Config.Process.__setObjectLabel (   self,
  object,
  newLabel 
)
private

Definition at line 394 of file Config.py.

References EcalPhiSymFlatTableProducers_cfi.id, and str.

Referenced by Config.Process.__injectValidValue(), Config.Process._place(), and Config.Process.extend().

394  def __setObjectLabel(self, object, newLabel:str) :
395  if not object.hasLabel_() :
396  object.setLabel(newLabel)
397  return
398  if newLabel == object.label_() :
399  return
400  if newLabel is None :
401  object.setLabel(None)
402  return
403  if (hasattr(self, object.label_()) and id(getattr(self, object.label_())) == id(object)) :
404  msg100 = "Attempting to change the label of an attribute of the Process\n"
405  msg101 = "Old label = "+object.label_()+" New label = "+newLabel+"\n"
406  msg102 = "Type = "+str(type(object))+"\n"
407  msg103 = "Some possible solutions:\n"
408  msg104 = " 1. Clone modules instead of using simple assignment. Cloning is\n"
409  msg105 = " also preferred for other types when possible.\n"
410  msg106 = " 2. Declare new names starting with an underscore if they are\n"
411  msg107 = " for temporaries you do not want propagated into the Process. The\n"
412  msg108 = " underscore tells \"from x import *\" and process.load not to import\n"
413  msg109 = " the name.\n"
414  msg110 = " 3. Reorganize so the assigment is not necessary. Giving a second\n"
415  msg111 = " name to the same object usually causes confusion and problems.\n"
416  msg112 = " 4. Compose Sequences: newName = cms.Sequence(oldName)\n"
417  raise ValueError(msg100+msg101+msg102+msg103+msg104+msg105+msg106+msg107+msg108+msg109+msg110+msg111+msg112)
418  object.setLabel(None)
419  object.setLabel(newLabel)
420 
#define str(s)

◆ __setstate__()

def Config.Process.__setstate__ (   self,
  pkldict 
)
Unpickling hook.

Since cloneToObjectDict stores a hash of objects by their
id() it needs to be updated when unpickling to use the
new object id values instantiated during the unpickle.

Definition at line 193 of file Config.py.

References EcalPhiSymFlatTableProducers_cfi.id, update, and contentValuesCheck.values.

193  def __setstate__(self, pkldict):
194  """
195  Unpickling hook.
196 
197  Since cloneToObjectDict stores a hash of objects by their
198  id() it needs to be updated when unpickling to use the
199  new object id values instantiated during the unpickle.
200 
201  """
202  self.__dict__.update(pkldict)
203  tmpDict = {}
204  for value in self._cloneToObjectDict.values():
205  tmpDict[id(value)] = value
206  self.__dict__['_cloneToObjectDict'] = tmpDict
207 
208 
209 
#define update(a, b)

◆ __updateMaxEvents()

def Config.Process.__updateMaxEvents (   self,
  ps 
)
private

Definition at line 286 of file Config.py.

References Config.Process.defaultMaxEvents_().

Referenced by Config.Process.__setattr__().

286  def __updateMaxEvents(self,ps: Union[dict,PSet]):
287  newMax = self.defaultMaxEvents_()
288  if isinstance(ps,dict):
289  for k,v in ps.items():
290  setattr(newMax,k,v)
291  else:
292  for p in ps.parameters_():
293  setattr(newMax, p, getattr(ps,p))
294  return newMax

◆ __updateOptions()

def Config.Process.__updateOptions (   self,
  opt 
)
private

Definition at line 273 of file Config.py.

References Config.Process.defaultOptions_().

Referenced by Config.Process.__setattr__().

273  def __updateOptions(self,opt):
274  newOpts = self.defaultOptions_()
275  if isinstance(opt,dict):
276  for k,v in opt.items():
277  setattr(newOpts,k,v)
278  else:
279  for p in opt.parameters_():
280  setattr(newOpts, p, getattr(opt,p))
281  return newOpts

◆ _delattrFromSetattr()

def Config.Process._delattrFromSetattr (   self,
  name 
)
private

Definition at line 630 of file Config.py.

References Config.Process._delHelper().

Referenced by Config.Process.__setattr__().

630  def _delattrFromSetattr(self,name:str):
631  """Similar to __delattr__ but we need different behavior when called from __setattr__"""
632  self._delHelper(name)
633  # now remove it from the process itself
634  try:
635  del self.__dict__[name]
636  except:
637  pass
638 

◆ _delHelper()

def Config.Process._delHelper (   self,
  name 
)
private

Definition at line 585 of file Config.py.

References contentValuesCheck.values.

Referenced by Config.Process.__delattr__(), and Config.Process._delattrFromSetattr().

585  def _delHelper(self,name:str):
586  if not hasattr(self,name):
587  raise KeyError('process does not know about '+name)
588  elif name.startswith('_Process__'):
589  raise ValueError('this attribute cannot be deleted')
590 
591  # we have to remove it from all dictionaries/registries
592  dicts = [item for item in self.__dict__.values() if (isinstance(item, dict) or isinstance(item, DictTypes.SortedKeysDict))]
593  for reg in dicts:
594  if name in reg: del reg[name]
595  # if it was a labelable object, the label needs to be removed
596  obj = getattr(self,name)
597  if isinstance(obj,_Labelable):
598  obj.setLabel(None)
599  if isinstance(obj,Service):
600  obj._inProcess = False
601 

◆ _dumpConfigESPrefers()

def Config.Process._dumpConfigESPrefers (   self,
  options 
)
private

Definition at line 907 of file Config.py.

References Config.Process.es_prefers_(), and contentValuesCheck.values.

Referenced by Config.Process.dumpConfig().

907  def _dumpConfigESPrefers(self, options:PrintOptions) -> str:
908  result = ''
909  for item in self.es_prefers_().values():
910  result +=options.indentation()+'es_prefer '+item.targetLabel_()+' = '+item.dumpConfig(options)
911  return result
912 

◆ _dumpConfigNamedList()

def Config.Process._dumpConfigNamedList (   self,
  items,
  typeName 
)
private

Definition at line 818 of file Config.py.

Referenced by Config.Process.dumpConfig().

818  def _dumpConfigNamedList(self,items,typeName:str,options:PrintOptions) -> str:
819  returnValue = ''
820  for name,item in items:
821  returnValue +=options.indentation()+typeName+' '+name+' = '+item.dumpConfig(options)
822  return returnValue
823 

◆ _dumpConfigOptionallyNamedList()

def Config.Process._dumpConfigOptionallyNamedList (   self,
  items,
  typeName 
)
private

Definition at line 830 of file Config.py.

Referenced by Config.Process.dumpConfig().

830  def _dumpConfigOptionallyNamedList(self,items,typeName:str,options:PrintOptions) -> str:
831  returnValue = ''
832  for name,item in items:
833  if name == item.type_():
834  name = ''
835  returnValue +=options.indentation()+typeName+' '+name+' = '+item.dumpConfig(options)
836  return returnValue
837 

◆ _dumpConfigUnnamedList()

def Config.Process._dumpConfigUnnamedList (   self,
  items,
  typeName 
)
private

Definition at line 824 of file Config.py.

Referenced by Config.Process.dumpConfig().

824  def _dumpConfigUnnamedList(self,items,typeName:str,options:PrintOptions) -> str:
825  returnValue = ''
826  for name,item in items:
827  returnValue +=options.indentation()+typeName+' = '+item.dumpConfig(options)
828  return returnValue
829 

◆ _dumpPython()

def Config.Process._dumpPython (   self,
  d,
  options 
)
private

Definition at line 1042 of file Config.py.

Referenced by Config.Process.dumpPython().

1042  def _dumpPython(self, d, options:PrintOptions) -> str:
1043  result = ''
1044  for name, value in sorted(d.items()):
1045  result += value.dumpPythonAs(name,options)+'\n'
1046  return result
1047 

◆ _dumpPythonList()

def Config.Process._dumpPythonList (   self,
  d,
  options 
)
private

Definition at line 919 of file Config.py.

Referenced by Config.Process.dumpPython().

919  def _dumpPythonList(self, d, options:PrintOptions) -> str:
920  returnValue = ''
921  if isinstance(d, DictTypes.SortedKeysDict):
922  for name,item in d.items():
923  returnValue +='process.'+name+' = '+item.dumpPython(options)+'\n\n'
924  else:
925  for name,item in sorted(d.items()):
926  returnValue +='process.'+name+' = '+item.dumpPython(options)+'\n\n'
927  return returnValue
928 

◆ _dumpPythonSubProcesses()

def Config.Process._dumpPythonSubProcesses (   self,
  l,
  options 
)
private

Definition at line 913 of file Config.py.

Referenced by Config.Process.dumpPython().

913  def _dumpPythonSubProcesses(self, l, options:PrintOptions) -> str:
914  returnValue = ''
915  for item in l:
916  returnValue += item.dumpPython(options)+'\n\n'
917  return returnValue
918 

◆ _findPreferred()

def Config.Process._findPreferred (   self,
  esname 
)
private

Definition at line 1618 of file Config.py.

References psClasses.BuildTreeNode.__setattr__(), Config.Process.__setattr__(), and Config.FilteredStream.__setattr__.

Referenced by Config.Process.prefer().

1618  def _findPreferred(self, esname:str, d,*args,**kargs) -> bool:
1619  # is esname a name in the dictionary?
1620  if esname in d:
1621  typ = d[esname].type_()
1622  if typ == esname:
1623  self.__setattr__( esname+"_prefer", ESPrefer(typ,*args,**kargs) )
1624  else:
1625  self.__setattr__( esname+"_prefer", ESPrefer(typ, esname,*args,**kargs) )
1626  return True
1627  else:
1628  # maybe it's an unnamed ESModule?
1629  found = False
1630  for name, value in d.items():
1631  if value.type_() == esname:
1632  if found:
1633  raise RuntimeError("More than one ES module for "+esname)
1634  found = True
1635  self.__setattr__(esname+"_prefer", ESPrefer(d[esname].type_()) )
1636  return found
1637 
1638 

◆ _insertInto()

def Config.Process._insertInto (   self,
  parameterSet,
  itemDict 
)
private

Definition at line 1203 of file Config.py.

1203  def _insertInto(self, parameterSet, itemDict):
1204  for name,value in itemDict.items():
1205  value.insertInto(parameterSet, name)

◆ _insertManyInto()

def Config.Process._insertManyInto (   self,
  parameterSet,
  label 
)
private

Definition at line 1213 of file Config.py.

1213  def _insertManyInto(self, parameterSet, label:str, itemDict, tracked:bool):
1214  l = []
1215  for name,value in itemDict.items():
1216  value.appendToProcessDescList_(l, name)
1217  value.insertInto(parameterSet, name)
1218  # alphabetical order is easier to compare with old language
1219  l.sort()
1220  parameterSet.addVString(tracked, label, l)

◆ _insertOneInto()

def Config.Process._insertOneInto (   self,
  parameterSet,
  label 
)
private

Definition at line 1206 of file Config.py.

1206  def _insertOneInto(self, parameterSet, label:str, item, tracked:bool):
1207  vitems = []
1208  if not item == None:
1209  newlabel = item.nameInProcessDesc_(label)
1210  vitems = [newlabel]
1211  item.insertInto(parameterSet, newlabel)
1212  parameterSet.addVString(tracked, label, vitems)

◆ _insertPaths()

def Config.Process._insertPaths (   self,
  processPSet,
  nodeVisitor 
)
private

Definition at line 1245 of file Config.py.

References Config.Process.endpaths_(), FastTimerService::PlotsPerProcess.endpaths_, Config.Process.finalpaths_(), join(), edm::MainParameterSet.paths_, edm::HLTGlobalStatus.paths_, heppy::TriggerBitChecker.paths_, edm::PathsAndConsumesOfModules.paths_, ProcessCallGraph::ProcessType.paths_, pat::TriggerEvent.paths_, HLTPerformanceInfo.paths_, edm::cfi::Untyped.paths_, Config.Process.paths_(), FastTimerService::PlotsPerProcess.paths_, EcalDQMonitorTask.schedule_, edm::ModuleChanger.schedule_, edm::ScheduleInfo.schedule_, edm::PathsAndConsumesOfModules.schedule_, edm::SubProcess.schedule_, edm::EventProcessor.schedule_, Config.Process.schedule_(), and edm::test::TestProcessor.schedule_.

1245  def _insertPaths(self, processPSet, nodeVisitor):
1246  scheduledPaths = []
1247  triggerPaths = []
1248  endpaths = []
1249  finalpaths = []
1250  if self.schedule_() == None:
1251  # make one from triggerpaths & endpaths
1252  for name in self.paths_():
1253  scheduledPaths.append(name)
1254  triggerPaths.append(name)
1255  for name in self.endpaths_():
1256  scheduledPaths.append(name)
1257  endpaths.append(name)
1258  for name in self.finalpaths_():
1259  finalpaths.append(name)
1260  else:
1261  for path in self.schedule_():
1262  pathname = path.label_()
1263  if pathname in self.endpaths_():
1264  endpaths.append(pathname)
1265  scheduledPaths.append(pathname)
1266  elif pathname in self.finalpaths_():
1267  finalpaths.append(pathname)
1268  else:
1269  scheduledPaths.append(pathname)
1270  triggerPaths.append(pathname)
1271  for task in self.schedule_()._tasks:
1272  task.resolve(self.__dict__)
1273  scheduleTaskValidator = ScheduleTaskValidator()
1274  task.visit(scheduleTaskValidator)
1275  task.visit(nodeVisitor)
1276  # consolidate all final_paths into one EndPath
1277  endPathWithFinalPathModulesName ="@finalPath"
1278  finalPathEndPath = EndPath()
1279  if finalpaths:
1280  endpaths.append(endPathWithFinalPathModulesName)
1281  scheduledPaths.append(endPathWithFinalPathModulesName)
1282  finalpathValidator = FinalPathValidator()
1283  modulesOnFinalPath = []
1284  for finalpathname in finalpaths:
1285  iFinalPath = self.finalpaths_()[finalpathname]
1286  iFinalPath.resolve(self.__dict__)
1287  finalpathValidator.setLabel(finalpathname)
1288  iFinalPath.visit(finalpathValidator)
1289  invalidModules = finalpathValidator.invalidModulesOnFinalpaths
1290  if invalidModules:
1291  raise RuntimeError("FinalPath %s has non OutputModules %s" % (finalpathname, ",".join(invalidModules)))
1292  modulesOnFinalPath.extend(iFinalPath.moduleNames())
1293  for m in modulesOnFinalPath:
1294  mod = getattr(self, m)
1295  setattr(mod, "@onFinalPath", untracked.bool(True))
1296  finalPathEndPath += mod
1297 
1298  processPSet.addVString(True, "@end_paths", endpaths)
1299  processPSet.addVString(True, "@paths", scheduledPaths)
1300  # trigger_paths are a little different
1301  p = processPSet.newPSet()
1302  p.addVString(True, "@trigger_paths", triggerPaths)
1303  processPSet.addPSet(True, "@trigger_paths", p)
1304  # add all these paths
1305  pathValidator = PathValidator()
1306  endpathValidator = EndPathValidator()
1307  decoratedList = []
1308  lister = DecoratedNodeNameVisitor(decoratedList)
1309  condTaskModules = []
1310  condTaskVistor = ModuleNodeOnConditionalTaskVisitor(condTaskModules)
1311  pathCompositeVisitor = CompositeVisitor(pathValidator, nodeVisitor, lister, condTaskVistor)
1312  endpathCompositeVisitor = CompositeVisitor(endpathValidator, nodeVisitor, lister)
1313  for triggername in triggerPaths:
1314  iPath = self.paths_()[triggername]
1315  iPath.resolve(self.__dict__)
1316  pathValidator.setLabel(triggername)
1317  lister.initialize()
1318  condTaskModules[:] = []
1319  iPath.visit(pathCompositeVisitor)
1320  if condTaskModules:
1321  decoratedList.append("#")
1322  l = list({x.label_() for x in condTaskModules})
1323  l.sort()
1324  decoratedList.extend(l)
1325  decoratedList.append("@")
1326  iPath.insertInto(processPSet, triggername, decoratedList[:])
1327  for endpathname in endpaths:
1328  if endpathname is not endPathWithFinalPathModulesName:
1329  iEndPath = self.endpaths_()[endpathname]
1330  else:
1331  iEndPath = finalPathEndPath
1332  iEndPath.resolve(self.__dict__)
1333  endpathValidator.setLabel(endpathname)
1334  lister.initialize()
1335  iEndPath.visit(endpathCompositeVisitor)
1336  iEndPath.insertInto(processPSet, endpathname, decoratedList[:])
1337  processPSet.addVString(False, "@filters_on_endpaths", endpathValidator.filtersOnEndpaths)
1338 
1339 
static std::string join(char **cmd)
Definition: RemoteFile.cc:21

◆ _insertSubProcessesInto()

def Config.Process._insertSubProcessesInto (   self,
  parameterSet,
  label 
)
private

Definition at line 1232 of file Config.py.

1232  def _insertSubProcessesInto(self, parameterSet, label:str, itemList, tracked:bool):
1233  l = []
1234  subprocs = []
1235  for value in itemList:
1236  name = value.getProcessName()
1237  newLabel = value.nameInProcessDesc_(name)
1238  l.append(newLabel)
1239  pset = value.getSubProcessPSet(parameterSet)
1240  subprocs.append(pset)
1241  # alphabetical order is easier to compare with old language
1242  l.sort()
1243  parameterSet.addVString(tracked, label, l)
1244  parameterSet.addVPSet(False,"subProcesses",subprocs)

◆ _insertSwitchProducersInto()

def Config.Process._insertSwitchProducersInto (   self,
  parameterSet,
  labelModules,
  labelAliases,
  itemDict,
  tracked 
)
private

Definition at line 1221 of file Config.py.

1221  def _insertSwitchProducersInto(self, parameterSet, labelModules, labelAliases, itemDict, tracked:bool):
1222  modules = parameterSet.getVString(tracked, labelModules)
1223  aliases = parameterSet.getVString(tracked, labelAliases)
1224  accelerators = parameterSet.getVString(False, "@selected_accelerators")
1225  for name,value in itemDict.items():
1226  value.appendToProcessDescLists_(modules, aliases, name)
1227  value.insertInto(parameterSet, name, accelerators)
1228  modules.sort()
1229  aliases.sort()
1230  parameterSet.addVString(tracked, labelModules, modules)
1231  parameterSet.addVString(tracked, labelAliases, aliases)

◆ _itemsInDependencyOrder()

def Config.Process._itemsInDependencyOrder (   self,
  processDictionaryOfItems 
)
private

Definition at line 976 of file Config.py.

Referenced by Config.Process.dumpPython(), and Config.Process.splitPython().

976  def _itemsInDependencyOrder(self, processDictionaryOfItems):
977  # The items can be Sequences or Tasks and the input
978  # argument should either be the dictionary of sequences
979  # or the dictionary of tasks from the process.
980 
981  returnValue=DictTypes.SortedKeysDict()
982 
983  # For each item, see what other items it depends upon
984  # For our purpose here, an item depends on the items it contains.
985  dependencies = {}
986  for label,item in processDictionaryOfItems.items():
987  containedItems = []
988  if isinstance(item, Task):
989  v = TaskVisitor(containedItems)
990  elif isinstance(item, ConditionalTask):
991  v = ConditionalTaskVisitor(containedItems)
992  else:
993  v = SequenceVisitor(containedItems)
994  try:
995  item.visit(v)
996  except RuntimeError:
997  if isinstance(item, Task):
998  raise RuntimeError("Failed in a Task visitor. Probably " \
999  "a circular dependency discovered in Task with label " + label)
1000  elif isinstance(item, ConditionalTask):
1001  raise RuntimeError("Failed in a ConditionalTask visitor. Probably " \
1002  "a circular dependency discovered in ConditionalTask with label " + label)
1003  else:
1004  raise RuntimeError("Failed in a Sequence visitor. Probably a " \
1005  "circular dependency discovered in Sequence with label " + label)
1006  for containedItem in containedItems:
1007  # Check for items that both have labels and are not in the process.
1008  # This should not normally occur unless someone explicitly assigns a
1009  # label without putting the item in the process (which should not ever
1010  # be done). We check here because this problem could cause the code
1011  # in the 'while' loop below to go into an infinite loop.
1012  if containedItem.hasLabel_():
1013  testItem = processDictionaryOfItems.get(containedItem.label_())
1014  if testItem is None or containedItem != testItem:
1015  if isinstance(item, Task):
1016  raise RuntimeError("Task has a label, but using its label to get an attribute" \
1017  " from the process yields a different object or None\n"+
1018  "label = " + containedItem.label_())
1019  if isinstance(item, ConditionalTask):
1020  raise RuntimeError("ConditionalTask has a label, but using its label to get an attribute" \
1021  " from the process yields a different object or None\n"+
1022  "label = " + containedItem.label_())
1023  else:
1024  raise RuntimeError("Sequence has a label, but using its label to get an attribute" \
1025  " from the process yields a different object or None\n"+
1026  "label = " + containedItem.label_())
1027  dependencies[label]=[dep.label_() for dep in containedItems if dep.hasLabel_()]
1028 
1029  # keep looping until we get rid of all dependencies
1030  while dependencies:
1031  oldDeps = dict(dependencies)
1032  for label,deps in oldDeps.items():
1033  if len(deps)==0:
1034  returnValue[label]=processDictionaryOfItems[label]
1035  #remove this as a dependency for all other tasks
1036  del dependencies[label]
1037  for lb2,deps2 in dependencies.items():
1038  while deps2.count(label):
1039  deps2.remove(label)
1040  return returnValue
1041 

◆ _okToPlace()

def Config.Process._okToPlace (   self,
  name 
)
private

Definition at line 653 of file Config.py.

References Config.Process.__isStrict.

Referenced by Config.Process.__setattr__(), and Config.Process._place().

653  def _okToPlace(self, name:str, mod, d) -> bool:
654  if not self.__InExtendCall:
655  # if going
656  return True
657  elif not self.__isStrict:
658  return True
659  elif name in d:
660  # if there's an old copy, and the new one
661  # hasn't been modified, we're done. Still
662  # not quite safe if something has been defined twice.
663  # Need to add checks
664  if mod._isModified:
665  if d[name]._isModified:
666  return False
667  else:
668  return True
669  else:
670  return True
671  else:
672  return True
673 

◆ _place()

def Config.Process._place (   self,
  name 
)
private

◆ _placeAccelerator()

def Config.Process._placeAccelerator (   self,
  typeName 
)
private

Definition at line 757 of file Config.py.

References Config.Process._place().

757  def _placeAccelerator(self,typeName:str,mod):
758  self._place(typeName, mod, self.__accelerators)
759  self.__dict__[typeName]=mod

◆ _placeAlias()

def Config.Process._placeAlias (   self,
  name 
)
private

Definition at line 728 of file Config.py.

References Config.Process._place().

728  def _placeAlias(self,name:str,mod):
729  self._place(name, mod, self.__aliases)

◆ _placeAnalyzer()

def Config.Process._placeAnalyzer (   self,
  name 
)
private

Definition at line 690 of file Config.py.

References Config.Process._place().

690  def _placeAnalyzer(self,name:str,mod):
691  self._place(name, mod, self.__analyzers)

◆ _placeConditionalTask()

def Config.Process._placeConditionalTask (   self,
  name 
)
private

Definition at line 725 of file Config.py.

References Config.Process._place(), and Config.Process._validateConditionalTask().

725  def _placeConditionalTask(self,name:str,task):
726  self._validateConditionalTask(task, name)
727  self._place(name, task, self.__conditionaltasks)

◆ _placeEndPath()

def Config.Process._placeEndPath (   self,
  name 
)
private

Definition at line 699 of file Config.py.

References Config.Process._place(), Config.Process._validateSequence(), and ExceptionHandling.format_outerframe().

699  def _placeEndPath(self,name:str,mod):
700  self._validateSequence(mod, name)
701  try:
702  self._place(name, mod, self.__endpaths)
703  except ModuleCloneError as msg:
704  context = format_outerframe(4)
705  raise Exception("%sThe module %s in endpath %s is unknown to the process %s." %(context, msg, name, self._Process__name))
def format_outerframe(number)

◆ _placeESPrefer()

def Config.Process._placeESPrefer (   self,
  name 
)
private

Definition at line 718 of file Config.py.

References Config.Process._place().

718  def _placeESPrefer(self,name:str,mod):
719  self._place(name, mod, self.__esprefers)

◆ _placeESProducer()

def Config.Process._placeESProducer (   self,
  name 
)
private

Definition at line 716 of file Config.py.

References Config.Process._place().

716  def _placeESProducer(self,name:str,mod):
717  self._place(name, mod, self.__esproducers)

◆ _placeESSource()

def Config.Process._placeESSource (   self,
  name 
)
private

Definition at line 720 of file Config.py.

References Config.Process._place().

720  def _placeESSource(self,name:str,mod):
721  self._place(name, mod, self.__essources)

◆ _placeFilter()

def Config.Process._placeFilter (   self,
  name 
)
private

Definition at line 688 of file Config.py.

References Config.Process._place().

688  def _placeFilter(self,name:str,mod):
689  self._place(name, mod, self.__filters)

◆ _placeFinalPath()

def Config.Process._placeFinalPath (   self,
  name 
)
private

Definition at line 706 of file Config.py.

References Config.Process._place(), Config.Process._validateSequence(), and ExceptionHandling.format_outerframe().

706  def _placeFinalPath(self,name:str,mod):
707  self._validateSequence(mod, name)
708  try:
709  self._place(name, mod, self.__finalpaths)
710  except ModuleCloneError as msg:
711  context = format_outerframe(4)
712  raise Exception("%sThe module %s in finalpath %s is unknown to the process %s." %(context, msg, name, self._Process__name))
def format_outerframe(number)

◆ _placeLooper()

def Config.Process._placeLooper (   self,
  name 
)
private

Definition at line 742 of file Config.py.

Referenced by Config.Process.setLooper_().

742  def _placeLooper(self,name:str,mod):
743  if name != 'looper':
744  raise ValueError("The label '"+name+"' can not be used for a Looper. Only 'looper' is allowed.")
745  self.__dict__['_Process__looper'] = mod
746  self.__dict__[mod.type_()] = mod

◆ _placeOutputModule()

def Config.Process._placeOutputModule (   self,
  name 
)
private

Definition at line 682 of file Config.py.

References Config.Process._place().

682  def _placeOutputModule(self,name:str,mod):
683  self._place(name, mod, self.__outputmodules)

◆ _placePath()

def Config.Process._placePath (   self,
  name 
)
private

Definition at line 692 of file Config.py.

References Config.Process._place(), Config.Process._validateSequence(), and ExceptionHandling.format_outerframe().

692  def _placePath(self,name:str,mod):
693  self._validateSequence(mod, name)
694  try:
695  self._place(name, mod, self.__paths)
696  except ModuleCloneError as msg:
697  context = format_outerframe(4)
698  raise Exception("%sThe module %s in path %s is unknown to the process %s." %(context, msg, name, self._Process__name))
def format_outerframe(number)

◆ _placeProducer()

def Config.Process._placeProducer (   self,
  name 
)
private

Definition at line 684 of file Config.py.

References Config.Process._place().

684  def _placeProducer(self,name:str,mod):
685  self._place(name, mod, self.__producers)

◆ _placePSet()

def Config.Process._placePSet (   self,
  name 
)
private

Definition at line 730 of file Config.py.

References Config.Process._place().

730  def _placePSet(self,name:str,mod):
731  self._place(name, mod, self.__psets)

◆ _placeSequence()

def Config.Process._placeSequence (   self,
  name 
)
private

Definition at line 713 of file Config.py.

References Config.Process._place(), and Config.Process._validateSequence().

713  def _placeSequence(self,name:str,mod):
714  self._validateSequence(mod, name)
715  self._place(name, mod, self.__sequences)

◆ _placeService()

def Config.Process._placeService (   self,
  typeName 
)
private

Definition at line 752 of file Config.py.

References Config.Process._place().

752  def _placeService(self,typeName:str,mod):
753  self._place(typeName, mod, self.__services)
754  if typeName in self.__dict__:
755  self.__dict__[typeName]._inProcess = False
756  self.__dict__[typeName]=mod

◆ _placeSource()

def Config.Process._placeSource (   self,
  name 
)
private

Definition at line 734 of file Config.py.

Referenced by Config.Process.setSource_().

734  def _placeSource(self,name:str,mod):
735  """Allow the source to be referenced by 'source' or by type name"""
736  if name != 'source':
737  raise ValueError("The label '"+name+"' can not be used for a Source. Only 'source' is allowed.")
738  if self.__dict__['_Process__source'] is not None :
739  del self.__dict__[self.__dict__['_Process__source'].type_()]
740  self.__dict__['_Process__source'] = mod
741  self.__dict__[mod.type_()] = mod

◆ _placeSubProcess()

def Config.Process._placeSubProcess (   self,
  name 
)
private

Definition at line 747 of file Config.py.

747  def _placeSubProcess(self,name:str,mod):
748  self.__dict__['_Process__subProcess'] = mod
749  self.__dict__[mod.type_()] = mod

◆ _placeSwitchProducer()

def Config.Process._placeSwitchProducer (   self,
  name 
)
private

Definition at line 686 of file Config.py.

References Config.Process._place().

686  def _placeSwitchProducer(self,name:str,mod):
687  self._place(name, mod, self.__switchproducers)

◆ _placeTask()

def Config.Process._placeTask (   self,
  name 
)
private

Definition at line 722 of file Config.py.

References Config.Process._place(), and Config.Process._validateTask().

722  def _placeTask(self,name:str,task):
723  self._validateTask(task, name)
724  self._place(name, task, self.__tasks)

◆ _placeVPSet()

def Config.Process._placeVPSet (   self,
  name 
)
private

Definition at line 732 of file Config.py.

References Config.Process._place().

732  def _placeVPSet(self,name:str,mod):
733  self._place(name, mod, self.__vpsets)

◆ _pruneModules()

def Config.Process._pruneModules (   self,
  d,
  scheduledNames 
)
private

Definition at line 1422 of file Config.py.

Referenced by Config.Process.prune().

1422  def _pruneModules(self, d, scheduledNames):
1423  moduleNames = set(d.keys())
1424  junk = moduleNames - scheduledNames
1425  for name in junk:
1426  delattr(self, name)
1427  return junk
1428 

◆ _replaceInConditionalTasks()

def Config.Process._replaceInConditionalTasks (   self,
  label 
)
private

Definition at line 1183 of file Config.py.

References Config.Process.conditionaltasks, and contentValuesCheck.values.

Referenced by Config.Process.__delattr__(), and Config.Process.__setattr__().

1183  def _replaceInConditionalTasks(self, label:str, new):
1184  old = getattr(self,label)
1185  for task in self.conditionaltasks.values():
1186  task.replace(old, new)

◆ _replaceInSchedule()

def Config.Process._replaceInSchedule (   self,
  label 
)
private

Definition at line 1187 of file Config.py.

References EcalDQMonitorTask.schedule_, edm::ModuleChanger.schedule_, edm::ScheduleInfo.schedule_, edm::PathsAndConsumesOfModules.schedule_, edm::SubProcess.schedule_, edm::EventProcessor.schedule_, Config.Process.schedule_(), and edm::test::TestProcessor.schedule_.

Referenced by Config.Process.__delattr__(), and Config.Process.__setattr__().

1187  def _replaceInSchedule(self, label:str, new):
1188  if self.schedule_() == None:
1189  return
1190  old = getattr(self,label)
1191  for task in self.schedule_()._tasks:
1192  task.replace(old, new)

◆ _replaceInScheduleDirectly()

def Config.Process._replaceInScheduleDirectly (   self,
  label 
)
private

Definition at line 1193 of file Config.py.

References EcalDQMonitorTask.schedule_, edm::ModuleChanger.schedule_, edm::ScheduleInfo.schedule_, edm::PathsAndConsumesOfModules.schedule_, edm::SubProcess.schedule_, edm::EventProcessor.schedule_, Config.Process.schedule_(), and edm::test::TestProcessor.schedule_.

Referenced by Config.Process.__delattr__(), and Config.Process.__setattr__().

1193  def _replaceInScheduleDirectly(self, label:str, new):
1194  if self.schedule_() == None:
1195  return
1196  old = getattr(self,label)
1197  self.schedule_()._replaceIfHeldDirectly(old, new)

◆ _replaceInSequences()

def Config.Process._replaceInSequences (   self,
  label 
)
private

Definition at line 1162 of file Config.py.

References Config.Process.endpaths, Config.Process.finalpaths, Config.Process.paths, Config.Process.sequences, and contentValuesCheck.values.

Referenced by Config.Process.__delattr__(), and Config.Process.__setattr__().

1162  def _replaceInSequences(self, label:str, new):
1163  old = getattr(self,label)
1164  #TODO - replace by iterator concatenation
1165  #to ovoid dependency problems between sequences, first modify
1166  # process known sequences to do a non-recursive change. Then do
1167  # a recursive change to get cases where a sub-sequence unknown to
1168  # the process has the item to be replaced
1169  for sequenceable in self.sequences.values():
1170  sequenceable._replaceIfHeldDirectly(old,new)
1171  for sequenceable in self.sequences.values():
1172  sequenceable.replace(old,new)
1173  for sequenceable in self.paths.values():
1174  sequenceable.replace(old,new)
1175  for sequenceable in self.endpaths.values():
1176  sequenceable.replace(old,new)
1177  for sequenceable in self.finalpaths.values():
1178  sequenceable.replace(old,new)

◆ _replaceInTasks()

def Config.Process._replaceInTasks (   self,
  label 
)
private

Definition at line 1179 of file Config.py.

References Config.Process.tasks, and contentValuesCheck.values.

Referenced by Config.Process.__delattr__(), and Config.Process.__setattr__().

1179  def _replaceInTasks(self, label:str, new):
1180  old = getattr(self,label)
1181  for task in self.tasks.values():
1182  task.replace(old, new)

◆ _splitPython()

def Config.Process._splitPython (   self,
  subfolder,
  d,
  options 
)
private

Definition at line 1048 of file Config.py.

Referenced by Config.Process.splitPython().

1048  def _splitPython(self, subfolder, d, options:PrintOptions) -> dict:
1049  result = {}
1050  for name, value in sorted(d.items()):
1051  result[name] = subfolder, value.dumpPythonAs(name, options) + '\n'
1052  return result
1053 

◆ _splitPythonList()

def Config.Process._splitPythonList (   self,
  subfolder,
  d,
  options 
)
private

Definition at line 929 of file Config.py.

Referenced by Config.Process.splitPython().

929  def _splitPythonList(self, subfolder, d, options:PrintOptions) -> str:
930  parts = DictTypes.SortedKeysDict()
931  for name, item in d.items() if isinstance(d, DictTypes.SortedKeysDict) else sorted(d.items()):
932  code = ''
933  dependencies = item.directDependencies()
934  for module_subfolder, module in dependencies:
935  module = module + '_cfi'
936  if options.useSubdirectories and module_subfolder:
937  module = module_subfolder + '.' + module
938  if options.targetDirectory is not None:
939  if options.useSubdirectories and subfolder:
940  module = '..' + module
941  else:
942  module = '.' + module
943  code += 'from ' + module + ' import *\n'
944  if dependencies:
945  code += '\n'
946  code += name + ' = ' + item.dumpPython(options)
947  parts[name] = subfolder, code
948  return parts
949 

◆ _validateConditionalTask()

def Config.Process._validateConditionalTask (   self,
  task,
  label 
)
private

Definition at line 967 of file Config.py.

Referenced by Config.Process._placeConditionalTask().

967  def _validateConditionalTask(self, task, label:str):
968  # See if every module and service has been inserted into the process
969  try:
970  l = set()
971  visitor = NodeNameVisitor(l)
972  task.visit(visitor)
973  except:
974  raise RuntimeError("An entry in task " + label + ' has not been attached to the process')
975 

◆ _validateSequence()

def Config.Process._validateSequence (   self,
  sequence,
  label 
)
private

Definition at line 950 of file Config.py.

Referenced by Config.Process._placeEndPath(), Config.Process._placeFinalPath(), Config.Process._placePath(), and Config.Process._placeSequence().

950  def _validateSequence(self, sequence, label):
951  # See if every module has been inserted into the process
952  try:
953  l = set()
954  visitor = NodeNameVisitor(l)
955  sequence.visit(visitor)
956  except Exception as e:
957  raise RuntimeError("An entry in sequence {} has no label\n Seen entries: {}\n Error: {}".format(label, l, e))
958 

◆ _validateTask()

def Config.Process._validateTask (   self,
  task,
  label 
)
private

Definition at line 959 of file Config.py.

Referenced by Config.Process._placeTask().

959  def _validateTask(self, task, label:str):
960  # See if every module and service has been inserted into the process
961  try:
962  l = set()
963  visitor = NodeNameVisitor(l)
964  task.visit(visitor)
965  except:
966  raise RuntimeError("An entry in task " + label + ' has not been attached to the process')

◆ add_()

def Config.Process.add_ (   self,
  value 
)
Allows addition of components that do not have to have a label, e.g. Services

Definition at line 639 of file Config.py.

References Config.Process.__isStrict.

Referenced by Config.Process.__setattr__(), and Config.Process.extend().

639  def add_(self,value):
640  """Allows addition of components that do not have to have a label, e.g. Services"""
641  if not isinstance(value,_ConfigureComponent):
642  raise TypeError
643  if not isinstance(value,_Unlabelable):
644  raise TypeError
645  #clone the item
646  if self.__isStrict:
647  newValue =value.copy()
648  value.setIsFrozen()
649  else:
650  newValue =value
651  newValue._place('',self)
652 

◆ addSubProcess()

def Config.Process.addSubProcess (   self,
  mod 
)

Definition at line 750 of file Config.py.

References mps_setup.append.

750  def addSubProcess(self,mod):
751  self.__subProcesses.append(mod)

◆ aliases_()

def Config.Process.aliases_ (   self)
returns a dict of the aliases that have been added to the Process

Definition at line 373 of file Config.py.

Referenced by Config.Process.dumpConfig(), Config.Process.dumpPython(), and Config.Process.splitPython().

373  def aliases_(self):
374  """returns a dict of the aliases that have been added to the Process"""
375  return DictTypes.FixedKeysDict(self.__aliases)

◆ analyzerNames()

def Config.Process.analyzerNames (   self)
Returns a string containing all the EDAnalyzer labels separated by a blank

Definition at line 183 of file Config.py.

References HLTMuonValidator.analyzers_, Config.Process.analyzers_(), join(), and relativeConstraints.keys.

183  def analyzerNames(self):
184  """Returns a string containing all the EDAnalyzer labels separated by a blank"""
185  return ' '.join(self.analyzers_().keys())
static std::string join(char **cmd)
Definition: RemoteFile.cc:21

◆ analyzers_()

def Config.Process.analyzers_ (   self)
returns a dict of the analyzers that have been added to the Process

Definition at line 302 of file Config.py.

Referenced by Config.Process.analyzerNames(), Config.Process.dumpConfig(), Config.Process.dumpPython(), Config.Process.prune(), and Config.Process.splitPython().

302  def analyzers_(self):
303  """returns a dict of the analyzers that have been added to the Process"""
304  return DictTypes.FixedKeysDict(self.__analyzers)

◆ conditionaltasks_()

def Config.Process.conditionaltasks_ (   self)
returns a dict of the conditionaltasks that have been added to the Process

Definition at line 330 of file Config.py.

330  def conditionaltasks_(self):
331  """returns a dict of the conditionaltasks that have been added to the Process"""
332  return DictTypes.FixedKeysDict(self.__conditionaltasks)

◆ defaultMaxEvents_()

def Config.Process.defaultMaxEvents_ ( )
static

Definition at line 283 of file Config.py.

Referenced by Config.Process.__updateMaxEvents().

283  def defaultMaxEvents_():
284  return untracked.PSet(input=optional.untracked.int32,
285  output=optional.untracked.allowed(int32,PSet))

◆ defaultMaxLuminosityBlocks_()

def Config.Process.defaultMaxLuminosityBlocks_ ( )
static

Definition at line 296 of file Config.py.

296  def defaultMaxLuminosityBlocks_():
297  return untracked.PSet(input=untracked.int32(-1))

◆ defaultOptions_()

def Config.Process.defaultOptions_ ( )
static

Definition at line 242 of file Config.py.

Referenced by Config.Process.__updateOptions().

242  def defaultOptions_():
243  return untracked.PSet(numberOfThreads = untracked.uint32(1),
244  numberOfStreams = untracked.uint32(0),
245  numberOfConcurrentRuns = untracked.uint32(1),
246  numberOfConcurrentLuminosityBlocks = untracked.uint32(0),
247  eventSetup = untracked.PSet(
248  numberOfConcurrentIOVs = untracked.uint32(0),
249  forceNumberOfConcurrentIOVs = untracked.PSet(
250  allowAnyLabel_ = required.untracked.uint32
251  )
252  ),
253  accelerators = untracked.vstring('*'),
254  wantSummary = untracked.bool(False),
255  fileMode = untracked.string('FULLMERGE'),
256  forceEventSetupCacheClearOnNewRun = untracked.bool(False),
257  throwIfIllegalParameter = untracked.bool(True),
258  printDependencies = untracked.bool(False),
259  deleteNonConsumedUnscheduledModules = untracked.bool(True),
260  sizeOfStackForThreadsInKB = optional.untracked.uint32,
261  Rethrow = untracked.vstring(),
262  TryToContinue = untracked.vstring(),
263  IgnoreCompletely = untracked.vstring(),
264  modulesToCallForTryToContinue = untracked.vstring(),
265  canDeleteEarly = untracked.vstring(),
266  holdsReferencesToDeleteEarly = untracked.VPSet(),
267  modulesToIgnoreForDeleteEarly = untracked.vstring(),
268  dumpOptions = untracked.bool(False),
269  allowUnscheduled = obsolete.untracked.bool,
270  emptyRunLumiMode = obsolete.untracked.string,
271  makeTriggerResults = obsolete.untracked.bool,
272  )

◆ dumpConfig()

def Config.Process.dumpConfig (   self,
  options 
)

Definition at line 838 of file Config.py.

References Config.Process._dumpConfigESPrefers(), Config.Process._dumpConfigNamedList(), Config.Process._dumpConfigOptionallyNamedList(), Config.Process._dumpConfigUnnamedList(), Config.Process.aliases_(), HLTMuonValidator.analyzers_, Config.Process.analyzers_(), Config.Process.endpaths_(), FastTimerService::PlotsPerProcess.endpaths_, Config.Process.es_producers_(), Config.Process.es_sources_(), pat::eventhypothesis::AndFilter.filters_, pat::eventhypothesis::OrFilter.filters_, HLTGenValHistCollPath.filters_, pat::TriggerEvent.filters_, TrigObjTnPHistColl::FilterSelector::FilterSet.filters_, FilterOR.filters_, Config.Process.filters_(), cms::DDFilteredView.filters_, FilterSelection.filters_, FilterSelections.filters_, Config.Process.finalpaths_(), mps_monitormerge.items, join(), Config.Process.looper_(), edm::EventProcessor.looper_, Config.Process.outputModules_(), edm::MainParameterSet.paths_, edm::HLTGlobalStatus.paths_, heppy::TriggerBitChecker.paths_, edm::PathsAndConsumesOfModules.paths_, ProcessCallGraph::ProcessType.paths_, pat::TriggerEvent.paths_, HLTPerformanceInfo.paths_, edm::cfi::Untyped.paths_, Config.Process.paths_(), FastTimerService::PlotsPerProcess.paths_, pf2pat::EventHypothesis.producers_, Config.Process.producers_(), Config.Process.psets, ConfigBuilder.ConfigBuilder.schedule, Config.Process.schedule, Config.Process.sequences_(), edm::ProcessDesc.services_, Config.Process.services_(), ecaldqm::DBWriterWorker.source_, HGCalTestPartialWaferRecHits.source_, L2MuonSeedGeneratorFromL1TkMu.source_, TestAlpakaObjectAnalyzer.source_, SiStripFedCablingBuilderFromDb.source_, edm::test::TestSourceProcessor.source_, TestPortableAnalyzer.source_, jsoncollector::DataPoint.source_, sistrip::SpyEventMatcher.source_, ProcessCallGraph.source_, Config.Process.source_(), edm::InputSource::EventSourceSentry.source_, edm::InputSource::LumiSourceSentry.source_, edm::InputSource::RunSourceSentry.source_, edm::InputSource::ProcessBlockSourceSentry.source_, TestAlpakaAnalyzer.source_, edm::SubProcess.subProcesses_, Config.Process.subProcesses_(), edm::EventProcessor.subProcesses_, Config.Process.switchProducers_(), and Config.Process.vpsets.

Referenced by Types.SecSource.configValue().

838  def dumpConfig(self, options:PrintOptions=PrintOptions()) -> str:
839  """return a string containing the equivalent process defined using the old configuration language"""
840  config = "process "+self.__name+" = {\n"
841  options.indent()
842  if self.source_():
843  config += options.indentation()+"source = "+self.source_().dumpConfig(options)
844  if self.looper_():
845  config += options.indentation()+"looper = "+self.looper_().dumpConfig(options)
846 
847  config+=self._dumpConfigNamedList(self.subProcesses_(),
848  'subProcess',
849  options)
850  config+=self._dumpConfigNamedList(self.producers_().items(),
851  'module',
852  options)
853  config+=self._dumpConfigNamedList(self.switchProducers_().items(),
854  'module',
855  options)
856  config+=self._dumpConfigNamedList(self.filters_().items(),
857  'module',
858  options)
859  config+=self._dumpConfigNamedList(self.analyzers_().items(),
860  'module',
861  options)
862  config+=self._dumpConfigNamedList(self.outputModules_().items(),
863  'module',
864  options)
865  config+=self._dumpConfigNamedList(self.sequences_().items(),
866  'sequence',
867  options)
868  config+=self._dumpConfigNamedList(self.paths_().items(),
869  'path',
870  options)
871  config+=self._dumpConfigNamedList(self.endpaths_().items(),
872  'endpath',
873  options)
874  config+=self._dumpConfigNamedList(self.finalpaths_().items(),
875  'finalpath',
876  options)
877  config+=self._dumpConfigUnnamedList(self.services_().items(),
878  'service',
879  options)
880  config+=self._dumpConfigNamedList(self.aliases_().items(),
881  'alias',
882  options)
883  config+=self._dumpConfigOptionallyNamedList(
884  self.es_producers_().items(),
885  'es_module',
886  options)
887  config+=self._dumpConfigOptionallyNamedList(
888  self.es_sources_().items(),
889  'es_source',
890  options)
891  config += self._dumpConfigESPrefers(options)
892  for name,item in self.psets.items():
893  config +=options.indentation()+item.configTypeName()+' '+name+' = '+item.configValue(options)
894  for name,item in self.vpsets.items():
895  config +=options.indentation()+'VPSet '+name+' = '+item.configValue(options)
896  if self.schedule:
897  pathNames = [p.label_() for p in self.schedule]
898  config +=options.indentation()+'schedule = {'+','.join(pathNames)+'}\n'
899 
900 # config+=self._dumpConfigNamedList(self.vpsets.items(),
901 # 'VPSet',
902 # options)
903  config += "}\n"
904  options.unindent()
905  return config
906 
static std::string join(char **cmd)
Definition: RemoteFile.cc:21

◆ dumpPython()

def Config.Process.dumpPython (   self,
  options = PrintOptions(),
  str 
)
return a string containing the equivalent process defined using python

Definition at line 1054 of file Config.py.

References Config.Process._dumpPython(), Config.Process._dumpPythonList(), Config.Process._dumpPythonSubProcesses(), Config.Process._itemsInDependencyOrder(), Config.Process.aliases_(), HLTMuonValidator.analyzers_, Config.Process.analyzers_(), Config.Process.conditionaltasks, Config.Process.endpaths_(), FastTimerService::PlotsPerProcess.endpaths_, Config.Process.es_prefers_(), Config.Process.es_producers_(), Config.Process.es_sources_(), pat::eventhypothesis::AndFilter.filters_, pat::eventhypothesis::OrFilter.filters_, HLTGenValHistCollPath.filters_, pat::TriggerEvent.filters_, TrigObjTnPHistColl::FilterSelector::FilterSet.filters_, FilterOR.filters_, Config.Process.filters_(), cms::DDFilteredView.filters_, FilterSelection.filters_, FilterSelections.filters_, Config.Process.finalpaths_(), join(), Config.Process.looper_(), edm::EventProcessor.looper_, Config.Process.outputModules_(), edm::MainParameterSet.paths_, edm::HLTGlobalStatus.paths_, heppy::TriggerBitChecker.paths_, edm::PathsAndConsumesOfModules.paths_, ProcessCallGraph::ProcessType.paths_, pat::TriggerEvent.paths_, HLTPerformanceInfo.paths_, edm::cfi::Untyped.paths_, Config.Process.paths_(), FastTimerService::PlotsPerProcess.paths_, Config.Process.processAccelerators_(), pf2pat::EventHypothesis.producers_, Config.Process.producers_(), Config.Process.psets, ConfigBuilder.ConfigBuilder.schedule, Config.Process.schedule, EcalDQMonitorTask.schedule_, edm::ModuleChanger.schedule_, edm::ScheduleInfo.schedule_, edm::PathsAndConsumesOfModules.schedule_, edm::SubProcess.schedule_, edm::EventProcessor.schedule_, Config.Process.schedule_(), edm::test::TestProcessor.schedule_, Config.Process.sequences, edm::ProcessDesc.services_, Config.Process.services_(), ecaldqm::DBWriterWorker.source_, HGCalTestPartialWaferRecHits.source_, L2MuonSeedGeneratorFromL1TkMu.source_, TestAlpakaObjectAnalyzer.source_, SiStripFedCablingBuilderFromDb.source_, edm::test::TestSourceProcessor.source_, TestPortableAnalyzer.source_, jsoncollector::DataPoint.source_, sistrip::SpyEventMatcher.source_, ProcessCallGraph.source_, Config.Process.source_(), edm::InputSource::EventSourceSentry.source_, edm::InputSource::LumiSourceSentry.source_, edm::InputSource::RunSourceSentry.source_, edm::InputSource::ProcessBlockSourceSentry.source_, TestAlpakaAnalyzer.source_, edm::SubProcess.subProcesses_, Config.Process.subProcesses_(), edm::EventProcessor.subProcesses_, Config.Process.switchProducers_(), Config.Process.tasks, and Config.Process.vpsets.

Referenced by Modules.SwitchProducer.__addParameter(), Types._AllowedParameterTypes.__init__(), Mixins._ParameterTypeBase.__repr__(), Mixins._Parameterizable.__repr__(), Mixins._ValidatingParameterListBase.__repr__(), Types.VPSet.__repr__(), Mixins._Parameterizable.__setattr__(), Modules.SwitchProducer.__setattr__(), SequenceTypes.Schedule.__str__(), and Config.Process.splitPython().

1054  def dumpPython(self, options=PrintOptions()) -> str:
1055  """return a string containing the equivalent process defined using python"""
1056  specialImportRegistry._reset()
1057  header = "import FWCore.ParameterSet.Config as cms"
1058  result = "process = cms.Process(\""+self.__name+"\")\n\n"
1059  if self.source_():
1060  result += "process.source = "+self.source_().dumpPython(options)
1061  if self.looper_():
1062  result += "process.looper = "+self.looper_().dumpPython()
1063  result+=self._dumpPythonList(self.psets, options)
1064  result+=self._dumpPythonList(self.vpsets, options)
1065  result+=self._dumpPythonSubProcesses(self.subProcesses_(), options)
1066  result+=self._dumpPythonList(self.producers_(), options)
1067  result+=self._dumpPythonList(self.switchProducers_(), options)
1068  result+=self._dumpPythonList(self.filters_() , options)
1069  result+=self._dumpPythonList(self.analyzers_(), options)
1070  result+=self._dumpPythonList(self.outputModules_(), options)
1071  result+=self._dumpPythonList(self.services_(), options)
1072  result+=self._dumpPythonList(self.processAccelerators_(), options)
1073  result+=self._dumpPythonList(self.es_producers_(), options)
1074  result+=self._dumpPythonList(self.es_sources_(), options)
1075  result+=self._dumpPython(self.es_prefers_(), options)
1076  result+=self._dumpPythonList(self._itemsInDependencyOrder(self.tasks), options)
1077  result+=self._dumpPythonList(self._itemsInDependencyOrder(self.conditionaltasks), options)
1078  result+=self._dumpPythonList(self._itemsInDependencyOrder(self.sequences), options)
1079  result+=self._dumpPythonList(self.paths_(), options)
1080  result+=self._dumpPythonList(self.endpaths_(), options)
1081  result+=self._dumpPythonList(self.finalpaths_(), options)
1082  result+=self._dumpPythonList(self.aliases_(), options)
1083  if not self.schedule_() == None:
1084  result += 'process.schedule = ' + self.schedule.dumpPython(options)
1085  imports = specialImportRegistry.getSpecialImports()
1086  if len(imports) > 0:
1087  header += "\n" + "\n".join(imports)
1088  header += "\n\n"
1089  return header+result
1090 
static std::string join(char **cmd)
Definition: RemoteFile.cc:21
def dumpPython(process, name)

◆ endpaths_()

def Config.Process.endpaths_ (   self)
returns a dict of the endpaths that have been added to the Process

Definition at line 314 of file Config.py.

Referenced by Config.Process._insertPaths(), Config.Process.dumpConfig(), Config.Process.dumpPython(), and Config.Process.splitPython().

314  def endpaths_(self):
315  """returns a dict of the endpaths that have been added to the Process"""
316  return DictTypes.SortedAndFixedKeysDict(self.__endpaths)

◆ es_prefers_()

def Config.Process.es_prefers_ (   self)
returns a dict of the es_prefers that have been added to the Process

Definition at line 369 of file Config.py.

Referenced by Config.Process._dumpConfigESPrefers(), Config.Process.dumpPython(), and Config.Process.splitPython().

369  def es_prefers_(self):
370  """returns a dict of the es_prefers that have been added to the Process"""
371  return DictTypes.FixedKeysDict(self.__esprefers)

◆ es_producers_()

def Config.Process.es_producers_ (   self)
returns a dict of the esproducers that have been added to the Process

Definition at line 361 of file Config.py.

Referenced by Config.Process.dumpConfig(), Config.Process.dumpPython(), Config.Process.prefer(), and Config.Process.splitPython().

361  def es_producers_(self):
362  """returns a dict of the esproducers that have been added to the Process"""
363  return DictTypes.FixedKeysDict(self.__esproducers)

◆ es_sources_()

def Config.Process.es_sources_ (   self)
returns a the es_sources that have been added to the Process

Definition at line 365 of file Config.py.

Referenced by Config.Process.dumpConfig(), Config.Process.dumpPython(), Config.Process.prefer(), and Config.Process.splitPython().

365  def es_sources_(self):
366  """returns a the es_sources that have been added to the Process"""
367  return DictTypes.FixedKeysDict(self.__essources)

◆ extend()

def Config.Process.extend (   self,
  other,
  items = () 
)
Look in other and find types that we can use

Definition at line 764 of file Config.py.

References psClasses.BuildTreeNode.__setattr__(), Config.Process.__setattr__(), Config.FilteredStream.__setattr__, Config.Process.__setObjectLabel(), Config.Process.add_(), DeadROC_duringRun.dir, SiStripCluster.extend(), svgfig.SVG.extend(), Config.Process.extend(), and EcalPhiSymFlatTableProducers_cfi.id.

Referenced by MatrixUtil.WF.__init__(), Config.Process.extend(), Config.Process.load(), and Mixins._ValidatingParameterListBase.setValue().

764  def extend(self,other,items=()):
765  """Look in other and find types that we can use"""
766  # enable explicit check to avoid overwriting of existing objects
767  self.__dict__['_Process__InExtendCall'] = True
768 
769  seqs = dict()
770  tasksToAttach = dict()
771  mods = []
772  for name in dir(other):
773  #'from XX import *' ignores these, and so should we.
774  if name.startswith('_'):
775  continue
776  item = getattr(other,name)
777  if name == "source" or name == "looper":
778  # In these cases 'item' could be None if the specific object was not defined
779  if item is not None:
780  self.__setattr__(name,item)
781  elif isinstance(item,_ModuleSequenceType):
782  seqs[name]=item
783  elif isinstance(item,Task) or isinstance(item, ConditionalTask):
784  tasksToAttach[name] = item
785  elif isinstance(item,_Labelable):
786  self.__setattr__(name,item)
787  if not item.hasLabel_() :
788  item.setLabel(name)
789  elif isinstance(item,Schedule):
790  self.__setattr__(name,item)
791  elif isinstance(item,_Unlabelable):
792  self.add_(item)
793  elif isinstance(item,ProcessModifier):
794  mods.append(item)
795  elif isinstance(item,ProcessFragment):
796  self.extend(item)
797 
798  #now create a sequence that uses the newly made items
799  for name,seq in seqs.items():
800  if id(seq) not in self._cloneToObjectDict:
801  self.__setattr__(name,seq)
802  else:
803  newSeq = self._cloneToObjectDict[id(seq)]
804  self.__dict__[name]=newSeq
805  self.__setObjectLabel(newSeq, name)
806  #now put in proper bucket
807  newSeq._place(name,self)
808 
809  for name, task in tasksToAttach.items():
810  self.__setattr__(name, task)
811 
812  #apply modifiers now that all names have been added
813  for item in mods:
814  item.apply(self)
815 
816  self.__dict__['_Process__InExtendCall'] = False
817 

◆ fillProcessDesc()

def Config.Process.fillProcessDesc (   self,
  processPSet 
)
Used by the framework to convert python to C++ objects

Definition at line 1429 of file Config.py.

References Config.Process.__init__(), and default_text_conditions_cfi.object.

1429  def fillProcessDesc(self, processPSet):
1430  """Used by the framework to convert python to C++ objects"""
1431  class ServiceInjectorAdaptor(object):
1432  def __init__(self,ppset,thelist):
1433  self.__thelist = thelist
1434  self.__processPSet = ppset
1435  def addService(self,pset):
1436  self.__thelist.append(pset)
1437  def newPSet(self):
1438  return self.__processPSet.newPSet()
1439  #This adaptor is used to 'add' the method 'getTopPSet_'
1440  # to the ProcessDesc and PythonParameterSet C++ classes.
1441  # This method is needed for the PSet refToPSet_ functionality.
1442  class TopLevelPSetAcessorAdaptor(object):
1443  def __init__(self,ppset,process):
1444  self.__ppset = ppset
1445  self.__process = process
1446  def __getattr__(self,attr):
1447  return getattr(self.__ppset,attr)
1448  def getTopPSet_(self,label):
1449  return getattr(self.__process,label)
1450  def newPSet(self):
1451  return TopLevelPSetAcessorAdaptor(self.__ppset.newPSet(),self.__process)
1452  def addPSet(self,tracked,name,ppset):
1453  return self.__ppset.addPSet(tracked,name,self.__extractPSet(ppset))
1454  def addVPSet(self,tracked,name,vpset):
1455  return self.__ppset.addVPSet(tracked,name,[self.__extractPSet(x) for x in vpset])
1456  def __extractPSet(self,pset):
1457  if isinstance(pset,TopLevelPSetAcessorAdaptor):
1458  return pset.__ppset
1459  return pset
1460 
1461  self.validate()
1462  processPSet.addString(True, "@process_name", self.name_())
1463  self.handleProcessAccelerators(processPSet)
1464  all_modules = self.producers_().copy()
1465  all_modules.update(self.filters_())
1466  all_modules.update(self.analyzers_())
1467  all_modules.update(self.outputModules_())
1468  if hasattr(self.options,"modulesToCallForTryToContinue") :
1469  shouldTryToContinue = set(self.options.modulesToCallForTryToContinue)
1470  for m in all_modules:
1471  if m in shouldTryToContinue:
1472  setattr(getattr(self,m),"@shouldTryToContinue",untracked.bool(True))
1473  missing = shouldTryToContinue.difference(all_modules)
1474  if missing:
1475  print("Warning: The following modules appear in options.modulesToCallForTryToContinue but are not in the Process: {} ".format(",".join(missing)))
1476  adaptor = TopLevelPSetAcessorAdaptor(processPSet,self)
1477  self._insertInto(adaptor, self.psets_())
1478  self._insertInto(adaptor, self.vpsets_())
1479  self._insertOneInto(adaptor, "@all_sources", self.source_(), True)
1480  self._insertOneInto(adaptor, "@all_loopers", self.looper_(), True)
1481  self._insertSubProcessesInto(adaptor, "@all_subprocesses", self.subProcesses_(), False)
1482  self._insertManyInto(adaptor, "@all_esprefers", self.es_prefers_(), True)
1483  self._insertManyInto(adaptor, "@all_aliases", self.aliases_(), True)
1484  # This will visit all the paths and endpaths that are scheduled to run,
1485  # as well as the Tasks associated to them and the schedule. It remembers
1486  # the modules, ESSources, ESProducers, and services it visits.
1487  nodeVisitor = NodeVisitor()
1488  self._insertPaths(adaptor, nodeVisitor)
1489  all_modules_onTasksOrScheduled = { key:value for key, value in all_modules.items() if value in nodeVisitor.modules }
1490  self._insertManyInto(adaptor, "@all_modules", all_modules_onTasksOrScheduled, True)
1491  all_switches = self.switchProducers_().copy()
1492  all_switches_onTasksOrScheduled = {key:value for key, value in all_switches.items() if value in nodeVisitor.modules }
1493  self._insertSwitchProducersInto(adaptor, "@all_modules", "@all_aliases", all_switches_onTasksOrScheduled, True)
1494  # Same as nodeVisitor except this one visits all the Tasks attached
1495  # to the process.
1496  processNodeVisitor = NodeVisitor()
1497  for pTask in self.tasks.values():
1498  pTask.visit(processNodeVisitor)
1499  esProducersToEnable = {}
1500  for esProducerName, esProducer in self.es_producers_().items():
1501  if esProducer in nodeVisitor.esProducers or not (esProducer in processNodeVisitor.esProducers):
1502  esProducersToEnable[esProducerName] = esProducer
1503  self._insertManyInto(adaptor, "@all_esmodules", esProducersToEnable, True)
1504  esSourcesToEnable = {}
1505  for esSourceName, esSource in self.es_sources_().items():
1506  if esSource in nodeVisitor.esSources or not (esSource in processNodeVisitor.esSources):
1507  esSourcesToEnable[esSourceName] = esSource
1508  self._insertManyInto(adaptor, "@all_essources", esSourcesToEnable, True)
1509  #handle services differently
1510  services = []
1511  for serviceName, serviceObject in self.services_().items():
1512  if serviceObject in nodeVisitor.services or not (serviceObject in processNodeVisitor.services):
1513  serviceObject.insertInto(ServiceInjectorAdaptor(adaptor,services))
1514  adaptor.addVPSet(False,"services",services)
1515  return processPSet
1516 
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)
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
static std::string join(char **cmd)
Definition: RemoteFile.cc:21
def addService(process, multirun=False)
Definition: FastTimer.py:3

◆ filterNames()

def Config.Process.filterNames (   self)
Returns a string containing all the EDFilter labels separated by a blank

Definition at line 186 of file Config.py.

References pat::eventhypothesis::AndFilter.filters_, pat::eventhypothesis::OrFilter.filters_, HLTGenValHistCollPath.filters_, pat::TriggerEvent.filters_, TrigObjTnPHistColl::FilterSelector::FilterSet.filters_, FilterOR.filters_, Config.Process.filters_(), cms::DDFilteredView.filters_, FilterSelection.filters_, FilterSelections.filters_, join(), and relativeConstraints.keys.

186  def filterNames(self):
187  """Returns a string containing all the EDFilter labels separated by a blank"""
188  return ' '.join(self.filters_().keys())
static std::string join(char **cmd)
Definition: RemoteFile.cc:21

◆ filters_()

def Config.Process.filters_ (   self)
returns a dict of the filters that have been added to the Process

Definition at line 210 of file Config.py.

Referenced by Config.Process.dumpConfig(), Config.Process.dumpPython(), Config.Process.filterNames(), Config.Process.prune(), and Config.Process.splitPython().

210  def filters_(self):
211  """returns a dict of the filters that have been added to the Process"""
212  return DictTypes.FixedKeysDict(self.__filters)

◆ finalpaths_()

def Config.Process.finalpaths_ (   self)
returns a dict of the finalpaths that have been added to the Process

Definition at line 318 of file Config.py.

Referenced by Config.Process._insertPaths(), Config.Process.dumpConfig(), Config.Process.dumpPython(), and Config.Process.splitPython().

318  def finalpaths_(self):
319  """returns a dict of the finalpaths that have been added to the Process"""
320  return DictTypes.SortedAndFixedKeysDict(self.__finalpaths)

◆ globalReplace()

def Config.Process.globalReplace (   self,
  label 
)

Definition at line 1198 of file Config.py.

1198  def globalReplace(self,label:str,new):
1199  """ Replace the item with label 'label' by object 'new' in the process and all sequences/paths/tasks"""
1200  if not hasattr(self,label):
1201  raise LookupError("process has no item of label "+label)
1202  setattr(self,label,new)

◆ handleProcessAccelerators()

def Config.Process.handleProcessAccelerators (   self,
  parameterSet 
)

Definition at line 1524 of file Config.py.

1524  def handleProcessAccelerators(self, parameterSet):
1525  # 'cpu' accelerator is always implicitly there
1526  allAccelerators = set(["cpu"])
1527  availableAccelerators = set(["cpu"])
1528  for acc in self.__dict__['_Process__accelerators'].values():
1529  allAccelerators.update(acc.labels())
1530  availableAccelerators.update(acc.enabledLabels())
1531  availableAccelerators = sorted(list(availableAccelerators))
1532  parameterSet.addVString(False, "@available_accelerators", availableAccelerators)
1533 
1534  # Resolve wildcards
1535  selectedAccelerators = []
1536  if "*" in self.options.accelerators:
1537  if len(self.options.accelerators) >= 2:
1538  raise ValueError("process.options.accelerators may contain '*' only as the only element, now it has {} elements".format(len(self.options.accelerators)))
1539  selectedAccelerators = availableAccelerators
1540  else:
1541  import fnmatch
1542  resolved = set()
1543  invalid = []
1544  for pattern in self.options.accelerators:
1545  acc = [a for a in availableAccelerators if fnmatch.fnmatchcase(a, pattern)]
1546  if len(acc) == 0:
1547  if not any(fnmatch.fnmatchcase(a, pattern) for a in allAccelerators):
1548  invalid.append(pattern)
1549  else:
1550  resolved.update(acc)
1551  # Sanity check
1552  if len(invalid) != 0:
1553  raise ValueError("Invalid pattern{} of '{}' in process.options.accelerators, valid values are '{}' or a pattern matching some of them.".format(
1554  "s" if len(invalid) > 2 else "",
1555  "', '".join(invalid),
1556  "', '".join(sorted(list(allAccelerators)))))
1557  selectedAccelerators = sorted(list(resolved))
1558  parameterSet.addVString(False, "@selected_accelerators", selectedAccelerators)
1559 
1560  # Get and apply module type resolver
1561  moduleTypeResolver = None
1562  moduleTypeResolverPlugin = ""
1563  for acc in self.__dict__['_Process__accelerators'].values():
1564  resolver = acc.moduleTypeResolver(selectedAccelerators)
1565  if resolver is not None:
1566  if moduleTypeResolver is not None:
1567  raise RuntimeError("Module type resolver was already set to {} when {} tried to set it to {}. A job can have at most one ProcessAccelerator that sets module type resolver.".format(
1568  moduleTypeResolver.__class__.__name__,
1569  acc.__class__.__name__,
1570  resolver.__class__.__name__))
1571  moduleTypeResolver = resolver
1572  if moduleTypeResolver is not None:
1573  # Plugin name and its configuration
1574  moduleTypeResolverPlugin = moduleTypeResolver.plugin()
1575 
1576  # Customize modules
1577  for modlist in [self.producers_, self.filters_, self.analyzers_,
1578  self.es_producers_, self.es_sources_]:
1579  for module in modlist().values():
1580  moduleTypeResolver.setModuleVariant(module)
1581 
1582  parameterSet.addString(False, "@module_type_resolver", moduleTypeResolverPlugin)
1583 
1584  # Customize process
1585  wrapped = ProcessForProcessAccelerator(self)
1586  for acc in self.__dict__['_Process__accelerators'].values():
1587  acc.apply(wrapped, selectedAccelerators)
1588 
bool any(const std::vector< T > &v, const T &what)
Definition: ECalSD.cc:37
static std::string join(char **cmd)
Definition: RemoteFile.cc:21

◆ isUsingModifier()

def Config.Process.isUsingModifier (   self,
  mod,
  bool 
)
returns True if the Modifier is in used by this Process

Definition at line 386 of file Config.py.

386  def isUsingModifier(self,mod) -> bool:
387  """returns True if the Modifier is in used by this Process"""
388  if mod._isChosen():
389  for m in self.__modifiers:
390  if m._isOrContains(mod):
391  return True
392  return False
393 

◆ load()

def Config.Process.load (   self,
  moduleName 
)

Definition at line 760 of file Config.py.

References SiStripCluster.extend(), svgfig.SVG.extend(), and Config.Process.extend().

760  def load(self, moduleName:str):
761  moduleName = moduleName.replace("/",".")
762  module = __import__(moduleName)
763  self.extend(sys.modules[moduleName])
def load(fileName)
Definition: svgfig.py:547

◆ looper_()

def Config.Process.looper_ (   self)
returns the looper that has been added to the Process or None if none have been added

Definition at line 235 of file Config.py.

Referenced by Config.Process.dumpConfig(), Config.Process.dumpPython(), and Config.Process.splitPython().

235  def looper_(self):
236  """returns the looper that has been added to the Process or None if none have been added"""
237  return self.__looper

◆ name_()

def Config.Process.name_ (   self,
  str 
)

Definition at line 214 of file Config.py.

214  def name_(self) -> str:
215  return self.__name

◆ outputModules_()

def Config.Process.outputModules_ (   self)
returns a dict of the output modules that have been added to the Process

Definition at line 306 of file Config.py.

Referenced by Config.Process.dumpConfig(), Config.Process.dumpPython(), and Config.Process.splitPython().

306  def outputModules_(self):
307  """returns a dict of the output modules that have been added to the Process"""
308  return DictTypes.FixedKeysDict(self.__outputmodules)

◆ pathNames()

def Config.Process.pathNames (   self)
Returns a string containing all the Path names separated by a blank

Definition at line 189 of file Config.py.

References join(), relativeConstraints.keys, edm::MainParameterSet.paths_, edm::HLTGlobalStatus.paths_, heppy::TriggerBitChecker.paths_, edm::PathsAndConsumesOfModules.paths_, ProcessCallGraph::ProcessType.paths_, pat::TriggerEvent.paths_, HLTPerformanceInfo.paths_, edm::cfi::Untyped.paths_, Config.Process.paths_(), and FastTimerService::PlotsPerProcess.paths_.

189  def pathNames(self):
190  """Returns a string containing all the Path names separated by a blank"""
191  return ' '.join(self.paths_().keys())
192 
static std::string join(char **cmd)
Definition: RemoteFile.cc:21

◆ paths_()

def Config.Process.paths_ (   self)
returns a dict of the paths that have been added to the Process

Definition at line 310 of file Config.py.

Referenced by Config.Process._insertPaths(), Config.Process.dumpConfig(), Config.Process.dumpPython(), Config.Process.pathNames(), and Config.Process.splitPython().

310  def paths_(self):
311  """returns a dict of the paths that have been added to the Process"""
312  return DictTypes.SortedAndFixedKeysDict(self.__paths)

◆ prefer()

def Config.Process.prefer (   self,
  esmodule,
  args,
  kargs 
)
Prefer this ES source or producer.  The argument can
   either be an object label, e.g.,
     process.prefer(process.juicerProducer) (not supported yet)
   or a name of an ESSource or ESProducer
     process.prefer("juicer")
   or a type of unnamed ESSource or ESProducer
     process.prefer("JuicerProducer")
   In addition, you can pass as a labelled arguments the name of the Record you wish to
   prefer where the type passed is a cms.vstring and that vstring can contain the
   name of the C++ types in the Record that are being preferred, e.g.,
      #prefer all data in record 'OrangeRecord' from 'juicer'
      process.prefer("juicer", OrangeRecord=cms.vstring())
   or
      #prefer only "Orange" data in "OrangeRecord" from "juicer"
      process.prefer("juicer", OrangeRecord=cms.vstring("Orange"))
   or
      #prefer only "Orange" data with label "ExtraPulp" in "OrangeRecord" from "juicer"
      ESPrefer("ESJuicerProd", OrangeRecord=cms.vstring("Orange/ExtraPulp"))

Definition at line 1589 of file Config.py.

References Config.Process._findPreferred(), Config.Process.es_producers_(), and Config.Process.es_sources_().

1589  def prefer(self, esmodule,*args,**kargs):
1590  """Prefer this ES source or producer. The argument can
1591  either be an object label, e.g.,
1592  process.prefer(process.juicerProducer) (not supported yet)
1593  or a name of an ESSource or ESProducer
1594  process.prefer("juicer")
1595  or a type of unnamed ESSource or ESProducer
1596  process.prefer("JuicerProducer")
1597  In addition, you can pass as a labelled arguments the name of the Record you wish to
1598  prefer where the type passed is a cms.vstring and that vstring can contain the
1599  name of the C++ types in the Record that are being preferred, e.g.,
1600  #prefer all data in record 'OrangeRecord' from 'juicer'
1601  process.prefer("juicer", OrangeRecord=cms.vstring())
1602  or
1603  #prefer only "Orange" data in "OrangeRecord" from "juicer"
1604  process.prefer("juicer", OrangeRecord=cms.vstring("Orange"))
1605  or
1606  #prefer only "Orange" data with label "ExtraPulp" in "OrangeRecord" from "juicer"
1607  ESPrefer("ESJuicerProd", OrangeRecord=cms.vstring("Orange/ExtraPulp"))
1608  """
1609  # see if this refers to a named ESProducer
1610  if isinstance(esmodule, ESSource) or isinstance(esmodule, ESProducer):
1611  raise RuntimeError("Syntax of process.prefer(process.esmodule) not supported yet")
1612  elif self._findPreferred(esmodule, self.es_producers_(),*args,**kargs) or \
1613  self._findPreferred(esmodule, self.es_sources_(),*args,**kargs):
1614  pass
1615  else:
1616  raise RuntimeError("Cannot resolve prefer for "+repr(esmodule))
1617 

◆ processAccelerators_()

def Config.Process.processAccelerators_ (   self)
returns a dict of the ProcessAccelerators that have been added to the Process

Definition at line 357 of file Config.py.

Referenced by Config.Process.dumpPython().

357  def processAccelerators_(self):
358  """returns a dict of the ProcessAccelerators that have been added to the Process"""
359  return DictTypes.FixedKeysDict(self.__accelerators)

◆ producerNames()

def Config.Process.producerNames (   self)
Returns a string containing all the EDProducer labels separated by a blank

Definition at line 177 of file Config.py.

References join(), relativeConstraints.keys, pf2pat::EventHypothesis.producers_, and Config.Process.producers_().

177  def producerNames(self):
178  """Returns a string containing all the EDProducer labels separated by a blank"""
179  return ' '.join(self.producers_().keys())
static std::string join(char **cmd)
Definition: RemoteFile.cc:21

◆ producers_()

def Config.Process.producers_ (   self)
returns a dict of the producers that have been added to the Process

Definition at line 221 of file Config.py.

Referenced by Config.Process.dumpConfig(), Config.Process.dumpPython(), Config.Process.producerNames(), Config.Process.prune(), and Config.Process.splitPython().

221  def producers_(self):
222  """returns a dict of the producers that have been added to the Process"""
223  return DictTypes.FixedKeysDict(self.__producers)

◆ prune()

def Config.Process.prune (   self,
  verbose = False,
  keepUnresolvedSequencePlaceholders 
)

Definition at line 1351 of file Config.py.

References Config.Process._pruneModules(), HLTMuonValidator.analyzers_, Config.Process.analyzers_(), Config.Process.endpaths, pat::eventhypothesis::AndFilter.filters_, pat::eventhypothesis::OrFilter.filters_, HLTGenValHistCollPath.filters_, pat::TriggerEvent.filters_, TrigObjTnPHistColl::FilterSelector::FilterSet.filters_, FilterOR.filters_, Config.Process.filters_(), cms::DDFilteredView.filters_, FilterSelection.filters_, FilterSelections.filters_, Config.Process.finalpaths, join(), Config.Process.paths, print(), pf2pat::EventHypothesis.producers_, Config.Process.producers_(), jsoncollector::Json::Path.resolve(), Config.Process.resolve(), EcalDQMonitorTask.schedule_, edm::ModuleChanger.schedule_, edm::ScheduleInfo.schedule_, edm::PathsAndConsumesOfModules.schedule_, edm::SubProcess.schedule_, edm::EventProcessor.schedule_, Config.Process.schedule_(), edm::test::TestProcessor.schedule_, Config.Process.sequences, Config.Process.switchProducers_(), Config.Process.tasks, contentValuesCheck.values, and Config.Process.vpsets_().

Referenced by dirstructure.Directory.prune().

1351  def prune(self,verbose=False,keepUnresolvedSequencePlaceholders:bool=False):
1352  """ Remove clutter from the process that we think is unnecessary:
1353  tracked PSets, VPSets and unused modules and sequences. If a Schedule has been set, then Paths and EndPaths
1354  not in the schedule will also be removed, along with an modules and sequences used only by
1355  those removed Paths and EndPaths. The keepUnresolvedSequencePlaceholders keeps also unresolved TaskPlaceholders."""
1356 # need to update this to only prune psets not on refToPSets
1357 # but for now, remove the delattr
1358 # for name in self.psets_():
1359 # if getattr(self,name).isTracked():
1360 # delattr(self, name)
1361  for name in self.vpsets_():
1362  delattr(self, name)
1363  #first we need to resolve any SequencePlaceholders being used
1364  self.resolve(keepUnresolvedSequencePlaceholders)
1365  usedModules = set()
1366  unneededPaths = set()
1367  tasks = list()
1368  tv = TaskVisitor(tasks)
1369  if self.schedule_():
1370  usedModules=set(self.schedule_().moduleNames())
1371  #get rid of unused paths
1372  schedNames = set(( x.label_() for x in self.schedule_()))
1373  names = set(self.paths)
1374  names.update(set(self.endpaths))
1375  names.update(set(self.finalpaths))
1376  unneededPaths = names - schedNames
1377  for n in unneededPaths:
1378  delattr(self,n)
1379  for t in self.schedule_().tasks():
1380  tv.enter(t)
1381  t.visit(tv)
1382  tv.leave(t)
1383  else:
1384  pths = list(self.paths.values())
1385  pths.extend(self.endpaths.values())
1386  pths.extend(self.finalpaths.values())
1387  temp = Schedule(*pths)
1388  usedModules=set(temp.moduleNames())
1389  unneededModules = self._pruneModules(self.producers_(), usedModules)
1390  unneededModules.update(self._pruneModules(self.switchProducers_(), usedModules))
1391  unneededModules.update(self._pruneModules(self.filters_(), usedModules))
1392  unneededModules.update(self._pruneModules(self.analyzers_(), usedModules))
1393  #remove sequences and tasks that do not appear in remaining paths and endpaths
1394  seqs = list()
1395  sv = SequenceVisitor(seqs)
1396  for p in self.paths.values():
1397  p.visit(sv)
1398  p.visit(tv)
1399  for p in self.endpaths.values():
1400  p.visit(sv)
1401  p.visit(tv)
1402  for p in self.finalpaths.values():
1403  p.visit(sv)
1404  p.visit(tv)
1405  def removeUnneeded(seqOrTasks, allSequencesOrTasks):
1406  _keepSet = set(( s for s in seqOrTasks if s.hasLabel_()))
1407  _availableSet = set(allSequencesOrTasks.values())
1408  _unneededSet = _availableSet-_keepSet
1409  _unneededLabels = []
1410  for s in _unneededSet:
1411  _unneededLabels.append(s.label_())
1412  delattr(self,s.label_())
1413  return _unneededLabels
1414  unneededSeqLabels = removeUnneeded(seqs, self.sequences)
1415  unneededTaskLabels = removeUnneeded(tasks, self.tasks)
1416  if verbose:
1417  print("prune removed the following:")
1418  print(" modules:"+",".join(unneededModules))
1419  print(" tasks:"+",".join(unneededTaskLabels))
1420  print(" sequences:"+",".join(unneededSeqLabels))
1421  print(" paths/endpaths/finalpaths:"+",".join(unneededPaths))
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
static std::string join(char **cmd)
Definition: RemoteFile.cc:21

◆ psets_()

def Config.Process.psets_ (   self)
returns a dict of the PSets that have been added to the Process

Definition at line 377 of file Config.py.

377  def psets_(self):
378  """returns a dict of the PSets that have been added to the Process"""
379  return DictTypes.FixedKeysDict(self.__psets)

◆ resolve()

def Config.Process.resolve (   self,
  keepUnresolvedSequencePlaceholders 
)

Definition at line 1340 of file Config.py.

References Config.Process.endpaths, Config.Process.finalpaths, Config.Process.paths, EcalDQMonitorTask.schedule_, edm::ModuleChanger.schedule_, edm::ScheduleInfo.schedule_, edm::PathsAndConsumesOfModules.schedule_, edm::SubProcess.schedule_, edm::EventProcessor.schedule_, Config.Process.schedule_(), edm::test::TestProcessor.schedule_, and contentValuesCheck.values.

Referenced by Config.Process.prune().

1340  def resolve(self,keepUnresolvedSequencePlaceholders:bool=False):
1341  for x in self.paths.values():
1342  x.resolve(self.__dict__,keepUnresolvedSequencePlaceholders)
1343  for x in self.endpaths.values():
1344  x.resolve(self.__dict__,keepUnresolvedSequencePlaceholders)
1345  for x in self.finalpaths.values():
1346  x.resolve(self.__dict__,keepUnresolvedSequencePlaceholders)
1347  if not self.schedule_() == None:
1348  for task in self.schedule_()._tasks:
1349  task.resolve(self.__dict__,keepUnresolvedSequencePlaceholders)
1350 

◆ schedule_()

def Config.Process.schedule_ (   self)
returns the schedule that has been added to the Process or None if none have been added

Definition at line 334 of file Config.py.

Referenced by Config.Process._insertPaths(), Config.Process._replaceInSchedule(), Config.Process._replaceInScheduleDirectly(), Config.Process.dumpPython(), Config.Process.prune(), Config.Process.resolve(), and Config.Process.splitPython().

334  def schedule_(self):
335  """returns the schedule that has been added to the Process or None if none have been added"""
336  return self.__schedule

◆ sequences_()

def Config.Process.sequences_ (   self)
returns a dict of the sequences that have been added to the Process

Definition at line 322 of file Config.py.

Referenced by Config.Process.dumpConfig().

322  def sequences_(self):
323  """returns a dict of the sequences that have been added to the Process"""
324  return DictTypes.FixedKeysDict(self.__sequences)

◆ services_()

def Config.Process.services_ (   self)
returns a dict of the services that have been added to the Process

Definition at line 353 of file Config.py.

Referenced by Config.Process.dumpConfig(), Config.Process.dumpPython(), and Config.Process.splitPython().

353  def services_(self):
354  """returns a dict of the services that have been added to the Process"""
355  return DictTypes.FixedKeysDict(self.__services)

◆ setLooper_()

def Config.Process.setLooper_ (   self,
  lpr 
)

Definition at line 238 of file Config.py.

References Config.Process._placeLooper().

238  def setLooper_(self,lpr):
239  self._placeLooper('looper',lpr)

◆ setName_()

def Config.Process.setName_ (   self,
  name 
)

Definition at line 216 of file Config.py.

216  def setName_(self,name: str):
217  if not name.isalnum():
218  raise RuntimeError("Error: The process name is an empty string or contains non-alphanumeric characters")
219  self.__dict__['_Process__name'] = name

◆ setPartialSchedule_()

def Config.Process.setPartialSchedule_ (   self,
  sch 
)

Definition at line 337 of file Config.py.

References Config.Process._place(), and Config.Process.setSchedule_().

337  def setPartialSchedule_(self,sch: Schedule,label: str):
338  if label == "schedule":
339  self.setSchedule_(sch)
340  else:
341  self._place(label, sch, self.__partialschedules)

◆ setSchedule_()

def Config.Process.setSchedule_ (   self,
  sch 
)

Definition at line 342 of file Config.py.

References str.

Referenced by Config.Process.setPartialSchedule_().

342  def setSchedule_(self,sch: Schedule):
343  # See if every path and endpath has been inserted into the process
344  index = 0
345  try:
346  for p in sch:
347  p.label_()
348  index +=1
349  except:
350  raise RuntimeError("The path at index "+str(index)+" in the Schedule was not attached to the process.")
351  self.__dict__['_Process__schedule'] = sch
#define str(s)

◆ setSource_()

def Config.Process.setSource_ (   self,
  src 
)

Definition at line 232 of file Config.py.

References Config.Process._placeSource().

232  def setSource_(self,src):
233  self._placeSource('source',src)

◆ setStrict()

def Config.Process.setStrict (   self,
  value 
)

Definition at line 172 of file Config.py.

References Config.Process.__isStrict.

172  def setStrict(self, value: bool):
173  self.__isStrict = value
174  _Module.__isStrict__ = True
175 

◆ source_()

def Config.Process.source_ (   self)
returns the source that has been added to the Process or None if none have been added

Definition at line 229 of file Config.py.

Referenced by Config.Process.dumpConfig(), Config.Process.dumpPython(), and Config.Process.splitPython().

229  def source_(self):
230  """returns the source that has been added to the Process or None if none have been added"""
231  return self.__source

◆ splitPython()

def Config.Process.splitPython (   self,
  options 
)

Definition at line 1091 of file Config.py.

References Config.Process._itemsInDependencyOrder(), Config.Process._splitPython(), Config.Process._splitPythonList(), Config.Process.aliases_(), HLTMuonValidator.analyzers_, Config.Process.analyzers_(), Config.Process.dumpPython(), Config.Process.endpaths_(), FastTimerService::PlotsPerProcess.endpaths_, Config.Process.es_prefers_(), Config.Process.es_producers_(), Config.Process.es_sources_(), pat::eventhypothesis::AndFilter.filters_, pat::eventhypothesis::OrFilter.filters_, HLTGenValHistCollPath.filters_, pat::TriggerEvent.filters_, TrigObjTnPHistColl::FilterSelector::FilterSet.filters_, FilterOR.filters_, Config.Process.filters_(), cms::DDFilteredView.filters_, FilterSelection.filters_, FilterSelections.filters_, Config.Process.finalpaths_(), join(), Config.Process.looper_(), edm::EventProcessor.looper_, Config.Process.outputModules_(), edm::MainParameterSet.paths_, edm::HLTGlobalStatus.paths_, heppy::TriggerBitChecker.paths_, edm::PathsAndConsumesOfModules.paths_, ProcessCallGraph::ProcessType.paths_, pat::TriggerEvent.paths_, HLTPerformanceInfo.paths_, edm::cfi::Untyped.paths_, Config.Process.paths_(), FastTimerService::PlotsPerProcess.paths_, pf2pat::EventHypothesis.producers_, Config.Process.producers_(), Config.Process.psets, ConfigBuilder.ConfigBuilder.schedule, Config.Process.schedule, EcalDQMonitorTask.schedule_, edm::ModuleChanger.schedule_, edm::ScheduleInfo.schedule_, edm::PathsAndConsumesOfModules.schedule_, edm::SubProcess.schedule_, edm::EventProcessor.schedule_, Config.Process.schedule_(), edm::test::TestProcessor.schedule_, Config.Process.sequences, edm::ProcessDesc.services_, Config.Process.services_(), ecaldqm::DBWriterWorker.source_, HGCalTestPartialWaferRecHits.source_, L2MuonSeedGeneratorFromL1TkMu.source_, TestAlpakaObjectAnalyzer.source_, SiStripFedCablingBuilderFromDb.source_, edm::test::TestSourceProcessor.source_, TestPortableAnalyzer.source_, jsoncollector::DataPoint.source_, sistrip::SpyEventMatcher.source_, ProcessCallGraph.source_, Config.Process.source_(), edm::InputSource::EventSourceSentry.source_, edm::InputSource::LumiSourceSentry.source_, edm::InputSource::RunSourceSentry.source_, edm::InputSource::ProcessBlockSourceSentry.source_, TestAlpakaAnalyzer.source_, edm::SubProcess.subProcesses_, Config.Process.subProcesses_(), edm::EventProcessor.subProcesses_, Config.Process.switchProducers_(), Config.Process.tasks, and Config.Process.vpsets.

1091  def splitPython(self, options:PrintOptions = PrintOptions()) -> dict:
1092  """return a map of file names to python configuration fragments"""
1093  specialImportRegistry._reset()
1094  # extract individual fragments
1095  options.isCfg = False
1096  header = "import FWCore.ParameterSet.Config as cms"
1097  result = ''
1098  parts = {}
1099  files = {}
1100 
1101  result = 'process = cms.Process("' + self.__name + '")\n\n'
1102 
1103  if self.source_():
1104  parts['source'] = (None, 'source = ' + self.source_().dumpPython(options))
1105 
1106  if self.looper_():
1107  parts['looper'] = (None, 'looper = ' + self.looper_().dumpPython())
1108 
1109  parts.update(self._splitPythonList('psets', self.psets, options))
1110  parts.update(self._splitPythonList('psets', self.vpsets, options))
1111  # FIXME
1112  #parts.update(self._splitPythonSubProcesses(self.subProcesses_(), options))
1113  if len(self.subProcesses_()):
1114  sys.stderr.write("error: subprocesses are not supported yet\n\n")
1115  parts.update(self._splitPythonList('modules', self.producers_(), options))
1116  parts.update(self._splitPythonList('modules', self.switchProducers_(), options))
1117  parts.update(self._splitPythonList('modules', self.filters_() , options))
1118  parts.update(self._splitPythonList('modules', self.analyzers_(), options))
1119  parts.update(self._splitPythonList('modules', self.outputModules_(), options))
1120  parts.update(self._splitPythonList('services', self.services_(), options))
1121  parts.update(self._splitPythonList('eventsetup', self.es_producers_(), options))
1122  parts.update(self._splitPythonList('eventsetup', self.es_sources_(), options))
1123  parts.update(self._splitPython('eventsetup', self.es_prefers_(), options))
1124  parts.update(self._splitPythonList('tasks', self._itemsInDependencyOrder(self.tasks), options))
1125  parts.update(self._splitPythonList('sequences', self._itemsInDependencyOrder(self.sequences), options))
1126  parts.update(self._splitPythonList('paths', self.paths_(), options))
1127  parts.update(self._splitPythonList('paths', self.endpaths_(), options))
1128  parts.update(self._splitPythonList('paths', self.finalpaths_(), options))
1129  parts.update(self._splitPythonList('modules', self.aliases_(), options))
1130 
1131  if options.targetDirectory is not None:
1132  files[options.targetDirectory + '/__init__.py'] = ''
1133 
1134  if options.useSubdirectories:
1135  for sub in 'psets', 'modules', 'services', 'eventsetup', 'tasks', 'sequences', 'paths':
1136  if options.targetDirectory is not None:
1137  sub = options.targetDirectory + '/' + sub
1138  files[sub + '/__init__.py'] = ''
1139 
1140  # case insensitive sort by subfolder and module name
1141  parts = sorted(parts.items(), key = lambda nsc: (nsc[1][0].lower() if nsc[1][0] else '', nsc[0].lower()))
1142 
1143  for (name, (subfolder, code)) in parts:
1144  filename = name + '_cfi'
1145  if options.useSubdirectories and subfolder:
1146  filename = subfolder + '/' + filename
1147  if options.targetDirectory is not None:
1148  filename = options.targetDirectory + '/' + filename
1149  result += 'process.load("%s")\n' % filename
1150  files[filename + '.py'] = header + '\n\n' + code
1151 
1152  if self.schedule_() is not None:
1153  options.isCfg = True
1154  result += '\nprocess.schedule = ' + self.schedule.dumpPython(options)
1155 
1156  imports = specialImportRegistry.getSpecialImports()
1157  if len(imports) > 0:
1158  header += '\n' + '\n'.join(imports)
1159  files['-'] = header + '\n\n' + result
1160  return files
1161 
static std::string join(char **cmd)
Definition: RemoteFile.cc:21
def dumpPython(process, name)

◆ subProcesses_()

def Config.Process.subProcesses_ (   self)
returns a list of the subProcesses that have been added to the Process

Definition at line 298 of file Config.py.

Referenced by Config.Process.dumpConfig(), Config.Process.dumpPython(), and Config.Process.splitPython().

298  def subProcesses_(self):
299  """returns a list of the subProcesses that have been added to the Process"""
300  return self.__subProcesses

◆ switchProducerNames()

def Config.Process.switchProducerNames (   self)
Returns a string containing all the SwitchProducer labels separated by a blank

Definition at line 180 of file Config.py.

References join(), relativeConstraints.keys, and Config.Process.switchProducers_().

180  def switchProducerNames(self):
181  """Returns a string containing all the SwitchProducer labels separated by a blank"""
182  return ' '.join(self.switchProducers_().keys())
static std::string join(char **cmd)
Definition: RemoteFile.cc:21

◆ switchProducers_()

def Config.Process.switchProducers_ (   self)
returns a dict of the SwitchProducers that have been added to the Process

Definition at line 225 of file Config.py.

Referenced by Config.Process.dumpConfig(), Config.Process.dumpPython(), Config.Process.prune(), Config.Process.splitPython(), and Config.Process.switchProducerNames().

225  def switchProducers_(self):
226  """returns a dict of the SwitchProducers that have been added to the Process"""
227  return DictTypes.FixedKeysDict(self.__switchproducers)

◆ tasks_()

def Config.Process.tasks_ (   self)
returns a dict of the tasks that have been added to the Process

Definition at line 326 of file Config.py.

326  def tasks_(self):
327  """returns a dict of the tasks that have been added to the Process"""
328  return DictTypes.FixedKeysDict(self.__tasks)

◆ validate()

def Config.Process.validate (   self)

Definition at line 1517 of file Config.py.

1517  def validate(self):
1518  # check if there's some input
1519  # Breaks too many unit tests for now
1520  #if self.source_() == None and self.looper_() == None:
1521  # raise RuntimeError("No input source was found for this process")
1522  pass
1523 

◆ vpsets_()

def Config.Process.vpsets_ (   self)
returns a dict of the VPSets that have been added to the Process

Definition at line 381 of file Config.py.

Referenced by Config.Process.prune().

381  def vpsets_(self):
382  """returns a dict of the VPSets that have been added to the Process"""
383  return DictTypes.FixedKeysDict(self.__vpsets)

Member Data Documentation

◆ __isStrict

Config.Process.__isStrict
private

◆ __ppset

Config.Process.__ppset
private

Definition at line 1444 of file Config.py.

◆ __process

Config.Process.__process
private

◆ __processPSet

Config.Process.__processPSet
private

Definition at line 1434 of file Config.py.

◆ __thelist

Config.Process.__thelist
private

Definition at line 1433 of file Config.py.

◆ _firstProcess

Config.Process._firstProcess
staticprivate

Definition at line 116 of file Config.py.

◆ maxLuminosityBlocks

Config.Process.maxLuminosityBlocks

Definition at line 156 of file Config.py.

◆ MessageLogger

Config.Process.MessageLogger

Definition at line 161 of file Config.py.

Property Documentation

◆ aliases

Config.Process.aliases = property(aliases_,doc="dictionary containing the aliases for the process")
static

Definition at line 376 of file Config.py.

◆ analyzers

Config.Process.analyzers = property(analyzers_,doc="dictionary containing the analyzers for the process")
static

Definition at line 305 of file Config.py.

Referenced by looper.Looper.loop(), and looper.Looper.write().

◆ conditionaltasks

Config.Process.conditionaltasks = property(conditionaltasks_,doc="dictionary containing the conditionatasks for the process")
static

◆ endpaths

Config.Process.endpaths = property(endpaths_,doc="dictionary containing the endpaths for the process")
static

◆ es_prefers

Config.Process.es_prefers = property(es_prefers_,doc="dictionary containing the es_prefers for the process")
static

Definition at line 372 of file Config.py.

◆ es_producers

Config.Process.es_producers = property(es_producers_,doc="dictionary containing the es_producers for the process")
static

Definition at line 364 of file Config.py.

◆ es_sources

Config.Process.es_sources = property(es_sources_,doc="dictionary containing the es_sources for the process")
static

Definition at line 368 of file Config.py.

◆ filters

Config.Process.filters = property(filters_, doc="dictionary containing the filters for the process")
static

Definition at line 213 of file Config.py.

◆ finalpaths

Config.Process.finalpaths = property(finalpaths_,doc="dictionary containing the finalpaths for the process")
static

◆ looper

Config.Process.looper = property(looper_,setLooper_,doc='the main looper or None if not set')
static

Definition at line 240 of file Config.py.

◆ outputModules

Config.Process.outputModules = property(outputModules_,doc="dictionary containing the output_modules for the process")
static

Definition at line 309 of file Config.py.

◆ paths

Config.Process.paths = property(paths_,doc="dictionary containing the paths for the process")
static

◆ process

Config.Process.process = property(name_,setName_, doc="name of the process")
static

◆ processAccelerators

Config.Process.processAccelerators = property(processAccelerators_,doc="dictionary containing the ProcessAccelerators for the process")
static

Definition at line 360 of file Config.py.

◆ producers

Config.Process.producers = property(producers_,doc="dictionary containing the producers for the process")
static

Definition at line 224 of file Config.py.

◆ psets

Config.Process.psets = property(psets_,doc="dictionary containing the PSets for the process")
static

◆ schedule

Config.Process.schedule = property(schedule_,setSchedule_,doc='the schedule or None if not set')
static

◆ sequences

Config.Process.sequences = property(sequences_,doc="dictionary containing the sequences for the process")
static

◆ services

Config.Process.services = property(services_,doc="dictionary containing the services for the process")
static

◆ source

Config.Process.source = property(source_,setSource_,doc='the main source or None if not set')
static

◆ subProcesses

Config.Process.subProcesses = property(subProcesses_,doc='the SubProcesses that have been added to the Process')
static

Definition at line 301 of file Config.py.

◆ switchProducers

Config.Process.switchProducers = property(switchProducers_,doc="dictionary containing the SwitchProducers for the process")
static

Definition at line 228 of file Config.py.

◆ tasks

Config.Process.tasks = property(tasks_,doc="dictionary containing the tasks for the process")
static

◆ vpsets

Config.Process.vpsets = property(vpsets_,doc="dictionary containing the PSets for the process")
static