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

 maxEvents
 
 maxLuminosityBlocks
 
 MessageLogger
 
 options
 

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 __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 102 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 105 of file Config.py.

Referenced by Config.Process.fillProcessDesc().

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

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

586  def __delattr__(self,name):
587  self._delHelper(name)
588  obj = getattr(self,name)
589  if not obj is None:
590  if not isinstance(obj, Sequence) and not isinstance(obj, Task) and not isinstance(obj,ConditionalTask):
591  # For modules, ES modules and services we can also remove
592  # the deleted object from Sequences, Paths, EndPaths, and
593  # Tasks. Note that for Sequences and Tasks that cannot be done
594  # reliably as the places where the Sequence or Task was used
595  # might have been expanded so we do not even try. We considered
596  # raising an exception if a Sequences or Task was explicitly
597  # deleted, but did not because when done carefully deletion
598  # is sometimes OK (for example in the prune function where it
599  # has been checked that the deleted Sequence is not used).
600  if obj._isTaskComponent():
601  self._replaceInTasks(name, None)
602  self._replaceInConditionalTasks(name, None)
603  self._replaceInSchedule(name, None)
604  if isinstance(obj, _Sequenceable) or obj._isTaskComponent():
605  self._replaceInSequences(name, None)
606  if Schedule._itemIsValid(obj) or isinstance(obj, Task):
607  self._replaceInScheduleDirectly(name, None)
608  # now remove it from the process itself
609  try:
610  del self.__dict__[name]
611  except:
612  pass
613 

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

Referenced by Config.Process.__setattr__().

556  def __findFirstUsingModule(self, seqsOrTasks, mod):
557  """Given a container of sequences or tasks, find the first sequence or task
558  containing mod and return it. If none is found, return None"""
559  from FWCore.ParameterSet.SequenceTypes import ModuleNodeVisitor
560  l = list()
561  for seqOrTask in seqsOrTasks.values():
562  l[:] = []
563  v = ModuleNodeVisitor(l)
564  seqOrTask.visit(v)
565  if mod in l:
566  return seqOrTask
567  return None
568 

◆ __setattr__()

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

Definition at line 409 of file Config.py.

References Config.Process.__findFirstUsingModule(), Config.Process.__isStrict, Config.Process.__setObjectLabel(), 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, l1ctLayer2EG_cff.id, Config.Process.paths, Config.Process.sequences, str, and Config.Process.tasks.

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

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

◆ __setObjectLabel()

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

Definition at line 382 of file Config.py.

References l1ctLayer2EG_cff.id, and str.

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

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

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

181  def __setstate__(self, pkldict):
182  """
183  Unpickling hook.
184 
185  Since cloneToObjectDict stores a hash of objects by their
186  id() it needs to be updated when unpickling to use the
187  new object id values instantiated during the unpickle.
188 
189  """
190  self.__dict__.update(pkldict)
191  tmpDict = {}
192  for value in self._cloneToObjectDict.values():
193  tmpDict[id(value)] = value
194  self.__dict__['_cloneToObjectDict'] = tmpDict
195 
196 
197 
#define update(a, b)

◆ __updateMaxEvents()

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

Definition at line 274 of file Config.py.

References Config.Process.defaultMaxEvents_().

Referenced by Config.Process.__setattr__().

274  def __updateMaxEvents(self,ps):
275  newMax = self.defaultMaxEvents_()
276  if isinstance(ps,dict):
277  for k,v in ps.items():
278  setattr(newMax,k,v)
279  else:
280  for p in ps.parameters_():
281  setattr(newMax, p, getattr(ps,p))
282  return newMax

◆ __updateOptions()

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

Definition at line 261 of file Config.py.

References Config.Process.defaultOptions_().

Referenced by Config.Process.__setattr__().

261  def __updateOptions(self,opt):
262  newOpts = self.defaultOptions_()
263  if isinstance(opt,dict):
264  for k,v in opt.items():
265  setattr(newOpts,k,v)
266  else:
267  for p in opt.parameters_():
268  setattr(newOpts, p, getattr(opt,p))
269  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 614 of file Config.py.

References Config.Process._delHelper().

Referenced by Config.Process.__setattr__().

614  def _delattrFromSetattr(self,name):
615  """Similar to __delattr__ but we need different behavior when called from __setattr__"""
616  self._delHelper(name)
617  # now remove it from the process itself
618  try:
619  del self.__dict__[name]
620  except:
621  pass
622 

◆ _delHelper()

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

Definition at line 569 of file Config.py.

References contentValuesCheck.values.

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

569  def _delHelper(self,name):
570  if not hasattr(self,name):
571  raise KeyError('process does not know about '+name)
572  elif name.startswith('_Process__'):
573  raise ValueError('this attribute cannot be deleted')
574 
575  # we have to remove it from all dictionaries/registries
576  dicts = [item for item in self.__dict__.values() if (isinstance(item, dict) or isinstance(item, DictTypes.SortedKeysDict))]
577  for reg in dicts:
578  if name in reg: del reg[name]
579  # if it was a labelable object, the label needs to be removed
580  obj = getattr(self,name)
581  if isinstance(obj,_Labelable):
582  obj.setLabel(None)
583  if isinstance(obj,Service):
584  obj._inProcess = False
585 

◆ _dumpConfigESPrefers()

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

Definition at line 891 of file Config.py.

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

Referenced by Config.Process.dumpConfig().

891  def _dumpConfigESPrefers(self, options):
892  result = ''
893  for item in self.es_prefers_().values():
894  result +=options.indentation()+'es_prefer '+item.targetLabel_()+' = '+item.dumpConfig(options)
895  return result
896 

