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

Constructor & Destructor Documentation

◆ __init__()

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

Definition at line 116 of file Config.py.

Referenced by Config.Process.fillProcessDesc().

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

Member Function Documentation

◆ __delattr__()

def Config.Process.__delattr__ (   self,
  name 
)

Definition at line 597 of file Config.py.

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

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

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

Referenced by Config.Process.__setattr__().

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

◆ __setattr__()

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

Definition at line 420 of file Config.py.

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

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

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

◆ __setObjectLabel()

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

Definition at line 393 of file Config.py.

References l1ctLayer2EG_cff.id, and str.

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

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

◆ __setstate__()

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

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

Definition at line 192 of file Config.py.

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

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

◆ __updateMaxEvents()

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

Definition at line 285 of file Config.py.

References Config.Process.defaultMaxEvents_().

Referenced by Config.Process.__setattr__().

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

◆ __updateOptions()

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

Definition at line 272 of file Config.py.

References Config.Process.defaultOptions_().

Referenced by Config.Process.__setattr__().

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

◆ _delattrFromSetattr()

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

Definition at line 625 of file Config.py.

References Config.Process._delHelper().

Referenced by Config.Process.__setattr__().

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

◆ _delHelper()

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

Definition at line 580 of file Config.py.

References contentValuesCheck.values.

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

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

◆ _dumpConfigESPrefers()

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

Definition at line 902 of file Config.py.

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

Referenced by Config.Process.dumpConfig().

902  def _dumpConfigESPrefers(self, options):
903  result = ''
904  for item in self.es_prefers_().values():
905  result +=options.indentation()+'es_prefer '+item.targetLabel_()+' = '+item.dumpConfig(options)
906  return result
907 

◆ _dumpConfigNamedList()

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

Definition at line 813 of file Config.py.

Referenced by Config.Process.dumpConfig().

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

◆ _dumpConfigOptionallyNamedList()

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

Definition at line 825 of file Config.py.

Referenced by Config.Process.dumpConfig().

825  def _dumpConfigOptionallyNamedList(self,items,typeName,options):
826  returnValue = ''
827  for name,item in items:
828  if name == item.type_():
829  name = ''
830  returnValue +=options.indentation()+typeName+' '+name+' = '+item.dumpConfig(options)
831  return returnValue
832 

◆ _dumpConfigUnnamedList()

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

Definition at line 819 of file Config.py.

Referenced by Config.Process.dumpConfig().

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

◆ _dumpPython()

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

Definition at line 1037 of file Config.py.

Referenced by Config.Process.dumpPython().

1037  def _dumpPython(self, d, options):
1038  result = ''
1039  for name, value in sorted(d.items()):
1040  result += value.dumpPythonAs(name,options)+'\n'
1041  return result
1042 

◆ _dumpPythonList()

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

Definition at line 914 of file Config.py.

Referenced by Config.Process.dumpPython().

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

◆ _dumpPythonSubProcesses()

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

Definition at line 908 of file Config.py.

Referenced by Config.Process.dumpPython().

908  def _dumpPythonSubProcesses(self, l, options):
909  returnValue = ''
910  for item in l:
911  returnValue += item.dumpPython(options)+'\n\n'
912  return returnValue
913 

◆ _findPreferred()

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

Definition at line 1606 of file Config.py.

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

Referenced by Config.Process.prefer().

1606  def _findPreferred(self, esname, d,*args,**kargs):
1607  # is esname a name in the dictionary?
1608  if esname in d:
1609  typ = d[esname].type_()
1610  if typ == esname:
1611  self.__setattr__( esname+"_prefer", ESPrefer(typ,*args,**kargs) )
1612  else:
1613  self.__setattr__( esname+"_prefer", ESPrefer(typ, esname,*args,**kargs) )
1614  return True
1615  else:
1616  # maybe it's an unnamed ESModule?
1617  found = False
1618  for name, value in d.items():
1619  if value.type_() == esname:
1620  if found:
1621  raise RuntimeError("More than one ES module for "+esname)
1622  found = True
1623  self.__setattr__(esname+"_prefer", ESPrefer(d[esname].type_()) )
1624  return found
1625 
1626 

◆ _insertInto()

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

Definition at line 1198 of file Config.py.

1198  def _insertInto(self, parameterSet, itemDict):
1199  for name,value in itemDict.items():
1200  value.insertInto(parameterSet, name)

◆ _insertManyInto()

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

Definition at line 1208 of file Config.py.

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

◆ _insertOneInto()

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

Definition at line 1201 of file Config.py.

