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

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

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

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

Referenced by Config.Process.__setattr__().

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

◆ __setattr__()

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

Definition at line 407 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, triggerObjects_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().

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

◆ __setObjectLabel()

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

Definition at line 380 of file Config.py.

References triggerObjects_cff.id, and str.

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

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

References Config.Process.defaultMaxEvents_().

Referenced by Config.Process.__setattr__().

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

◆ __updateOptions()

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

Definition at line 259 of file Config.py.

References Config.Process.defaultOptions_().

Referenced by Config.Process.__setattr__().

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

References Config.Process._delHelper().

Referenced by Config.Process.__setattr__().

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

◆ _delHelper()

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

Definition at line 567 of file Config.py.

References contentValuesCheck.values.

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

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

◆ _dumpConfigESPrefers()

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

Definition at line 889 of file Config.py.

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

Referenced by Config.Process.dumpConfig().

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

◆ _dumpConfigNamedList()

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

Definition at line 800 of file Config.py.

Referenced by Config.Process.dumpConfig().

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

◆ _dumpConfigOptionallyNamedList()

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

Definition at line 812 of file Config.py.

Referenced by Config.Process.dumpConfig().

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

◆ _dumpConfigUnnamedList()

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

Definition at line 806 of file Config.py.

Referenced by Config.Process.dumpConfig().

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

◆ _dumpPython()

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

Definition at line 1024 of file Config.py.

Referenced by Config.Process.dumpPython().

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

◆ _dumpPythonList()

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

Definition at line 901 of file Config.py.

Referenced by Config.Process.dumpPython().

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

◆ _dumpPythonSubProcesses()

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

Definition at line 895 of file Config.py.

Referenced by Config.Process.dumpPython().

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

◆ _findPreferred()

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

Definition at line 1569 of file Config.py.

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

Referenced by Config.Process.prefer().

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

◆ _insertInto()

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

Definition at line 1185 of file Config.py.

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

◆ _insertManyInto()

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

Definition at line 1195 of file Config.py.

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

◆ _insertOneInto()

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

Definition at line 1188 of file Config.py.

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

◆ _insertPaths()

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

Definition at line 1227 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_, Config.Process.schedule_(), edm::EventProcessor.schedule_, and edm::test::TestProcessor.schedule_.

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

◆ _insertSubProcessesInto()

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

Definition at line 1214 of file Config.py.

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

◆ _insertSwitchProducersInto()

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

Definition at line 1203 of file Config.py.

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

◆ _itemsInDependencyOrder()

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

Definition at line 958 of file Config.py.

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

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

◆ _okToPlace()

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

Definition at line 635 of file Config.py.

References Config.Process.__isStrict.

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

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

◆ _place()

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

◆ _placeAccelerator()

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

Definition at line 739 of file Config.py.

References Config.Process._place().

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

◆ _placeAlias()

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

Definition at line 710 of file Config.py.

References Config.Process._place().

710  def _placeAlias(self,name,mod):
711  self._place(name, mod, self.__aliases)

◆ _placeAnalyzer()

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

Definition at line 672 of file Config.py.

References Config.Process._place().

672  def _placeAnalyzer(self,name,mod):
673  self._place(name, mod, self.__analyzers)

◆ _placeConditionalTask()

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

Definition at line 707 of file Config.py.

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

707  def _placeConditionalTask(self,name,task):
708  self._validateConditionalTask(task, name)
709  self._place(name, task, self.__conditionaltasks)

◆ _placeEndPath()

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

Definition at line 681 of file Config.py.

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

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

References Config.Process._place().

700  def _placeESPrefer(self,name,mod):
701  self._place(name, mod, self.__esprefers)

◆ _placeESProducer()

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

Definition at line 698 of file Config.py.

References Config.Process._place().

698  def _placeESProducer(self,name,mod):
699  self._place(name, mod, self.__esproducers)

◆ _placeESSource()

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

Definition at line 702 of file Config.py.

References Config.Process._place().

702  def _placeESSource(self,name,mod):
703  self._place(name, mod, self.__essources)

◆ _placeFilter()

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

Definition at line 670 of file Config.py.

References Config.Process._place().

670  def _placeFilter(self,name,mod):
671  self._place(name, mod, self.__filters)

◆ _placeFinalPath()

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