◆ _dumpConfigNamedList()

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

Definition at line 802 of file Config.py.

Referenced by Config.Process.dumpConfig().

802  def _dumpConfigNamedList(self,items,typeName,options):
803  returnValue = ''
804  for name,item in items:
805  returnValue +=options.indentation()+typeName+' '+name+' = '+item.dumpConfig(options)
806  return returnValue
807 

◆ _dumpConfigOptionallyNamedList()

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

Definition at line 814 of file Config.py.

Referenced by Config.Process.dumpConfig().

814  def _dumpConfigOptionallyNamedList(self,items,typeName,options):
815  returnValue = ''
816  for name,item in items:
817  if name == item.type_():
818  name = ''
819  returnValue +=options.indentation()+typeName+' '+name+' = '+item.dumpConfig(options)
820  return returnValue
821 

◆ _dumpConfigUnnamedList()

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

Definition at line 808 of file Config.py.

Referenced by Config.Process.dumpConfig().

808  def _dumpConfigUnnamedList(self,items,typeName,options):
809  returnValue = ''
810  for name,item in items:
811  returnValue +=options.indentation()+typeName+' = '+item.dumpConfig(options)
812  return returnValue
813 

◆ _dumpPython()

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

Definition at line 1026 of file Config.py.

Referenced by Config.Process.dumpPython().

1026  def _dumpPython(self, d, options):
1027  result = ''
1028  for name, value in sorted(d.items()):
1029  result += value.dumpPythonAs(name,options)+'\n'
1030  return result
1031 

◆ _dumpPythonList()

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

Definition at line 903 of file Config.py.

Referenced by Config.Process.dumpPython().

903  def _dumpPythonList(self, d, options):
904  returnValue = ''
905  if isinstance(d, DictTypes.SortedKeysDict):
906  for name,item in d.items():
907  returnValue +='process.'+name+' = '+item.dumpPython(options)+'\n\n'
908  else:
909  for name,item in sorted(d.items()):
910  returnValue +='process.'+name+' = '+item.dumpPython(options)+'\n\n'
911  return returnValue
912 

◆ _dumpPythonSubProcesses()

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

Definition at line 897 of file Config.py.

Referenced by Config.Process.dumpPython().

897  def _dumpPythonSubProcesses(self, l, options):
898  returnValue = ''
899  for item in l:
900  returnValue += item.dumpPython(options)+'\n\n'
901  return returnValue
902 

◆ _findPreferred()

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

Definition at line 1571 of file Config.py.

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

Referenced by Config.Process.prefer().

1571  def _findPreferred(self, esname, d,*args,**kargs):
1572  # is esname a name in the dictionary?
1573  if esname in d:
1574  typ = d[esname].type_()
1575  if typ == esname:
1576  self.__setattr__( esname+"_prefer", ESPrefer(typ,*args,**kargs) )
1577  else:
1578  self.__setattr__( esname+"_prefer", ESPrefer(typ, esname,*args,**kargs) )
1579  return True
1580  else:
1581  # maybe it's an unnamed ESModule?
1582  found = False
1583  for name, value in d.items():
1584  if value.type_() == esname:
1585  if found:
1586  raise RuntimeError("More than one ES module for "+esname)
1587  found = True
1588  self.__setattr__(esname+"_prefer", ESPrefer(d[esname].type_()) )
1589  return found
1590 
1591 

◆ _insertInto()

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

Definition at line 1187 of file Config.py.

1187  def _insertInto(self, parameterSet, itemDict):
1188  for name,value in itemDict.items():
1189  value.insertInto(parameterSet, name)

◆ _insertManyInto()

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

Definition at line 1197 of file Config.py.

1197  def _insertManyInto(self, parameterSet, label, itemDict, tracked):
1198  l = []
1199  for name,value in itemDict.items():
1200  value.appendToProcessDescList_(l, name)
1201  value.insertInto(parameterSet, name)
1202  # alphabetical order is easier to compare with old language
1203  l.sort()
1204  parameterSet.addVString(tracked, label, l)

◆ _insertOneInto()

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

Definition at line 1190 of file Config.py.

1190  def _insertOneInto(self, parameterSet, label, item, tracked):
1191  vitems = []
1192  if not item == None:
1193  newlabel = item.nameInProcessDesc_(label)
1194  vitems = [newlabel]
1195  item.insertInto(parameterSet, newlabel)
1196  parameterSet.addVString(tracked, label, vitems)

◆ _insertPaths()

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

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

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

◆ _insertSubProcessesInto()

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

Definition at line 1216 of file Config.py.

1216  def _insertSubProcessesInto(self, parameterSet, label, itemList, tracked):
1217  l = []
1218  subprocs = []
1219  for value in itemList:
1220  name = value.getProcessName()
1221  newLabel = value.nameInProcessDesc_(name)
1222  l.append(newLabel)
1223  pset = value.getSubProcessPSet(parameterSet)
1224  subprocs.append(pset)
1225  # alphabetical order is easier to compare with old language
1226  l.sort()
1227  parameterSet.addVString(tracked, label, l)
1228  parameterSet.addVPSet(False,"subProcesses",subprocs)

◆ _insertSwitchProducersInto()

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

Definition at line 1205 of file Config.py.

