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__ (self, name)
 
def __init__ (self, name, Mods)
 
def __setattr__ (self, name, value)
 
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 (self, options=PrintOptions())
 
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 (self, label, new)
 
def handleProcessAccelerators (self, parameterSet)
 
def isUsingModifier (self, mod)
 
def load (self, moduleName)
 
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 (self, verbose=False, keepUnresolvedSequencePlaceholders=False)
 
def psets_ (self)
 
def resolve (self, keepUnresolvedSequencePlaceholders=False)
 
def schedule_ (self)
 
def sequences_ (self)
 
def services_ (self)
 
def setLooper_ (self, lpr)
 
def setName_ (self, name)
 
def setPartialSchedule_ (self, sch, label)
 
def setSchedule_ (self, sch)
 
def setSource_ (self, src)
 
def setStrict (self, value)
 
def source_ (self)
 
def splitPython (self, options=PrintOptions())
 
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 (self, name, value, newValue=None)
 
def __setObjectLabel (self, object, newLabel)
 
def __updateMaxEvents (self, ps)
 
def __updateOptions (self, opt)
 
def _delattrFromSetattr (self, name)
 
def _delHelper (self, name)
 
def _dumpConfigESPrefers (self, options)
 
def _dumpConfigNamedList (self, items, typeName, options)
 
def _dumpConfigOptionallyNamedList (self, items, typeName, options)
 
def _dumpConfigUnnamedList (self, items, typeName, options)
 
def _dumpPython (self, d, options)
 
def _dumpPythonList (self, d, options)
 
def _dumpPythonSubProcesses (self, l, options)
 
def _findPreferred (self, esname, d, args, kargs)
 
def _insertInto (self, parameterSet, itemDict)
 
def _insertManyInto (self, parameterSet, label, itemDict, tracked)
 
def _insertOneInto (self, parameterSet, label, item, tracked)
 
def _insertPaths (self, processPSet, nodeVisitor)
 
def _insertSubProcessesInto (self, parameterSet, label, itemList, tracked)
 
def _insertSwitchProducersInto (self, parameterSet, labelModules, labelAliases, itemDict, tracked)
 
def _itemsInDependencyOrder (self, processDictionaryOfItems)
 
def _okToPlace (self, name, mod, d)
 
def _place (self, name, mod, d)
 
def _placeAccelerator (self, typeName, mod)
 
def _placeAlias (self, name, mod)
 
def _placeAnalyzer (self, name, mod)
 
def _placeConditionalTask (self, name, task)
 
def _placeEndPath (self, name, mod)
 
def _placeESPrefer (self, name, mod)
 
def _placeESProducer (self, name, mod)
 
def _placeESSource (self, name, mod)
 
def _placeFilter (self, name, mod)
 
def _placeFinalPath (self, name, mod)
 
def _placeLooper (self, name, mod)
 
def _placeOutputModule (self, name, mod)
 
def _placePath (self, name, mod)
 
def _placeProducer (self, name, mod)
 
def _placePSet (self, name, mod)
 
def _placeSequence (self, name, mod)
 
def _placeService (self, typeName, mod)
 
def _placeSource (self, name, mod)
 
def _placeSubProcess (self, name, mod)
 
def _placeSwitchProducer (self, name, mod)
 
def _placeTask (self, name, task)
 
def _placeVPSet (self, name, mod)
 
def _pruneModules (self, d, scheduledNames)
 
def _replaceInConditionalTasks (self, label, new)
 
def _replaceInSchedule (self, label, new)
 
def _replaceInScheduleDirectly (self, label, new)
 
def _replaceInSequences (self, label, new)
 
def _replaceInTasks (self, label, new)
 
def _splitPython (self, subfolder, d, options)
 
def _splitPythonList (self, subfolder, d, options)
 
def _validateConditionalTask (self, task, label)
 
def _validateSequence (self, sequence, label)
 
def _validateTask (self, task, label)
 

Private Attributes

 __isStrict
 
 __ppset
 
 __process
 
 __processPSet
 
 __thelist
 