Definition at line 688 of file Config.py.

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

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

Referenced by Config.Process.setLooper_().

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

◆ _placeOutputModule()

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

Definition at line 664 of file Config.py.

References Config.Process._place().

664  def _placeOutputModule(self,name,mod):
665  self._place(name, mod, self.__outputmodules)

◆ _placePath()

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

Definition at line 674 of file Config.py.

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

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

References Config.Process._place().

666  def _placeProducer(self,name,mod):
667  self._place(name, mod, self.__producers)

◆ _placePSet()

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

Definition at line 712 of file Config.py.

References Config.Process._place().

712  def _placePSet(self,name,mod):
713  self._place(name, mod, self.__psets)

◆ _placeSequence()

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

Definition at line 695 of file Config.py.

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

695  def _placeSequence(self,name,mod):
696  self._validateSequence(mod, name)
697  self._place(name, mod, self.__sequences)

◆ _placeService()

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

Definition at line 734 of file Config.py.

References Config.Process._place().

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

Referenced by Config.Process.setSource_().

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

◆ _placeSubProcess()

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

Definition at line 729 of file Config.py.

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

◆ _placeSwitchProducer()

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

Definition at line 668 of file Config.py.

References Config.Process._place().

668  def _placeSwitchProducer(self,name,mod):
669  self._place(name, mod, self.__switchproducers)

◆ _placeTask()

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

Definition at line 704 of file Config.py.

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

704  def _placeTask(self,name,task):
705  self._validateTask(task, name)
706  self._place(name, task, self.__tasks)

◆ _placeVPSet()

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

Definition at line 714 of file Config.py.

References Config.Process._place().

714  def _placeVPSet(self,name,mod):
715  self._place(name, mod, self.__vpsets)

◆ _pruneModules()

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

Definition at line 1405 of file Config.py.

Referenced by Config.Process.prune().

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

◆ _replaceInConditionalTasks()

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

Definition at line 1165 of file Config.py.

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

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

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

◆ _replaceInSchedule()

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

Definition at line 1169 of file Config.py.

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

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

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

◆ _replaceInScheduleDirectly()

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

Definition at line 1175 of file Config.py.

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

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

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

◆ _replaceInSequences()

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

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

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

◆ _replaceInTasks()

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

Definition at line 1161 of file Config.py.

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

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

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

◆ _splitPython()

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

Definition at line 1030 of file Config.py.

Referenced by Config.Process.splitPython().

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

◆ _splitPythonList()

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

Definition at line 911 of file Config.py.

Referenced by Config.Process.splitPython().

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

◆ _validateConditionalTask()

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

Definition at line 949 of file Config.py.

Referenced by Config.Process._placeConditionalTask().

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

◆ _validateSequence()

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

Definition at line 932 of file Config.py.

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

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

◆ _validateTask()

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

Definition at line 941 of file Config.py.

Referenced by Config.Process._placeTask().

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

References Config.Process.__isStrict.

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

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

◆ addSubProcess()

def Config.Process.addSubProcess (   self,
  mod 
)

Definition at line 732 of file Config.py.

References mps_setup.append.

732  def addSubProcess(self,mod):
733  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 359 of file Config.py.

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

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

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

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

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

◆ defaultMaxEvents_()

def Config.Process.defaultMaxEvents_ ( )
static

Definition at line 269 of file Config.py.

Referenced by Config.Process.__updateMaxEvents().

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

◆ defaultMaxLuminosityBlocks_()

def Config.Process.defaultMaxLuminosityBlocks_ ( )
static

Definition at line 282 of file Config.py.

282  def defaultMaxLuminosityBlocks_():
283  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  dumpOptions = untracked.bool(False),
255  allowUnscheduled = obsolete.untracked.bool,
256  emptyRunLumiMode = obsolete.untracked.string,
257  makeTriggerResults = obsolete.untracked.bool
258  )

◆ dumpConfig()

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

Definition at line 820 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_, 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_, L2MuonSeedGeneratorFromL1TkMu.source_, SiStripFedCablingBuilderFromDb.source_, jsoncollector::DataPoint.source_, sistrip::SpyEventMatcher.source_, ProcessCallGraph.source_, Config.Process.source_(), edm::InputSource::EventSourceSentry.source_, edm::InputSource::LumiSourceSentry.source_, edm::InputSource::RunSourceSentry.source_, edm::InputSource::ProcessBlockSourceSentry.source_, Config.Process.subProcesses_(), edm::SubProcess.subProcesses_, edm::EventProcessor.subProcesses_, Config.Process.switchProducers_(), and Config.Process.vpsets.