1201  def _insertOneInto(self, parameterSet, label, item, tracked):
1202  vitems = []
1203  if not item == None:
1204  newlabel = item.nameInProcessDesc_(label)
1205  vitems = [newlabel]
1206  item.insertInto(parameterSet, newlabel)
1207  parameterSet.addVString(tracked, label, vitems)

◆ _insertPaths()

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

Definition at line 1240 of file Config.py.

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

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

◆ _insertSubProcessesInto()

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

Definition at line 1227 of file Config.py.

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

◆ _insertSwitchProducersInto()

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

Definition at line 1216 of file Config.py.

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

◆ _itemsInDependencyOrder()

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

Definition at line 971 of file Config.py.

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

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

◆ _okToPlace()

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

Definition at line 648 of file Config.py.

References Config.Process.__isStrict.

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

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

◆ _place()

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

◆ _placeAccelerator()

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

Definition at line 752 of file Config.py.

References Config.Process._place().

752  def _placeAccelerator(self,typeName,mod):
753  self._place(typeName, mod, self.__accelerators)
754  self.__dict__[typeName]=mod

◆ _placeAlias()

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

Definition at line 723 of file Config.py.

References Config.Process._place().

723  def _placeAlias(self,name,mod):
724  self._place(name, mod, self.__aliases)

◆ _placeAnalyzer()

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

Definition at line 685 of file Config.py.

References Config.Process._place().

685  def _placeAnalyzer(self,name,mod):
686  self._place(name, mod, self.__analyzers)

◆ _placeConditionalTask()

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

Definition at line 720 of file Config.py.

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

720  def _placeConditionalTask(self,name,task):
721  self._validateConditionalTask(task, name)
722  self._place(name, task, self.__conditionaltasks)

◆ _placeEndPath()

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

Definition at line 694 of file Config.py.

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

694  def _placeEndPath(self,name,mod):
695  self._validateSequence(mod, name)
696  try:
697  self._place(name, mod, self.__endpaths)
698  except ModuleCloneError as msg:
699  context = format_outerframe(4)
700  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 713 of file Config.py.

References Config.Process._place().

713  def _placeESPrefer(self,name,mod):
714  self._place(name, mod, self.__esprefers)

◆ _placeESProducer()

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

Definition at line 711 of file Config.py.

References Config.Process._place().

711  def _placeESProducer(self,name,mod):
712  self._place(name, mod, self.__esproducers)

◆ _placeESSource()

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

Definition at line 715 of file Config.py.

References Config.Process._place().

715  def _placeESSource(self,name,mod):
716  self._place(name, mod, self.__essources)

◆ _placeFilter()

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

Definition at line 683 of file Config.py.

References Config.Process._place().

683  def _placeFilter(self,name,mod):
684  self._place(name, mod, self.__filters)

◆ _placeFinalPath()

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

Definition at line 701 of file Config.py.

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

701  def _placeFinalPath(self,name,mod):
702  self._validateSequence(mod, name)
703  try:
704  self._place(name, mod, self.__finalpaths)
705  except ModuleCloneError as msg:
706  context = format_outerframe(4)
707  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 737 of file Config.py.

Referenced by Config.Process.setLooper_().

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

◆ _placeOutputModule()

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

Definition at line 677 of file Config.py.

References Config.Process._place().

677  def _placeOutputModule(self,name,mod):
678  self._place(name, mod, self.__outputmodules)

◆ _placePath()

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

Definition at line 687 of file Config.py.

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

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

References Config.Process._place().

679  def _placeProducer(self,name,mod):
680  self._place(name, mod, self.__producers)

◆ _placePSet()

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

Definition at line 725 of file Config.py.

References Config.Process._place().

725  def _placePSet(self,name,mod):
726  self._place(name, mod, self.__psets)

◆ _placeSequence()

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

Definition at line 708 of file Config.py.

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

708  def _placeSequence(self,name,mod):
709  self._validateSequence(mod, name)
710  self._place(name, mod, self.__sequences)

◆ _placeService()

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

Definition at line 747 of file Config.py.

References Config.Process._place().

747  def _placeService(self,typeName,mod):
748  self._place(typeName, mod, self.__services)
749  if typeName in self.__dict__:
750  self.__dict__[typeName]._inProcess = False
751  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 729 of file Config.py.

Referenced by Config.Process.setSource_().

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

◆ _placeSubProcess()

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

Definition at line 742 of file Config.py.

742  def _placeSubProcess(self,name,mod):
743  self.__dict__['_Process__subProcess'] = mod
744  self.__dict__[mod.type_()] = mod