1205  def _insertSwitchProducersInto(self, parameterSet, labelModules, labelAliases, itemDict, tracked):
1206  modules = parameterSet.getVString(tracked, labelModules)
1207  aliases = parameterSet.getVString(tracked, labelAliases)
1208  accelerators = parameterSet.getVString(False, "@selected_accelerators")
1209  for name,value in itemDict.items():
1210  value.appendToProcessDescLists_(modules, aliases, name)
1211  value.insertInto(parameterSet, name, accelerators)
1212  modules.sort()
1213  aliases.sort()
1214  parameterSet.addVString(tracked, labelModules, modules)
1215  parameterSet.addVString(tracked, labelAliases, aliases)

◆ _itemsInDependencyOrder()

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

Definition at line 960 of file Config.py.

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

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

◆ _okToPlace()

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

Definition at line 637 of file Config.py.

References Config.Process.__isStrict.

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

637  def _okToPlace(self, name, mod, d):
638  if not self.__InExtendCall:
639  # if going
640  return True
641  elif not self.__isStrict:
642  return True
643  elif name in d:
644  # if there's an old copy, and the new one
645  # hasn't been modified, we're done. Still
646  # not quite safe if something has been defined twice.
647  # Need to add checks
648  if mod._isModified:
649  if d[name]._isModified:
650  return False
651  else:
652  return True
653  else:
654  return True
655  else:
656  return True
657 

◆ _place()

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

◆ _placeAccelerator()

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

Definition at line 741 of file Config.py.

References Config.Process._place().

741  def _placeAccelerator(self,typeName,mod):
742  self._place(typeName, mod, self.__accelerators)
743  self.__dict__[typeName]=mod

◆ _placeAlias()

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

Definition at line 712 of file Config.py.

References Config.Process._place().

712  def _placeAlias(self,name,mod):
713  self._place(name, mod, self.__aliases)

◆ _placeAnalyzer()

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

Definition at line 674 of file Config.py.

References Config.Process._place().

674  def _placeAnalyzer(self,name,mod):
675  self._place(name, mod, self.__analyzers)

◆ _placeConditionalTask()

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

Definition at line 709 of file Config.py.

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

709  def _placeConditionalTask(self,name,task):
710  self._validateConditionalTask(task, name)
711  self._place(name, task, self.__conditionaltasks)

◆ _placeEndPath()

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

Definition at line 683 of file Config.py.

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

683  def _placeEndPath(self,name,mod):
684  self._validateSequence(mod, name)
685  try:
686  self._place(name, mod, self.__endpaths)
687  except ModuleCloneError as msg:
688  context = format_outerframe(4)
689  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 702 of file Config.py.

References Config.Process._place().

702  def _placeESPrefer(self,name,mod):
703  self._place(name, mod, self.__esprefers)

◆ _placeESProducer()

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

Definition at line 700 of file Config.py.

References Config.Process._place().

700  def _placeESProducer(self,name,mod):
701  self._place(name, mod, self.__esproducers)

◆ _placeESSource()

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

Definition at line 704 of file Config.py.

References Config.Process._place().

704  def _placeESSource(self,name,mod):
705  self._place(name, mod, self.__essources)

◆ _placeFilter()

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

Definition at line 672 of file Config.py.

References Config.Process._place().

672  def _placeFilter(self,name,mod):
673  self._place(name, mod, self.__filters)

◆ _placeFinalPath()

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

Definition at line 690 of file Config.py.

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

690  def _placeFinalPath(self,name,mod):
691  self._validateSequence(mod, name)
692  try:
693  self._place(name, mod, self.__finalpaths)
694  except ModuleCloneError as msg:
695  context = format_outerframe(4)
696  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 726 of file Config.py.

Referenced by Config.Process.setLooper_().

726  def _placeLooper(self,name,mod):
727  if name != 'looper':
728  raise ValueError("The label '"+name+"' can not be used for a Looper. Only 'looper' is allowed.")
729  self.__dict__['_Process__looper'] = mod
730  self.__dict__[mod.type_()] = mod

◆ _placeOutputModule()

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

Definition at line 666 of file Config.py.

References Config.Process._place().

666  def _placeOutputModule(self,name,mod):
667  self._place(name, mod, self.__outputmodules)

◆ _placePath()

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

Definition at line 676 of file Config.py.

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

676  def _placePath(self,name,mod):
677  self._validateSequence(mod, name)
678  try:
679  self._place(name, mod, self.__paths)
680  except ModuleCloneError as msg:
681  context = format_outerframe(4)
682  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 668 of file Config.py.

References Config.Process._place().

668  def _placeProducer(self,name,mod):
669  self._place(name, mod, self.__producers)

◆ _placePSet()

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

Definition at line 714 of file Config.py.

References Config.Process._place().

714  def _placePSet(self,name,mod):
715  self._place(name, mod, self.__psets)

◆ _placeSequence()

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

Definition at line 697 of file Config.py.

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

697  def _placeSequence(self,name,mod):
698  self._validateSequence(mod, name)
699  self._place(name, mod, self.__sequences)

◆ _placeService()

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

Definition at line 736 of file Config.py.

References Config.Process._place().

736  def _placeService(self,typeName,mod):
737  self._place(typeName, mod, self.__services)
738  if typeName in self.__dict__:
739  self.__dict__[typeName]._inProcess = False
740  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 718 of file Config.py.

Referenced by Config.Process.setSource_().

718  def _placeSource(self,name,mod):
719  """Allow the source to be referenced by 'source' or by type name"""
720  if name != 'source':
721  raise ValueError("The label '"+name+"' can not be used for a Source. Only 'source' is allowed.")
722  if self.__dict__['_Process__source'] is not None :
723  del self.__dict__[self.__dict__['_Process__source'].type_()]
724  self.__dict__['_Process__source'] = mod
725  self.__dict__[mod.type_()] = mod