Static Private Attributes

 _firstProcess
 

Detailed Description

Root class for a CMS configuration process

Definition at line 113 of file Config.py.

Constructor & Destructor Documentation

◆ __init__()

def Config.Process.__init__ (   self,
  name,
  Mods 
)
The argument 'name' will be the name applied to this Process
    Can optionally pass as additional arguments cms.Modifier instances
    that will be used to modify the Process as it is built

Definition at line 116 of file Config.py.

Referenced by Config.Process.fillProcessDesc().

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

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

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

◆ __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 571 of file Config.py.

Referenced by Config.Process.__setattr__().

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

◆ __injectValidValue()

def Config.Process.__injectValidValue (   self,
  name,
  value,
  newValue = None 
)
private

Definition at line 561 of file Config.py.

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

Referenced by Config.Process.__setattr__().

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

◆ __setattr__()

def Config.Process.__setattr__ (   self,
  name,
  value 
)

Definition at line 420 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().

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

◆ __setObjectLabel()

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

Definition at line 393 of file Config.py.

References l1ctLayer2EG_cff.id, and str.

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

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

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

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

◆ __updateMaxEvents()

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

Definition at line 285 of file Config.py.

References Config.Process.defaultMaxEvents_().

Referenced by Config.Process.__setattr__().

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

◆ __updateOptions()

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

Definition at line 272 of file Config.py.

References Config.Process.defaultOptions_().

Referenced by Config.Process.__setattr__().

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

◆ _delattrFromSetattr()

def Config.Process._delattrFromSetattr (   self,
  name 
)
private
Similar to __delattr__ but we need different behavior when called from __setattr__

Definition at line 629 of file Config.py.

References Config.Process._delHelper().

Referenced by Config.Process.__setattr__().

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

◆ _delHelper()

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

Definition at line 584 of file Config.py.

References contentValuesCheck.values.

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

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

◆ _dumpConfigESPrefers()

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

Definition at line 906 of file Config.py.

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

Referenced by Config.Process.dumpConfig().

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

◆ _dumpConfigNamedList()

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

Definition at line 817 of file Config.py.

Referenced by Config.Process.dumpConfig().

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

◆ _dumpConfigOptionallyNamedList()

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

Definition at line 829 of file Config.py.

Referenced by Config.Process.dumpConfig().

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

◆ _dumpConfigUnnamedList()

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

Definition at line 823 of file Config.py.

Referenced by Config.Process.dumpConfig().

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

◆ _dumpPython()

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

Definition at line 1041 of file Config.py.

Referenced by Config.Process.dumpPython().

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

◆ _dumpPythonList()

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

Definition at line 918 of file Config.py.

Referenced by Config.Process.dumpPython().

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

◆ _dumpPythonSubProcesses()

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

Definition at line 912 of file Config.py.

Referenced by Config.Process.dumpPython().

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

◆ _findPreferred()

def Config.Process._findPreferred (   self,
  esname,
  d,
  args,
  kargs 
)
private

Definition at line 1617 of file Config.py.

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

Referenced by Config.Process.prefer().

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

◆ _insertInto()

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

Definition at line 1202 of file Config.py.

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

◆ _insertManyInto()

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

Definition at line 1212 of file Config.py.

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

◆ _insertOneInto()

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

Definition at line 1205 of file Config.py.

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

◆ _insertPaths()

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

Definition at line 1244 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_, 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_.

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

◆ _insertSubProcessesInto()

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

Definition at line 1231 of file Config.py.

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

◆ _insertSwitchProducersInto()

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

Definition at line 1220 of file Config.py.

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

◆ _itemsInDependencyOrder()

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

Definition at line 975 of file Config.py.

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

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

◆ _okToPlace()

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

Definition at line 652 of file Config.py.

References Config.Process.__isStrict.

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

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

◆ _place()

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

◆ _placeAccelerator()

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

Definition at line 756 of file Config.py.

References Config.Process._place().

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

◆ _placeAlias()

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

Definition at line 727 of file Config.py.

References Config.Process._place().

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

◆ _placeAnalyzer()

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