◆ _placeSwitchProducer()

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

Definition at line 681 of file Config.py.

References Config.Process._place().

681  def _placeSwitchProducer(self,name,mod):
682  self._place(name, mod, self.__switchproducers)

◆ _placeTask()

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

Definition at line 717 of file Config.py.

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

717  def _placeTask(self,name,task):
718  self._validateTask(task, name)
719  self._place(name, task, self.__tasks)

◆ _placeVPSet()

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

Definition at line 727 of file Config.py.

References Config.Process._place().

727  def _placeVPSet(self,name,mod):
728  self._place(name, mod, self.__vpsets)

◆ _pruneModules()

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

Definition at line 1418 of file Config.py.

Referenced by Config.Process.prune().

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

◆ _replaceInConditionalTasks()

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

Definition at line 1178 of file Config.py.

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

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

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

◆ _replaceInSchedule()

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

Definition at line 1182 of file Config.py.

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

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

1182  def _replaceInSchedule(self, label, new):
1183  if self.schedule_() == None:
1184  return
1185  old = getattr(self,label)
1186  for task in self.schedule_()._tasks:
1187  task.replace(old, new)

◆ _replaceInScheduleDirectly()

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

Definition at line 1188 of file Config.py.

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

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

1188  def _replaceInScheduleDirectly(self, label, new):
1189  if self.schedule_() == None:
1190  return
1191  old = getattr(self,label)
1192  self.schedule_()._replaceIfHeldDirectly(old, new)

◆ _replaceInSequences()

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

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

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

◆ _replaceInTasks()

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

Definition at line 1174 of file Config.py.

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

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

1174  def _replaceInTasks(self, label, new):
1175  old = getattr(self,label)
1176  for task in self.tasks.values():
1177  task.replace(old, new)

◆ _splitPython()

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

Definition at line 1043 of file Config.py.

Referenced by Config.Process.splitPython().

1043  def _splitPython(self, subfolder, d, options):
1044  result = {}
1045  for name, value in sorted(d.items()):
1046  result[name] = subfolder, value.dumpPythonAs(name, options) + '\n'
1047  return result
1048 

◆ _splitPythonList()

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

Definition at line 924 of file Config.py.

Referenced by Config.Process.splitPython().

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

◆ _validateConditionalTask()

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

Definition at line 962 of file Config.py.

Referenced by Config.Process._placeConditionalTask().

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

◆ _validateSequence()

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

Definition at line 945 of file Config.py.

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

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

◆ _validateTask()

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

Definition at line 954 of file Config.py.

Referenced by Config.Process._placeTask().

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

References Config.Process.__isStrict.

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

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

◆ addSubProcess()

def Config.Process.addSubProcess (   self,
  mod 
)

Definition at line 745 of file Config.py.

References mps_setup.append.

745  def addSubProcess(self,mod):
746  self.__subProcesses.append(mod)

◆ aliases_()

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

Definition at line 372 of file Config.py.

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

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

◆ analyzerNames()

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

Definition at line 182 of file Config.py.

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

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

◆ analyzers_()

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

Definition at line 301 of file Config.py.

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

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

◆ conditionaltasks_()

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

Definition at line 329 of file Config.py.

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

◆ defaultMaxEvents_()

def Config.Process.defaultMaxEvents_ ( )
static

Definition at line 282 of file Config.py.

Referenced by Config.Process.__updateMaxEvents().

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

◆ defaultMaxLuminosityBlocks_()

def Config.Process.defaultMaxLuminosityBlocks_ ( )
static

Definition at line 295 of file Config.py.

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

◆ defaultOptions_()

def Config.Process.defaultOptions_ ( )
static

Definition at line 241 of file Config.py.

Referenced by Config.Process.__updateOptions().

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

◆ dumpConfig()

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

Definition at line 833 of file Config.py.

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

Referenced by Types.SecSource.configValue().

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

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

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

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

◆ endpaths_()

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

Definition at line 313 of file Config.py.

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

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

◆ es_prefers_()

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

Definition at line 368 of file Config.py.

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

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

◆ es_producers_()

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

Definition at line 360 of file Config.py.

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

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

◆ es_sources_()

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

Definition at line 364 of file Config.py.

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

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

◆ extend()

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

Definition at line 759 of file Config.py.

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

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

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

◆ fillProcessDesc()

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

Definition at line 1425 of file Config.py.

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

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

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

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

◆ filters_()

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

Definition at line 209 of file Config.py.

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

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

◆ finalpaths_()

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

Definition at line 317 of file Config.py.

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

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