◆ _placeSubProcess()

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

Definition at line 731 of file Config.py.

731  def _placeSubProcess(self,name,mod):
732  self.__dict__['_Process__subProcess'] = mod
733  self.__dict__[mod.type_()] = mod

◆ _placeSwitchProducer()

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

Definition at line 670 of file Config.py.

References Config.Process._place().

670  def _placeSwitchProducer(self,name,mod):
671  self._place(name, mod, self.__switchproducers)

◆ _placeTask()

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

Definition at line 706 of file Config.py.

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

706  def _placeTask(self,name,task):
707  self._validateTask(task, name)
708  self._place(name, task, self.__tasks)

◆ _placeVPSet()

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

Definition at line 716 of file Config.py.

References Config.Process._place().

716  def _placeVPSet(self,name,mod):
717  self._place(name, mod, self.__vpsets)

◆ _pruneModules()

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

Definition at line 1407 of file Config.py.

Referenced by Config.Process.prune().

1407  def _pruneModules(self, d, scheduledNames):
1408  moduleNames = set(d.keys())
1409  junk = moduleNames - scheduledNames
1410  for name in junk:
1411  delattr(self, name)
1412  return junk
1413 

◆ _replaceInConditionalTasks()

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

Definition at line 1167 of file Config.py.

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

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

1167  def _replaceInConditionalTasks(self, label, new):
1168  old = getattr(self,label)
1169  for task in self.conditionaltasks.values():
1170  task.replace(old, new)

◆ _replaceInSchedule()

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

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

1171  def _replaceInSchedule(self, label, new):
1172  if self.schedule_() == None:
1173  return
1174  old = getattr(self,label)
1175  for task in self.schedule_()._tasks:
1176  task.replace(old, new)

◆ _replaceInScheduleDirectly()

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

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

1177  def _replaceInScheduleDirectly(self, label, new):
1178  if self.schedule_() == None:
1179  return
1180  old = getattr(self,label)
1181  self.schedule_()._replaceIfHeldDirectly(old, new)

◆ _replaceInSequences()

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

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

1146  def _replaceInSequences(self, label, new):
1147  old = getattr(self,label)
1148  #TODO - replace by iterator concatenation
1149  #to ovoid dependency problems between sequences, first modify
1150  # process known sequences to do a non-recursive change. Then do
1151  # a recursive change to get cases where a sub-sequence unknown to
1152  # the process has the item to be replaced
1153  for sequenceable in self.sequences.values():
1154  sequenceable._replaceIfHeldDirectly(old,new)
1155  for sequenceable in self.sequences.values():
1156  sequenceable.replace(old,new)
1157  for sequenceable in self.paths.values():
1158  sequenceable.replace(old,new)
1159  for sequenceable in self.endpaths.values():
1160  sequenceable.replace(old,new)
1161  for sequenceable in self.finalpaths.values():
1162  sequenceable.replace(old,new)

◆ _replaceInTasks()

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

Definition at line 1163 of file Config.py.

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

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

1163  def _replaceInTasks(self, label, new):
1164  old = getattr(self,label)
1165  for task in self.tasks.values():
1166  task.replace(old, new)

◆ _splitPython()

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

Definition at line 1032 of file Config.py.

Referenced by Config.Process.splitPython().

1032  def _splitPython(self, subfolder, d, options):
1033  result = {}
1034  for name, value in sorted(d.items()):
1035  result[name] = subfolder, value.dumpPythonAs(name, options) + '\n'
1036  return result
1037 

◆ _splitPythonList()

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

Definition at line 913 of file Config.py.

Referenced by Config.Process.splitPython().

913  def _splitPythonList(self, subfolder, d, options):
914  parts = DictTypes.SortedKeysDict()
915  for name, item in d.items() if isinstance(d, DictTypes.SortedKeysDict) else sorted(d.items()):
916  code = ''
917  dependencies = item.directDependencies()
918  for module_subfolder, module in dependencies:
919  module = module + '_cfi'
920  if options.useSubdirectories and module_subfolder:
921  module = module_subfolder + '.' + module
922  if options.targetDirectory is not None:
923  if options.useSubdirectories and subfolder:
924  module = '..' + module
925  else:
926  module = '.' + module
927  code += 'from ' + module + ' import *\n'
928  if dependencies:
929  code += '\n'
930  code += name + ' = ' + item.dumpPython(options)
931  parts[name] = subfolder, code
932  return parts
933 

◆ _validateConditionalTask()

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

Definition at line 951 of file Config.py.

Referenced by Config.Process._placeConditionalTask().

951  def _validateConditionalTask(self, task, label):
952  # See if every module and service has been inserted into the process
953  try:
954  l = set()
955  visitor = NodeNameVisitor(l)
956  task.visit(visitor)
957  except:
958  raise RuntimeError("An entry in task " + label + ' has not been attached to the process')
959 

◆ _validateSequence()

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

Definition at line 934 of file Config.py.

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

934  def _validateSequence(self, sequence, label):
935  # See if every module has been inserted into the process
936  try:
937  l = set()
938  visitor = NodeNameVisitor(l)
939  sequence.visit(visitor)
940  except Exception as e:
941  raise RuntimeError("An entry in sequence {} has no label\n Seen entries: {}\n Error: {}".format(label, l, e))
942 

◆ _validateTask()

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

Definition at line 943 of file Config.py.

Referenced by Config.Process._placeTask().

943  def _validateTask(self, task, label):
944  # See if every module and service has been inserted into the process
945  try:
946  l = set()
947  visitor = NodeNameVisitor(l)
948  task.visit(visitor)
949  except:
950  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 623 of file Config.py.