Definition at line 689 of file Config.py.

References Config.Process._place().

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

◆ _placeConditionalTask()

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

Definition at line 724 of file Config.py.

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

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

◆ _placeEndPath()

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

Definition at line 698 of file Config.py.

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

698  def _placeEndPath(self,name,mod):
699  self._validateSequence(mod, name)
700  try:
701  self._place(name, mod, self.__endpaths)
702  except ModuleCloneError as msg:
703  context = format_outerframe(4)
704  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,
  mod 
)
private

Definition at line 717 of file Config.py.

References Config.Process._place().

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

◆ _placeESProducer()

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

Definition at line 715 of file Config.py.

References Config.Process._place().

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

◆ _placeESSource()

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

Definition at line 719 of file Config.py.

References Config.Process._place().

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

◆ _placeFilter()

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

Definition at line 687 of file Config.py.

References Config.Process._place().

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

◆ _placeFinalPath()

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

Definition at line 705 of file Config.py.

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

705  def _placeFinalPath(self,name,mod):
706  self._validateSequence(mod, name)
707  try:
708  self._place(name, mod, self.__finalpaths)
709  except ModuleCloneError as msg:
710  context = format_outerframe(4)
711  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,
  mod 
)
private

Definition at line 741 of file Config.py.

Referenced by Config.Process.setLooper_().

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

◆ _placeOutputModule()

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

Definition at line 681 of file Config.py.

References Config.Process._place().

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

◆ _placePath()

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

Definition at line 691 of file Config.py.

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

691  def _placePath(self,name,mod):
692  self._validateSequence(mod, name)
693  try:
694  self._place(name, mod, self.__paths)
695  except ModuleCloneError as msg:
696  context = format_outerframe(4)
697  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,
  mod 
)
private

Definition at line 683 of file Config.py.

References Config.Process._place().

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

◆ _placePSet()

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

Definition at line 729 of file Config.py.

References Config.Process._place().

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

◆ _placeSequence()

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

Definition at line 712 of file Config.py.

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

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

◆ _placeService()

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

Definition at line 751 of file Config.py.

References Config.Process._place().

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

◆ _placeSource()

def Config.Process._placeSource (   self,
  name,
  mod 
)
private
Allow the source to be referenced by 'source' or by type name

Definition at line 733 of file Config.py.

Referenced by Config.Process.setSource_().

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

◆ _placeSubProcess()

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

Definition at line 746 of file Config.py.

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

◆ _placeSwitchProducer()

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

Definition at line 685 of file Config.py.

References Config.Process._place().

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

◆ _placeTask()

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

Definition at line 721 of file Config.py.

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

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

◆ _placeVPSet()

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

Definition at line 731 of file Config.py.

References Config.Process._place().

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

◆ _pruneModules()

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

Definition at line 1421 of file Config.py.

Referenced by Config.Process.prune().

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

◆ _replaceInConditionalTasks()

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

Definition at line 1182 of file Config.py.

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

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

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

◆ _replaceInSchedule()

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

Definition at line 1186 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__().

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

◆ _replaceInScheduleDirectly()

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

Definition at line 1192 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__().

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

◆ _replaceInSequences()

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

Definition at line 1161 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__().

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

◆ _replaceInTasks()

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

Definition at line 1178 of file Config.py.

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

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

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

◆ _splitPython()

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

Definition at line 1047 of file Config.py.

Referenced by Config.Process.splitPython().

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

◆ _splitPythonList()

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

Definition at line 928 of file Config.py.

Referenced by Config.Process.splitPython().

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

◆ _validateConditionalTask()

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

Definition at line 966 of file Config.py.

Referenced by Config.Process._placeConditionalTask().

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

◆ _validateSequence()

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

Definition at line 949 of file Config.py.

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

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

◆ _validateTask()

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

Definition at line 958 of file Config.py.

Referenced by Config.Process._placeTask().

958  def _validateTask(self, task, label):
959  # See if every module and service has been inserted into the process
960  try:
961  l = set()
962  visitor = NodeNameVisitor(l)
963  task.visit(visitor)
964  except:
965  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 638 of file Config.py.