◆ globalReplace()

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

Definition at line 1193 of file Config.py.

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

◆ handleProcessAccelerators()

def Config.Process.handleProcessAccelerators (   self,
  parameterSet 
)

Definition at line 1512 of file Config.py.

1512  def handleProcessAccelerators(self, parameterSet):
1513  # 'cpu' accelerator is always implicitly there
1514  allAccelerators = set(["cpu"])
1515  availableAccelerators = set(["cpu"])
1516  for acc in self.__dict__['_Process__accelerators'].values():
1517  allAccelerators.update(acc.labels())
1518  availableAccelerators.update(acc.enabledLabels())
1519  availableAccelerators = sorted(list(availableAccelerators))
1520  parameterSet.addVString(False, "@available_accelerators", availableAccelerators)
1521 
1522  # Resolve wildcards
1523  selectedAccelerators = []
1524  if "*" in self.options.accelerators:
1525  if len(self.options.accelerators) >= 2:
1526  raise ValueError("process.options.accelerators may contain '*' only as the only element, now it has {} elements".format(len(self.options.accelerators)))
1527  selectedAccelerators = availableAccelerators
1528  else:
1529  import fnmatch
1530  resolved = set()
1531  invalid = []
1532  for pattern in self.options.accelerators:
1533  acc = [a for a in availableAccelerators if fnmatch.fnmatchcase(a, pattern)]
1534  if len(acc) == 0:
1535  if not any(fnmatch.fnmatchcase(a, pattern) for a in allAccelerators):
1536  invalid.append(pattern)
1537  else:
1538  resolved.update(acc)
1539  # Sanity check
1540  if len(invalid) != 0:
1541  raise ValueError("Invalid pattern{} of '{}' in process.options.accelerators, valid values are '{}' or a pattern matching some of them.".format(
1542  "s" if len(invalid) > 2 else "",
1543  "', '".join(invalid),
1544  "', '".join(sorted(list(allAccelerators)))))
1545  selectedAccelerators = sorted(list(resolved))
1546  parameterSet.addVString(False, "@selected_accelerators", selectedAccelerators)
1547 
1548  # Get and apply module type resolver
1549  moduleTypeResolver = None
1550  moduleTypeResolverPlugin = ""
1551  for acc in self.__dict__['_Process__accelerators'].values():
1552  resolver = acc.moduleTypeResolver(selectedAccelerators)
1553  if resolver is not None:
1554  if moduleTypeResolver is not None:
1555  raise RuntimeError("Module type resolver was already set to {} when {} tried to set it to {}. A job can have at most one ProcessAccelerator that sets module type resolver.".format(
1556  moduleTypeResolver.__class__.__name__,
1557  acc.__class__.__name__,
1558  resolver.__class__.__name__))
1559  moduleTypeResolver = resolver
1560  if moduleTypeResolver is not None:
1561  # Plugin name and its configuration
1562  moduleTypeResolverPlugin = moduleTypeResolver.plugin()
1563 
1564  # Customize modules
1565  for modlist in [self.producers_, self.filters_, self.analyzers_,
1566  self.es_producers_, self.es_sources_]:
1567  for module in modlist().values():
1568  moduleTypeResolver.setModuleVariant(module)
1569 
1570  parameterSet.addString(False, "@module_type_resolver", moduleTypeResolverPlugin)
1571 
1572  # Customize process
1573  wrapped = ProcessForProcessAccelerator(self)
1574  for acc in self.__dict__['_Process__accelerators'].values():
1575  acc.apply(wrapped, selectedAccelerators)
1576 
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 385 of file Config.py.

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

◆ load()

def Config.Process.load (   self,
  moduleName 
)

Definition at line 755 of file Config.py.

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

755  def load(self, moduleName):
756  moduleName = moduleName.replace("/",".")
757  module = __import__(moduleName)
758  self.extend(sys.modules[moduleName])
def load(fileName)
Definition: svgfig.py:547

◆ looper_()

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

Definition at line 234 of file Config.py.

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

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

◆ name_()

def Config.Process.name_ (   self)

Definition at line 213 of file Config.py.

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

213  def name_(self):
214  return self.__name

◆ outputModules_()

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

Definition at line 305 of file Config.py.

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

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

◆ pathNames()

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

Definition at line 188 of file Config.py.

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

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

◆ paths_()

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

Definition at line 309 of file Config.py.

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

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

◆ prefer()

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

Definition at line 1577 of file Config.py.

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

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

◆ processAccelerators_()

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

Definition at line 356 of file Config.py.