References Config.Process.__isStrict.

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

623  def add_(self,value):
624  """Allows addition of components that do not have to have a label, e.g. Services"""
625  if not isinstance(value,_ConfigureComponent):
626  raise TypeError
627  if not isinstance(value,_Unlabelable):
628  raise TypeError
629  #clone the item
630  if self.__isStrict:
631  newValue =value.copy()
632  value.setIsFrozen()
633  else:
634  newValue =value
635  newValue._place('',self)
636 

◆ addSubProcess()

def Config.Process.addSubProcess (   self,
  mod 
)

Definition at line 734 of file Config.py.

References mps_setup.append.

734  def addSubProcess(self,mod):
735  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 361 of file Config.py.

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

361  def aliases_(self):
362  """returns a dict of the aliases that have been added to the Process"""
363  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 171 of file Config.py.

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

171  def analyzerNames(self):
172  """Returns a string containing all the EDAnalyzer labels separated by a blank"""
173  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 290 of file Config.py.

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

290  def analyzers_(self):
291  """returns a dict of the analyzers that have been added to the Process"""
292  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 318 of file Config.py.

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

◆ defaultMaxEvents_()

def Config.Process.defaultMaxEvents_ ( )
static

Definition at line 271 of file Config.py.

Referenced by Config.Process.__updateMaxEvents().

271  def defaultMaxEvents_():
272  return untracked.PSet(input=optional.untracked.int32,
273  output=optional.untracked.allowed(int32,PSet))

◆ defaultMaxLuminosityBlocks_()

def Config.Process.defaultMaxLuminosityBlocks_ ( )
static

Definition at line 284 of file Config.py.

284  def defaultMaxLuminosityBlocks_():
285  return untracked.PSet(input=untracked.int32(-1))

◆ defaultOptions_()

def Config.Process.defaultOptions_ ( )
static

Definition at line 230 of file Config.py.

Referenced by Config.Process.__updateOptions().

230  def defaultOptions_():
231  return untracked.PSet(numberOfThreads = untracked.uint32(1),
232  numberOfStreams = untracked.uint32(0),
233  numberOfConcurrentRuns = untracked.uint32(1),
234  numberOfConcurrentLuminosityBlocks = untracked.uint32(0),
235  eventSetup = untracked.PSet(
236  numberOfConcurrentIOVs = untracked.uint32(0),
237  forceNumberOfConcurrentIOVs = untracked.PSet(
238  allowAnyLabel_ = required.untracked.uint32
239  )
240  ),
241  accelerators = untracked.vstring('*'),
242  wantSummary = untracked.bool(False),
243  fileMode = untracked.string('FULLMERGE'),
244  forceEventSetupCacheClearOnNewRun = untracked.bool(False),
245  throwIfIllegalParameter = untracked.bool(True),
246  printDependencies = untracked.bool(False),
247  deleteNonConsumedUnscheduledModules = untracked.bool(True),
248  sizeOfStackForThreadsInKB = optional.untracked.uint32,
249  Rethrow = untracked.vstring(),
250  SkipEvent = untracked.vstring(),
251  FailPath = untracked.vstring(),
252  IgnoreCompletely = untracked.vstring(),
253  canDeleteEarly = untracked.vstring(),
254  holdsReferencesToDeleteEarly = untracked.VPSet(),
255  modulesToIgnoreForDeleteEarly = untracked.vstring(),
256  dumpOptions = untracked.bool(False),
257  allowUnscheduled = obsolete.untracked.bool,
258  emptyRunLumiMode = obsolete.untracked.string,
259  makeTriggerResults = obsolete.untracked.bool,
260  )

◆ dumpConfig()

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

Definition at line 822 of file Config.py.

References dataset.Dataset.__name, genericValidation.ValidationWithPlotsSummaryBase.SummaryItem.__name, 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_, SiStripFedCablingBuilderFromDb.source_, TestPortableAnalyzer.source_, jsoncollector::DataPoint.source_, TestAlpakaAnalyzer.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_, Config.Process.subProcesses_(), edm::SubProcess.subProcesses_, edm::EventProcessor.subProcesses_, Config.Process.switchProducers_(), and Config.Process.vpsets.

Referenced by Types.SecSource.configValue().