References Config.Process.__isStrict.

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

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

◆ addSubProcess()

def Config.Process.addSubProcess (   self,
  mod 
)

Definition at line 749 of file Config.py.

References mps_setup.append.

749  def addSubProcess(self,mod):
750  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 372 of file Config.py.

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

372  def aliases_(self):
373  """returns a dict of the aliases that have been added to the Process"""
374  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 182 of file Config.py.

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

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

◆ analyzers_()

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

Definition at line 301 of file Config.py.

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

301  def analyzers_(self):
302  """returns a dict of the analyzers that have been added to the Process"""
303  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 329 of file Config.py.

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

◆ defaultMaxEvents_()

def Config.Process.defaultMaxEvents_ ( )
static

Definition at line 282 of file Config.py.

Referenced by Config.Process.__updateMaxEvents().

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

◆ defaultMaxLuminosityBlocks_()

def Config.Process.defaultMaxLuminosityBlocks_ ( )
static

Definition at line 295 of file Config.py.

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

◆ defaultOptions_()

def Config.Process.defaultOptions_ ( )
static

Definition at line 241 of file Config.py.

Referenced by Config.Process.__updateOptions().

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

◆ dumpConfig()

def Config.Process.dumpConfig (   self,
  options = PrintOptions() 
)
return a string containing the equivalent process defined using the old configuration language

Definition at line 837 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_, 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_, 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().

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

◆ dumpPython()

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

Definition at line 1053 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_, 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_, 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().

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

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

313  def endpaths_(self):
314  """returns a dict of the endpaths that have been added to the Process"""
315  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 368 of file Config.py.

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

368  def es_prefers_(self):
369  """returns a dict of the es_prefers that have been added to the Process"""
370  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 360 of file Config.py.

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

360  def es_producers_(self):
361  """returns a dict of the esproducers that have been added to the Process"""
362  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 364 of file Config.py.

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

364  def es_sources_(self):
365  """returns a the es_sources that have been added to the Process"""
366  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 763 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 l1ctLayer2EG_cff.id.

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

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

◆ fillProcessDesc()

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

Definition at line 1428 of file Config.py.

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

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

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

◆ filters_()

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

Definition at line 209 of file Config.py.

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

209  def filters_(self):
210  """returns a dict of the filters that have been added to the Process"""
211  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 317 of file Config.py.

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

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

◆ globalReplace()

def Config.Process.globalReplace (   self,
  label,
  new 
)
Replace the item with label 'label' by object 'new' in the process and all sequences/paths/tasks

Definition at line 1197 of file Config.py.

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

◆ handleProcessAccelerators()

def Config.Process.handleProcessAccelerators (   self,
  parameterSet 
)

Definition at line 1523 of file Config.py.

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

◆ isUsingModifier()

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

Definition at line 385 of file Config.py.

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

◆ load()

def Config.Process.load (   self,
  moduleName 
)

Definition at line 759 of file Config.py.

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

759  def load(self, moduleName):
760  moduleName = moduleName.replace("/",".")
761  module = __import__(moduleName)
762  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 234 of file Config.py.

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

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

◆ name_()

def Config.Process.name_ (   self)

Definition at line 213 of file Config.py.

213  def name_(self):
214  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 305 of file Config.py.

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

305  def outputModules_(self):
306  """returns a dict of the output modules that have been added to the Process"""
307  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 188 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_, Config.Process.paths_(), and FastTimerService::PlotsPerProcess.paths_.

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

◆ paths_()

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

Definition at line 309 of file Config.py.

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

309  def paths_(self):
310  """returns a dict of the paths that have been added to the Process"""
311  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 1588 of file Config.py.

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

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

◆ processAccelerators_()

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

Definition at line 356 of file Config.py.

Referenced by Config.Process.dumpPython().

356  def processAccelerators_(self):
357  """returns a dict of the ProcessAccelerators that have been added to the Process"""
358  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 176 of file Config.py.

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

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

◆ producers_()

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

Definition at line 220 of file Config.py.

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

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