Referenced by Config.Process.dumpPython().

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

◆ producerNames()

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

Definition at line 176 of file Config.py.

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

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

◆ producers_()

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

Definition at line 220 of file Config.py.

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

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

◆ prune()

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

Definition at line 1347 of file Config.py.

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

Referenced by dirstructure.Directory.prune().

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

◆ psets_()

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

Definition at line 376 of file Config.py.

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

◆ resolve()

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

Definition at line 1336 of file Config.py.

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

Referenced by Config.Process.prune().

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

◆ schedule_()

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

Definition at line 333 of file Config.py.

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

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

◆ sequences_()

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

Definition at line 321 of file Config.py.

Referenced by Config.Process.dumpConfig().

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

◆ services_()

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

Definition at line 352 of file Config.py.

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

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

◆ setLooper_()

def Config.Process.setLooper_ (   self,
  lpr 
)

Definition at line 237 of file Config.py.

References Config.Process._placeLooper().

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

◆ setName_()

def Config.Process.setName_ (   self,
  name 
)

Definition at line 215 of file Config.py.

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

◆ setPartialSchedule_()

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

Definition at line 336 of file Config.py.

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

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

◆ setSchedule_()

def Config.Process.setSchedule_ (   self,
  sch 
)

Definition at line 341 of file Config.py.

References str.

Referenced by Config.Process.setPartialSchedule_().

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

◆ setSource_()

def Config.Process.setSource_ (   self,
  src 
)

Definition at line 231 of file Config.py.

References Config.Process._placeSource().

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

◆ setStrict()

def Config.Process.setStrict (   self,
  value 
)

Definition at line 171 of file Config.py.

References Config.Process.__isStrict.

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

◆ source_()

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

Definition at line 228 of file Config.py.

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

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

◆ splitPython()

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

Definition at line 1086 of file Config.py.

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

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

◆ subProcesses_()

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

Definition at line 297 of file Config.py.

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

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

◆ switchProducerNames()

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

Definition at line 179 of file Config.py.

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

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

◆ switchProducers_()

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

Definition at line 224 of file Config.py.

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

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

◆ tasks_()

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

Definition at line 325 of file Config.py.

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

◆ validate()

def Config.Process.validate (   self)

Definition at line 1505 of file Config.py.

1505  def validate(self):
1506  # check if there's some input
1507  # Breaks too many unit tests for now
1508  #if self.source_() == None and self.looper_() == None:
1509  # raise RuntimeError("No input source was found for this process")
1510  pass
1511 

◆ vpsets_()

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

Definition at line 380 of file Config.py.

Referenced by Config.Process.prune().

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

Member Data Documentation

◆ __isStrict

Config.Process.__isStrict
private

◆ __ppset

Config.Process.__ppset
private

Definition at line 1440 of file Config.py.

◆ __process

Config.Process.__process
private

◆ __processPSet

Config.Process.__processPSet
private

Definition at line 1430 of file Config.py.

◆ __thelist

Config.Process.__thelist
private

Definition at line 1429 of file Config.py.

◆ _firstProcess

Config.Process._firstProcess
staticprivate

Definition at line 115 of file Config.py.

◆ maxEvents

Config.Process.maxEvents

Definition at line 154 of file Config.py.

◆ maxLuminosityBlocks

Config.Process.maxLuminosityBlocks

Definition at line 155 of file Config.py.

◆ MessageLogger

Config.Process.MessageLogger

Definition at line 160 of file Config.py.

◆ options

Config.Process.options

Property Documentation

◆ aliases

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

Definition at line 375 of file Config.py.

◆ analyzers

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

Definition at line 304 of file Config.py.

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

◆ conditionaltasks

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

◆ endpaths

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

◆ es_prefers

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

Definition at line 371 of file Config.py.

◆ es_producers

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

Definition at line 363 of file Config.py.

◆ es_sources

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

Definition at line 367 of file Config.py.

◆ filters

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

Definition at line 212 of file Config.py.

◆ finalpaths

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

◆ looper

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

Definition at line 239 of file Config.py.

◆ outputModules

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

Definition at line 308 of file Config.py.

◆ paths

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

◆ process

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

◆ processAccelerators

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

Definition at line 359 of file Config.py.

◆ producers

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

Definition at line 223 of file Config.py.

◆ psets

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

◆ schedule

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

◆ sequences

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

◆ services

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

◆ source

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

◆ subProcesses

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

Definition at line 300 of file Config.py.

◆ switchProducers

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

Definition at line 227 of file Config.py.

◆ tasks

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

◆ vpsets

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