822  def dumpConfig(self, options=PrintOptions()):
823  """return a string containing the equivalent process defined using the old configuration language"""
824  config = "process "+self.__name+" = {\n"
825  options.indent()
826  if self.source_():
827  config += options.indentation()+"source = "+self.source_().dumpConfig(options)
828  if self.looper_():
829  config += options.indentation()+"looper = "+self.looper_().dumpConfig(options)
830 
831  config+=self._dumpConfigNamedList(self.subProcesses_(),
832  'subProcess',
833  options)
834  config+=self._dumpConfigNamedList(self.producers_().items(),
835  'module',
836  options)
837  config+=self._dumpConfigNamedList(self.switchProducers_().items(),
838  'module',
839  options)
840  config+=self._dumpConfigNamedList(self.filters_().items(),
841  'module',
842  options)
843  config+=self._dumpConfigNamedList(self.analyzers_().items(),
844  'module',
845  options)
846  config+=self._dumpConfigNamedList(self.outputModules_().items(),
847  'module',
848  options)
849  config+=self._dumpConfigNamedList(self.sequences_().items(),
850  'sequence',
851  options)
852  config+=self._dumpConfigNamedList(self.paths_().items(),
853  'path',
854  options)
855  config+=self._dumpConfigNamedList(self.endpaths_().items(),
856  'endpath',
857  options)
858  config+=self._dumpConfigNamedList(self.finalpaths_().items(),
859  'finalpath',
860  options)
861  config+=self._dumpConfigUnnamedList(self.services_().items(),
862  'service',
863  options)
864  config+=self._dumpConfigNamedList(self.aliases_().items(),
865  'alias',
866  options)
867  config+=self._dumpConfigOptionallyNamedList(
868  self.es_producers_().items(),
869  'es_module',
870  options)
871  config+=self._dumpConfigOptionallyNamedList(
872  self.es_sources_().items(),
873  'es_source',
874  options)
875  config += self._dumpConfigESPrefers(options)
876  for name,item in self.psets.items():
877  config +=options.indentation()+item.configTypeName()+' '+name+' = '+item.configValue(options)
878  for name,item in self.vpsets.items():
879  config +=options.indentation()+'VPSet '+name+' = '+item.configValue(options)
880  if self.schedule:
881  pathNames = [p.label_() for p in self.schedule]
882  config +=options.indentation()+'schedule = {'+','.join(pathNames)+'}\n'
883 
884 # config+=self._dumpConfigNamedList(self.vpsets.items(),
885 # 'VPSet',
886 # options)
887  config += "}\n"
888  options.unindent()
889  return config
890 
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 1038 of file Config.py.

References dataset.Dataset.__name, genericValidation.ValidationWithPlotsSummaryBase.SummaryItem.__name, 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_, Config.Process.schedule_(), edm::EventProcessor.schedule_, edm::test::TestProcessor.schedule_, Config.Process.sequences, edm::ProcessDesc.services_, Config.Process.services_(), ecaldqm::DBWriterWorker.source_, HGCalTestPartialWaferRecHits.source_, L2MuonSeedGeneratorFromL1TkMu.source_, SiStripFedCablingBuilderFromDb.source_, TestPortableAnalyzer.source_, jsoncollector::DataPoint.source_, TestAlpakaAnalyzer.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_, Config.Process.subProcesses_(), edm::SubProcess.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().

1038  def dumpPython(self, options=PrintOptions()):
1039  """return a string containing the equivalent process defined using python"""
1040  specialImportRegistry._reset()
1041  header = "import FWCore.ParameterSet.Config as cms"
1042  result = "process = cms.Process(\""+self.__name+"\")\n\n"
1043  if self.source_():
1044  result += "process.source = "+self.source_().dumpPython(options)
1045  if self.looper_():
1046  result += "process.looper = "+self.looper_().dumpPython()
1047  result+=self._dumpPythonList(self.psets, options)
1048  result+=self._dumpPythonList(self.vpsets, options)
1049  result+=self._dumpPythonSubProcesses(self.subProcesses_(), options)
1050  result+=self._dumpPythonList(self.producers_(), options)
1051  result+=self._dumpPythonList(self.switchProducers_(), options)
1052  result+=self._dumpPythonList(self.filters_() , options)
1053  result+=self._dumpPythonList(self.analyzers_(), options)
1054  result+=self._dumpPythonList(self.outputModules_(), options)
1055  result+=self._dumpPythonList(self.services_(), options)
1056  result+=self._dumpPythonList(self.processAccelerators_(), options)
1057  result+=self._dumpPythonList(self.es_producers_(), options)
1058  result+=self._dumpPythonList(self.es_sources_(), options)
1059  result+=self._dumpPython(self.es_prefers_(), options)
1060  result+=self._dumpPythonList(self._itemsInDependencyOrder(self.tasks), options)
1061  result+=self._dumpPythonList(self._itemsInDependencyOrder(self.conditionaltasks), options)
1062  result+=self._dumpPythonList(self._itemsInDependencyOrder(self.sequences), options)
1063  result+=self._dumpPythonList(self.paths_(), options)
1064  result+=self._dumpPythonList(self.endpaths_(), options)
1065  result+=self._dumpPythonList(self.finalpaths_(), options)
1066  result+=self._dumpPythonList(self.aliases_(), options)
1067  if not self.schedule_() == None:
1068  result += 'process.schedule = ' + self.schedule.dumpPython(options)
1069  imports = specialImportRegistry.getSpecialImports()
1070  if len(imports) > 0:
1071  header += "\n" + "\n".join(imports)
1072  header += "\n\n"
1073  return header+result
1074 
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 302 of file Config.py.

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

302  def endpaths_(self):
303  """returns a dict of the endpaths that have been added to the Process"""
304  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 357 of file Config.py.

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

357  def es_prefers_(self):
358  """returns a dict of the es_prefers that have been added to the Process"""
359  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 349 of file Config.py.

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

349  def es_producers_(self):
350  """returns a dict of the esproducers that have been added to the Process"""
351  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 353 of file Config.py.

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

353  def es_sources_(self):
354  """returns a the es_sources that have been added to the Process"""
355  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 748 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().

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

◆ fillProcessDesc()

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

Definition at line 1414 of file Config.py.

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

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

174  def filterNames(self):
175  """Returns a string containing all the EDFilter labels separated by a blank"""
176  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 198 of file Config.py.

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

198  def filters_(self):
199  """returns a dict of the filters that have been added to the Process"""
200  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 306 of file Config.py.

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

306  def finalpaths_(self):
307  """returns a dict of the finalpaths that have been added to the Process"""
308  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 1182 of file Config.py.

1182  def globalReplace(self,label,new):
1183  """ Replace the item with label 'label' by object 'new' in the process and all sequences/paths/tasks"""
1184  if not hasattr(self,label):
1185  raise LookupError("process has no item of label "+label)
1186  setattr(self,label,new)