◆ prune()

def Config.Process.prune (   self,
  verbose = False,
  keepUnresolvedSequencePlaceholders = False 
)
Remove clutter from the process that we think is unnecessary:
tracked PSets, VPSets and unused modules and sequences. If a Schedule has been set, then Paths and EndPaths
not in the schedule will also be removed, along with an modules and sequences used only by
those removed Paths and EndPaths. The keepUnresolvedSequencePlaceholders keeps also unresolved TaskPlaceholders.

Definition at line 1350 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().

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

◆ psets_()

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

Definition at line 376 of file Config.py.

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

◆ resolve()

def Config.Process.resolve (   self,
  keepUnresolvedSequencePlaceholders = False 
)

Definition at line 1339 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().

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

◆ 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 333 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().

333  def schedule_(self):
334  """returns the schedule that has been added to the Process or None if none have been added"""
335  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 321 of file Config.py.

Referenced by Config.Process.dumpConfig().

321  def sequences_(self):
322  """returns a dict of the sequences that have been added to the Process"""
323  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 352 of file Config.py.

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

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

◆ setLooper_()

def Config.Process.setLooper_ (   self,
  lpr 
)

Definition at line 237 of file Config.py.

References Config.Process._placeLooper().

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

◆ setName_()

def Config.Process.setName_ (   self,
  name 
)

Definition at line 215 of file Config.py.

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

◆ setPartialSchedule_()

def Config.Process.setPartialSchedule_ (   self,
  sch,
  label 
)

Definition at line 336 of file Config.py.

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

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

◆ setSchedule_()

def Config.Process.setSchedule_ (   self,
  sch 
)

Definition at line 341 of file Config.py.

References str.

Referenced by Config.Process.setPartialSchedule_().

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

◆ setSource_()

def Config.Process.setSource_ (   self,
  src 
)

Definition at line 231 of file Config.py.

References Config.Process._placeSource().

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

◆ setStrict()

def Config.Process.setStrict (   self,
  value 
)

Definition at line 171 of file Config.py.

References Config.Process.__isStrict.

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

◆ 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 228 of file Config.py.

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

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

◆ splitPython()

def Config.Process.splitPython (   self,
  options = PrintOptions() 
)
return a map of file names to python configuration fragments

Definition at line 1090 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_, 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_, 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.

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

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

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

◆ switchProducerNames()

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

Definition at line 179 of file Config.py.

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

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

◆ switchProducers_()

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

Definition at line 224 of file Config.py.

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

224  def switchProducers_(self):
225  """returns a dict of the SwitchProducers that have been added to the Process"""
226  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 325 of file Config.py.

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

◆ validate()

def Config.Process.validate (   self)

Definition at line 1516 of file Config.py.

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

◆ vpsets_()

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

Definition at line 380 of file Config.py.

Referenced by Config.Process.prune().

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

Member Data Documentation

◆ __isStrict

Config.Process.__isStrict
private

◆ __ppset

Config.Process.__ppset
private

Definition at line 1443 of file Config.py.

◆ __process

Config.Process.__process
private

◆ __processPSet

Config.Process.__processPSet
private

Definition at line 1433 of file Config.py.

◆ __thelist

Config.Process.__thelist
private

Definition at line 1432 of file Config.py.

◆ _firstProcess

Config.Process._firstProcess
staticprivate

Definition at line 115 of file Config.py.

◆ maxLuminosityBlocks

Config.Process.maxLuminosityBlocks

Definition at line 155 of file Config.py.

◆ MessageLogger

Config.Process.MessageLogger

Definition at line 160 of file Config.py.

Property Documentation

◆ aliases

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

Definition at line 375 of file Config.py.

◆ analyzers

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

Definition at line 304 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 371 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 363 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 367 of file Config.py.

◆ filters

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

Definition at line 212 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 239 of file Config.py.

◆ outputModules

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

Definition at line 308 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 359 of file Config.py.

◆ producers

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

Definition at line 223 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 300 of file Config.py.

◆ switchProducers

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

Definition at line 227 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