Referenced by Types.SecSource.configValue().

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

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

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

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

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

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

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

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

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

351  def es_sources_(self):
352  """returns a the es_sources that have been added to the Process"""
353  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 746 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 triggerObjects_cff.id.

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

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

◆ fillProcessDesc()

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

Definition at line 1412 of file Config.py.

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

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

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

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

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

◆ handleProcessAccelerators()

def Config.Process.handleProcessAccelerators (   self,
  parameterSet 
)

Definition at line 1499 of file Config.py.

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

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

◆ load()

def Config.Process.load (   self,
  moduleName 
)

Definition at line 742 of file Config.py.

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

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

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

292  def outputModules_(self):
293  """returns a dict of the output modules that have been added to the Process"""
294  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 296 of file Config.py.

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

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

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

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

◆ processAccelerators_()

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

Definition at line 343 of file Config.py.

Referenced by Config.Process.dumpPython().

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

References Config.Process._pruneModules(), HLTMuonValidator.analyzers_, Config.Process.analyzers_(), Config.Process.endpaths, pat::eventhypothesis::AndFilter.filters_, pat::eventhypothesis::OrFilter.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_, Config.Process.schedule_(), edm::EventProcessor.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().

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

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

◆ resolve()

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

Definition at line 1323 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_, Config.Process.schedule_(), edm::EventProcessor.schedule_, edm::test::TestProcessor.schedule_, and contentValuesCheck.values.

Referenced by Config.Process.prune().

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

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

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

Referenced by Config.Process.dumpConfig().

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

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

339  def services_(self):
340  """returns a dict of the services that have been added to the Process"""
341  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 323 of file Config.py.

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

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

◆ setSchedule_()

def Config.Process.setSchedule_ (   self,
  sch 
)

Definition at line 328 of file Config.py.

References str.

Referenced by Config.Process.setPartialSchedule_().

328  def setSchedule_(self,sch):
329  # See if every path and endpath has been inserted into the process
330  index = 0
331  try:
332  for p in sch:
333  p.label_()
334  index +=1
335  except:
336  raise RuntimeError("The path at index "+str(index)+" in the Schedule was not attached to the process.")
337  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 1073 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_, 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_, Config.Process.schedule_(), edm::EventProcessor.schedule_, edm::test::TestProcessor.schedule_, Config.Process.sequences, edm::ProcessDesc.services_, Config.Process.services_(), ecaldqm::DBWriterWorker.source_, L2MuonSeedGeneratorFromL1TkMu.source_, SiStripFedCablingBuilderFromDb.source_, jsoncollector::DataPoint.source_, sistrip::SpyEventMatcher.source_, ProcessCallGraph.source_, Config.Process.source_(), edm::InputSource::EventSourceSentry.source_, edm::InputSource::LumiSourceSentry.source_, edm::InputSource::RunSourceSentry.source_, edm::InputSource::ProcessBlockSourceSentry.source_, Config.Process.subProcesses_(), edm::SubProcess.subProcesses_, edm::EventProcessor.subProcesses_, Config.Process.switchProducers_(), Config.Process.tasks, and Config.Process.vpsets.

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

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

284  def subProcesses_(self):
285  """returns a list of the subProcesses that have been added to the Process"""
286  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 312 of file Config.py.

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

◆ validate()

def Config.Process.validate (   self)

Definition at line 1492 of file Config.py.

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

◆ vpsets_()

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

Definition at line 367 of file Config.py.

Referenced by Config.Process.prune().

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

Member Data Documentation

◆ __isStrict

Config.Process.__isStrict
private

◆ __ppset

Config.Process.__ppset
private

Definition at line 1427 of file Config.py.

◆ __process

Config.Process.__process
private

◆ __processPSet

Config.Process.__processPSet
private

Definition at line 1417 of file Config.py.

◆ __thelist

Config.Process.__thelist
private

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

◆ analyzers

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

Definition at line 291 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 358 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 350 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 354 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 295 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 346 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 287 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