◆ handleProcessAccelerators()

def Config.Process.handleProcessAccelerators (   self,
  parameterSet 
)

Definition at line 1501 of file Config.py.

1501  def handleProcessAccelerators(self, parameterSet):
1502  # 'cpu' accelerator is always implicitly there
1503  allAccelerators = set(["cpu"])
1504  availableAccelerators = set(["cpu"])
1505  for acc in self.__dict__['_Process__accelerators'].values():
1506  allAccelerators.update(acc.labels())
1507  availableAccelerators.update(acc.enabledLabels())
1508  availableAccelerators = sorted(list(availableAccelerators))
1509  parameterSet.addVString(False, "@available_accelerators", availableAccelerators)
1510 
1511  # Resolve wildcards
1512  selectedAccelerators = []
1513  if "*" in self.options.accelerators:
1514  if len(self.options.accelerators) >= 2:
1515  raise ValueError("process.options.accelerators may contain '*' only as the only element, now it has {} elements".format(len(self.options.accelerators)))
1516  selectedAccelerators = availableAccelerators
1517  else:
1518  import fnmatch
1519  resolved = set()
1520  invalid = []
1521  for pattern in self.options.accelerators:
1522  acc = [a for a in availableAccelerators if fnmatch.fnmatchcase(a, pattern)]
1523  if len(acc) == 0:
1524  if not any(fnmatch.fnmatchcase(a, pattern) for a in allAccelerators):
1525  invalid.append(pattern)
1526  else:
1527  resolved.update(acc)
1528  # Sanity check
1529  if len(invalid) != 0:
1530  raise ValueError("Invalid pattern{} of {} in process.options.accelerators, valid values are {} or a pattern matching to some of them.".format(
1531  "s" if len(invalid) > 2 else "",
1532  ",".join(invalid),
1533  ",".join(sorted(list(allAccelerators)))))
1534  selectedAccelerators = sorted(list(resolved))
1535  parameterSet.addVString(False, "@selected_accelerators", selectedAccelerators)
1536 
1537  # Customize
1538  wrapped = ProcessForProcessAccelerator(self)
1539  for acc in self.__dict__['_Process__accelerators'].values():
1540  acc.apply(wrapped, selectedAccelerators)
1541 
bool any(const std::vector< T > &v, const T &what)
Definition: ECalSD.cc:37
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 374 of file Config.py.

374  def isUsingModifier(self,mod):
375  """returns True if the Modifier is in used by this Process"""
376  if mod._isChosen():
377  for m in self.__modifiers:
378  if m._isOrContains(mod):
379  return True
380  return False
381 

◆ load()

def Config.Process.load (   self,
  moduleName 
)

Definition at line 744 of file Config.py.

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

744  def load(self, moduleName):
745  moduleName = moduleName.replace("/",".")
746  module = __import__(moduleName)
747  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 223 of file Config.py.

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

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

◆ name_()

def Config.Process.name_ (   self)

Definition at line 202 of file Config.py.

References dataset.Dataset.__name, and genericValidation.ValidationWithPlotsSummaryBase.SummaryItem.__name.

202  def name_(self):
203  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 294 of file Config.py.

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

294  def outputModules_(self):
295  """returns a dict of the output modules that have been added to the Process"""
296  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 177 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_.

177  def pathNames(self):
178  """Returns a string containing all the Path names separated by a blank"""
179  return ' '.join(self.paths_().keys())
180 
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 298 of file Config.py.

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

298  def paths_(self):
299  """returns a dict of the paths that have been added to the Process"""
300  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 1542 of file Config.py.

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

1542  def prefer(self, esmodule,*args,**kargs):
1543  """Prefer this ES source or producer. The argument can
1544  either be an object label, e.g.,
1545  process.prefer(process.juicerProducer) (not supported yet)
1546  or a name of an ESSource or ESProducer
1547  process.prefer("juicer")
1548  or a type of unnamed ESSource or ESProducer
1549  process.prefer("JuicerProducer")
1550  In addition, you can pass as a labelled arguments the name of the Record you wish to
1551  prefer where the type passed is a cms.vstring and that vstring can contain the
1552  name of the C++ types in the Record that are being preferred, e.g.,
1553  #prefer all data in record 'OrangeRecord' from 'juicer'
1554  process.prefer("juicer", OrangeRecord=cms.vstring())
1555  or
1556  #prefer only "Orange" data in "OrangeRecord" from "juicer"
1557  process.prefer("juicer", OrangeRecord=cms.vstring("Orange"))
1558  or
1559  #prefer only "Orange" data with label "ExtraPulp" in "OrangeRecord" from "juicer"
1560  ESPrefer("ESJuicerProd", OrangeRecord=cms.vstring("Orange/ExtraPulp"))
1561  """
1562  # see if this refers to a named ESProducer
1563  if isinstance(esmodule, ESSource) or isinstance(esmodule, ESProducer):
1564  raise RuntimeError("Syntax of process.prefer(process.esmodule) not supported yet")
1565  elif self._findPreferred(esmodule, self.es_producers_(),*args,**kargs) or \
1566  self._findPreferred(esmodule, self.es_sources_(),*args,**kargs):
1567  pass
1568  else:
1569  raise RuntimeError("Cannot resolve prefer for "+repr(esmodule))
1570 

◆ processAccelerators_()

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

Definition at line 345 of file Config.py.

Referenced by Config.Process.dumpPython().

345  def processAccelerators_(self):
346  """returns a dict of the ProcessAccelerators that have been added to the Process"""
347  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 165 of file Config.py.

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

165  def producerNames(self):
166  """Returns a string containing all the EDProducer labels separated by a blank"""
167  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 209 of file Config.py.

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

209  def producers_(self):
210  """returns a dict of the producers that have been added to the Process"""
211  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 1336 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_(), 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().

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

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

◆ resolve()

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

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

1325  def resolve(self,keepUnresolvedSequencePlaceholders=False):
1326  for x in self.paths.values():
1327  x.resolve(self.__dict__,keepUnresolvedSequencePlaceholders)
1328  for x in self.endpaths.values():
1329  x.resolve(self.__dict__,keepUnresolvedSequencePlaceholders)
1330  for x in self.finalpaths.values():
1331  x.resolve(self.__dict__,keepUnresolvedSequencePlaceholders)
1332  if not self.schedule_() == None:
1333  for task in self.schedule_()._tasks:
1334  task.resolve(self.__dict__,keepUnresolvedSequencePlaceholders)
1335 

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

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

Referenced by Config.Process.dumpConfig().

310  def sequences_(self):
311  """returns a dict of the sequences that have been added to the Process"""
312  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 341 of file Config.py.

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

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

◆ setLooper_()

def Config.Process.setLooper_ (   self,
  lpr 
)

Definition at line 226 of file Config.py.

References Config.Process._placeLooper().

226  def setLooper_(self,lpr):
227  self._placeLooper('looper',lpr)

◆ setName_()

def Config.Process.setName_ (   self,
  name 
)

Definition at line 204 of file Config.py.

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

◆ setPartialSchedule_()

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

Definition at line 325 of file Config.py.

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

325  def setPartialSchedule_(self,sch,label):
326  if label == "schedule":
327  self.setSchedule_(sch)
328  else:
329  self._place(label, sch, self.__partialschedules)

◆ setSchedule_()

def Config.Process.setSchedule_ (   self,
  sch 
)

Definition at line 330 of file Config.py.

References str.

Referenced by Config.Process.setPartialSchedule_().

330  def setSchedule_(self,sch):
331  # See if every path and endpath has been inserted into the process
332  index = 0
333  try:
334  for p in sch:
335  p.label_()
336  index +=1
337  except:
338  raise RuntimeError("The path at index "+str(index)+" in the Schedule was not attached to the process.")
339  self.__dict__['_Process__schedule'] = sch
#define str(s)

◆ setSource_()

def Config.Process.setSource_ (   self,
  src 
)

Definition at line 220 of file Config.py.

References Config.Process._placeSource().

220  def setSource_(self,src):
221  self._placeSource('source',src)

◆ setStrict()

def Config.Process.setStrict (   self,
  value 
)

Definition at line 160 of file Config.py.

References Config.Process.__isStrict.

160  def setStrict(self, value):
161  self.__isStrict = value
162  _Module.__isStrict__ = True
163 

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

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

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

◆ splitPython()

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

Definition at line 1075 of file Config.py.

References dataset.Dataset.__name, genericValidation.ValidationWithPlotsSummaryBase.SummaryItem.__name, 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_, SiStripFedCablingBuilderFromDb.source_, TestPortableAnalyzer.source_, jsoncollector::DataPoint.source_, TestAlpakaAnalyzer.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_, Config.Process.subProcesses_(), edm::SubProcess.subProcesses_, edm::EventProcessor.subProcesses_, Config.Process.switchProducers_(), Config.Process.tasks, and Config.Process.vpsets.

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

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

286  def subProcesses_(self):
287  """returns a list of the subProcesses that have been added to the Process"""
288  return self.__subProcesses

◆ switchProducerNames()

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

Definition at line 168 of file Config.py.

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

168  def switchProducerNames(self):
169  """Returns a string containing all the SwitchProducer labels separated by a blank"""
170  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 213 of file Config.py.

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

213  def switchProducers_(self):
214  """returns a dict of the SwitchProducers that have been added to the Process"""
215  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 314 of file Config.py.

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

◆ validate()

def Config.Process.validate (   self)

Definition at line 1494 of file Config.py.

1494  def validate(self):
1495  # check if there's some input
1496  # Breaks too many unit tests for now
1497  #if self.source_() == None and self.looper_() == None:
1498  # raise RuntimeError("No input source was found for this process")
1499  pass
1500 

◆ vpsets_()

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

Definition at line 369 of file Config.py.

Referenced by Config.Process.prune().

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

Member Data Documentation

◆ __isStrict

Config.Process.__isStrict
private

◆ __ppset

Config.Process.__ppset
private

Definition at line 1429 of file Config.py.

◆ __process

Config.Process.__process
private

◆ __processPSet

Config.Process.__processPSet
private

Definition at line 1419 of file Config.py.

◆ __thelist

Config.Process.__thelist
private

Definition at line 1418 of file Config.py.

◆ _firstProcess

Config.Process._firstProcess
staticprivate

Definition at line 104 of file Config.py.

◆ maxEvents

Config.Process.maxEvents

Definition at line 143 of file Config.py.

◆ maxLuminosityBlocks

Config.Process.maxLuminosityBlocks

Definition at line 144 of file Config.py.

◆ MessageLogger

Config.Process.MessageLogger

Definition at line 149 of file Config.py.

◆ options

Config.Process.options

Property Documentation

◆ aliases

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

Definition at line 364 of file Config.py.

◆ analyzers

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

Definition at line 293 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 360 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 352 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 356 of file Config.py.

◆ filters

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

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

◆ outputModules

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

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

◆ producers

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

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

◆ switchProducers

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

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