CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Properties | Private Member Functions | Private Attributes
Config.Process Class Reference
Inheritance diagram for Config.Process:

Public Member Functions

def __delattr__
 
def __init__
 
def __setattr__
 
def __setstate__
 
def add_
 
def analyzerNames
 
def analyzers_
 
def dumpConfig
 
def dumpPython
 
def endpaths_
 
def es_prefers_
 
def es_producers_
 
def es_sources_
 
def extend
 
def fillProcessDesc
 
def filterNames
 
def filters_
 
def globalReplace
 
def load
 
def looper_
 
def name_
 
def outputModules_
 
def pathNames
 
def paths_
 
def prefer
 
def producerNames
 
def producers_
 
def prune
 
def pruneModules
 
def pruneSequences
 
def psets_
 
def schedule_
 
def sequences_
 
def services_
 
def setLooper_
 
def setName_
 
def setPartialSchedule_
 
def setSchedule_
 
def setSource_
 
def setStrict
 
def setSubProcess_
 
def source_
 
def subProcess_
 
def validate
 
def vpsets_
 

Properties

 analyzers = property(analyzers_,doc="dictionary containing the analyzers 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")
 
 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")
 
 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')
 
 subProcess = property(subProcess_,setSubProcess_,doc='the SubProcess or None if not set')
 
 vpsets = property(vpsets_,doc="dictionary containing the PSets for the process")
 

Private Member Functions

def _dumpConfigESPrefers
 
def _dumpConfigNamedList
 
def _dumpConfigOptionallyNamedList
 
def _dumpConfigUnnamedList
 
def _dumpPython
 
def _dumpPythonList
 
def _findPreferred
 
def _insertInto
 
def _insertManyInto
 
def _insertOneInto
 
def _insertPaths
 
def _okToPlace
 
def _place
 
def _placeAnalyzer
 
def _placeEndPath
 
def _placeESPrefer
 
def _placeESProducer
 
def _placeESSource
 
def _placeFilter
 
def _placeLooper
 
def _placeOutputModule
 
def _placePath
 
def _placeProducer
 
def _placePSet
 
def _placeSequence
 
def _placeService
 
def _placeSource
 
def _placeSubProcess
 
def _placeVPSet
 
def _replaceInSequences
 
def _sequencesInDependencyOrder
 
def _validateSequence
 

Private Attributes

 __isStrict
 
 __processPSet
 
 __thelist
 

Detailed Description

Root class for a CMS configuration process

Definition at line 100 of file Config.py.

Constructor & Destructor Documentation

def Config.Process.__init__ (   self,
  name 
)

Definition at line 102 of file Config.py.

Referenced by Config.Process.fillProcessDesc().

103  def __init__(self,name):
104  self.__dict__['_Process__name'] = name
105  self.__dict__['_Process__filters'] = {}
106  self.__dict__['_Process__producers'] = {}
107  self.__dict__['_Process__source'] = None
108  self.__dict__['_Process__looper'] = None
109  self.__dict__['_Process__subProcess'] = None
110  self.__dict__['_Process__schedule'] = None
111  self.__dict__['_Process__analyzers'] = {}
112  self.__dict__['_Process__outputmodules'] = {}
113  self.__dict__['_Process__paths'] = DictTypes.SortedKeysDict() # have to keep the order
114  self.__dict__['_Process__endpaths'] = DictTypes.SortedKeysDict() # of definition
115  self.__dict__['_Process__sequences'] = {}
116  self.__dict__['_Process__services'] = {}
117  self.__dict__['_Process__essources'] = {}
118  self.__dict__['_Process__esproducers'] = {}
119  self.__dict__['_Process__esprefers'] = {}
120  self.__dict__['_Process__psets']={}
121  self.__dict__['_Process__vpsets']={}
122  self.__dict__['_cloneToObjectDict'] = {}
123  # policy switch to avoid object overwriting during extend/load
124  self.__dict__['_Process__InExtendCall'] = False
125  self.__dict__['_Process__partialschedules'] = {}
126  self.__isStrict = False
def __init__
Definition: Config.py:102

Member Function Documentation

def Config.Process.__delattr__ (   self,
  name 
)

Definition at line 303 of file Config.py.

Referenced by Config.Process.__setattr__().

304  def __delattr__(self,name):
305  if not hasattr(self,name):
306  raise KeyError('process does not know about '+name)
307  elif name.startswith('_Process__'):
308  raise ValueError('this attribute cannot be deleted')
309  else:
310  # we have to remove it from all dictionaries/registries
311  dicts = [item for item in self.__dict__.values() if (type(item)==dict or type(item)==DictTypes.SortedKeysDict)]
312  for reg in dicts:
313  if reg.has_key(name): del reg[name]
314  # if it was a labelable object, the label needs to be removed
315  obj = getattr(self,name)
316  if isinstance(obj,_Labelable):
317  getattr(self,name).setLabel(None)
318  # now remove it from the process itself
319  try:
320  del self.__dict__[name]
321  except:
322  pass
def __delattr__
Definition: Config.py:303
def Config.Process.__setattr__ (   self,
  name,
  value 
)

Definition at line 253 of file Config.py.

References Config.Process.__delattr__(), Config.Process.__isStrict, Config.Process._okToPlace(), Config.Process._replaceInSequences(), and Config.Process.add_().

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

254  def __setattr__(self,name,value):
255  # check if the name is well-formed (only _ and alphanumerics are allowed)
256  if not name.replace('_','').isalnum():
257  raise ValueError('The label '+name+' contains forbiden characters')
258 
259  # private variable exempt from all this
260  if name.startswith('_Process__'):
261  self.__dict__[name]=value
262  return
263  if not isinstance(value,_ConfigureComponent):
264  raise TypeError("can only assign labels to an object which inherits from '_ConfigureComponent'\n"
265  +"an instance of "+str(type(value))+" will not work")
266  if not isinstance(value,_Labelable) and not isinstance(value,Source) and not isinstance(value,Looper) and not isinstance(value,Schedule):
267  if name == value.type_():
268  self.add_(value)
269  return
270  else:
271  raise TypeError("an instance of "+str(type(value))+" can not be assigned the label '"+name+"'.\n"+
272  "Please either use the label '"+value.type_()+" or use the 'add_' method instead.")
273  #clone the item
274  if self.__isStrict:
275  newValue =value.copy()
276  try:
277  newValue._filename = value._filename
278  except:
279  pass
280  value.setIsFrozen()
281  else:
282  newValue =value
283  if not self._okToPlace(name, value, self.__dict__):
284  msg = "Trying to override definition of process."+name
285  msg += "\n new object defined in: "+value._filename
286  msg += "\n existing object defined in: "+getattr(self,name)._filename
287  raise ValueError(msg)
288  # remove the old object of the name (if there is one)
289  if hasattr(self,name) and not (getattr(self,name)==newValue):
290  # Allow items in sequences from load() statements to have
291  # degeneratate names, but if the user overwrites a name in the
292  # main config, replace it everywhere
293  if not self.__InExtendCall and isinstance(newValue, _Sequenceable):
294  self._replaceInSequences(name, newValue)
295  self.__delattr__(name)
296  self.__dict__[name]=newValue
297  if isinstance(newValue,_Labelable):
298  newValue.setLabel(name)
299  self._cloneToObjectDict[id(value)] = newValue
300  self._cloneToObjectDict[id(newValue)] = newValue
301  #now put in proper bucket
302  newValue._place(name,self)
def _replaceInSequences
Definition: Config.py:631
def __delattr__
Definition: Config.py:303
def _okToPlace
Definition: Config.py:338
def __setattr__
Definition: Config.py:253
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 141 of file Config.py.

142  def __setstate__(self, pkldict):
143  """
144  Unpickling hook.
145 
146  Since cloneToObjectDict stores a hash of objects by their
147  id() it needs to be updated when unpickling to use the
148  new object id values instantiated during the unpickle.
149 
150  """
151  self.__dict__.update(pkldict)
152  tmpDict = {}
153  for value in self._cloneToObjectDict.values():
154  tmpDict[id(value)] = value
155  self.__dict__['_cloneToObjectDict'] = tmpDict
156 
157 
def __setstate__
Definition: Config.py:141
def Config.Process._dumpConfigESPrefers (   self,
  options 
)
private

Definition at line 545 of file Config.py.

References Config.Process.es_prefers_().

Referenced by Config.Process.dumpConfig().

546  def _dumpConfigESPrefers(self, options):
547  result = ''
548  for item in self.es_prefers_().itervalues():
549  result +=options.indentation()+'es_prefer '+item.targetLabel_()+' = '+item.dumpConfig(options)
return result
def _dumpConfigESPrefers
Definition: Config.py:545
def es_prefers_
Definition: Config.py:241
def Config.Process._dumpConfigNamedList (   self,
  items,
  typeName,
  options 
)
private

Definition at line 470 of file Config.py.

Referenced by Config.Process.dumpConfig().

471  def _dumpConfigNamedList(self,items,typeName,options):
472  returnValue = ''
473  for name,item in items:
474  returnValue +=options.indentation()+typeName+' '+name+' = '+item.dumpConfig(options)
return returnValue
def _dumpConfigNamedList
Definition: Config.py:470
def Config.Process._dumpConfigOptionallyNamedList (   self,
  items,
  typeName,
  options 
)
private

Definition at line 480 of file Config.py.

Referenced by Config.Process.dumpConfig().

481  def _dumpConfigOptionallyNamedList(self,items,typeName,options):
482  returnValue = ''
483  for name,item in items:
484  if name == item.type_():
485  name = ''
486  returnValue +=options.indentation()+typeName+' '+name+' = '+item.dumpConfig(options)
return returnValue
def _dumpConfigOptionallyNamedList
Definition: Config.py:480
def Config.Process._dumpConfigUnnamedList (   self,
  items,
  typeName,
  options 
)
private

Definition at line 475 of file Config.py.

Referenced by Config.Process.dumpConfig().

476  def _dumpConfigUnnamedList(self,items,typeName,options):
477  returnValue = ''
478  for name,item in items:
479  returnValue +=options.indentation()+typeName+' = '+item.dumpConfig(options)
return returnValue
def _dumpConfigUnnamedList
Definition: Config.py:475
def Config.Process._dumpPython (   self,
  d,
  options 
)
private

Definition at line 599 of file Config.py.

Referenced by Config.Process.dumpPython().

600  def _dumpPython(self, d, options):
601  result = ''
602  for name, value in d.iteritems():
603  result += value.dumpPythonAs(name,options)+'\n'
return result
def _dumpPython
Definition: Config.py:599
def Config.Process._dumpPythonList (   self,
  d,
  options 
)
private

Definition at line 550 of file Config.py.

Referenced by Config.Process.dumpPython().

551  def _dumpPythonList(self, d, options):
552  returnValue = ''
553  if isinstance(d, DictTypes.SortedKeysDict):
554  for name,item in d.items():
555  returnValue +='process.'+name+' = '+item.dumpPython(options)+'\n\n'
556  else:
557  for name,item in sorted(d.items()):
558  returnValue +='process.'+name+' = '+item.dumpPython(options)+'\n\n'
return returnValue
def _dumpPythonList
Definition: Config.py:550
def Config.Process._findPreferred (   self,
  esname,
  d,
  args,
  kargs 
)
private

Definition at line 806 of file Config.py.

References python.Node.Node.__setattr__(), Config.Process.__setattr__(), and Config.FilteredStream.__setattr__.

807  def _findPreferred(self, esname, d,*args,**kargs):
808  # is esname a name in the dictionary?
809  if esname in d:
810  typ = d[esname].type_()
811  if typ == esname:
812  self.__setattr__( esname+"_prefer", ESPrefer(typ,*args,**kargs) )
813  else:
814  self.__setattr__( esname+"_prefer", ESPrefer(typ, esname,*args,**kargs) )
815  return True
816  else:
817  # maybe it's an unnamed ESModule?
818  found = False
819  for name, value in d.iteritems():
820  if value.type_() == esname:
821  if found:
822  raise RuntimeError("More than one ES module for "+esname)
823  found = True
824  self.__setattr__(esname+"_prefer", ESPrefer(d[esname].type_()) )
825  return found
def _findPreferred
Definition: Config.py:806
def __setattr__
Definition: Config.py:253
def Config.Process._insertInto (   self,
  parameterSet,
  itemDict 
)
private

Definition at line 646 of file Config.py.

647  def _insertInto(self, parameterSet, itemDict):
648  for name,value in itemDict.iteritems():
value.insertInto(parameterSet, name)
def _insertInto
Definition: Config.py:646
def Config.Process._insertManyInto (   self,
  parameterSet,
  label,
  itemDict,
  tracked 
)
private

Definition at line 656 of file Config.py.

657  def _insertManyInto(self, parameterSet, label, itemDict, tracked):
658  l = []
659  for name,value in itemDict.iteritems():
660  newLabel = value.nameInProcessDesc_(name)
661  l.append(newLabel)
662  value.insertInto(parameterSet, name)
663  # alphabetical order is easier to compare with old language
664  l.sort()
parameterSet.addVString(tracked, label, l)
def _insertManyInto
Definition: Config.py:656
def Config.Process._insertOneInto (   self,
  parameterSet,
  label,
  item,
  tracked 
)
private

Definition at line 649 of file Config.py.

650  def _insertOneInto(self, parameterSet, label, item, tracked):
651  vitems = []
652  if not item == None:
653  newlabel = item.nameInProcessDesc_(label)
654  vitems = [newlabel]
655  item.insertInto(parameterSet, newlabel)
parameterSet.addVString(tracked, label, vitems)
def _insertOneInto
Definition: Config.py:649
def Config.Process._insertPaths (   self,
  processPSet 
)
private

Definition at line 665 of file Config.py.

References Config.Process.endpaths_(), edm::MainParameterSet.paths_, edm::HLTGlobalStatus.paths_, GraphPath< N, E >.paths_, evf::fuep::TriggerReportHelpers.paths_, pat::TriggerEvent.paths_, edm::EventSelector.paths_, HLTPerformanceInfo.paths_, Config.Process.paths_(), edm::ModuleChanger.schedule_, edm::ScheduleInfo.schedule_, Config.Process.schedule_(), edm::SubProcess.schedule_, edm::EventProcessor.schedule_, and cmsPerfHarvest.visit().

666  def _insertPaths(self, processPSet):
667  scheduledPaths = []
668  triggerPaths = []
669  endpaths = []
670  if self.schedule_() == None:
671  # make one from triggerpaths & endpaths
672  for name,value in self.paths_().iteritems():
673  scheduledPaths.append(name)
674  triggerPaths.append(name)
675  for name,value in self.endpaths_().iteritems():
676  scheduledPaths.append(name)
677  endpaths.append(name)
678  else:
679  for path in self.schedule_():
680  pathname = path.label_()
681  scheduledPaths.append(pathname)
682  if self.endpaths_().has_key(pathname):
683  endpaths.append(pathname)
684  else:
685  triggerPaths.append(pathname)
686  processPSet.addVString(True, "@end_paths", endpaths)
687  processPSet.addVString(True, "@paths", scheduledPaths)
688  # trigger_paths are a little different
689  p = processPSet.newPSet()
690  p.addVString(True, "@trigger_paths", triggerPaths)
691  processPSet.addPSet(True, "@trigger_paths", p)
692  # add all these paths
693  pathValidator = PathValidator()
694  endpathValidator = EndPathValidator()
695  for triggername in triggerPaths:
696  #self.paths_()[triggername].insertInto(processPSet, triggername, self.sequences_())
697  pathValidator.setLabel(triggername)
698  self.paths_()[triggername].visit(pathValidator)
699  self.paths_()[triggername].insertInto(processPSet, triggername, self.__dict__)
700  for endpathname in endpaths:
701  #self.endpaths_()[endpathname].insertInto(processPSet, endpathname, self.sequences_())
702  endpathValidator.setLabel(endpathname)
703  self.endpaths_()[endpathname].visit(endpathValidator)
704  self.endpaths_()[endpathname].insertInto(processPSet, endpathname, self.__dict__)
705  processPSet.addVString(False, "@filters_on_endpaths", endpathValidator.filtersOnEndpaths)
def _insertPaths
Definition: Config.py:665
def visit
Retrieve data from a perf suite output (sub) directory, only examines TimeSize at the moment...
def schedule_
Definition: Config.py:209
def endpaths_
Definition: Config.py:201
def Config.Process._okToPlace (   self,
  name,
  mod,
  d 
)
private

Definition at line 338 of file Config.py.

References Config.Process.__isStrict.

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

339  def _okToPlace(self, name, mod, d):
340  if not self.__InExtendCall:
341  # if going
342  return True
343  elif not self.__isStrict:
344  return True
345  elif name in d:
346  # if there's an old copy, and the new one
347  # hasn't been modified, we're done. Still
348  # not quite safe if something has been defined twice.
349  # Need to add checks
350  if mod._isModified:
351  if d[name]._isModified:
352  return False
353  else:
354  return True
355  else:
356  return True
357  else:
358  return True
def _okToPlace
Definition: Config.py:338
def Config.Process._place (   self,
  name,
  mod,
  d 
)
private

Definition at line 359 of file Config.py.

References Config.Process.__isStrict, and Config.Process._okToPlace().

Referenced by Config.Process._placeAnalyzer(), Config.Process._placeEndPath(), Config.Process._placeESPrefer(), Config.Process._placeESProducer(), Config.Process._placeESSource(), Config.Process._placeFilter(), Config.Process._placeOutputModule(), Config.Process._placePath(), Config.Process._placeProducer(), Config.Process._placePSet(), Config.Process._placeSequence(), Config.Process._placeService(), Config.Process._placeVPSet(), and Config.Process.setPartialSchedule_().

360  def _place(self, name, mod, d):
361  if self._okToPlace(name, mod, d):
362  if self.__isStrict and isinstance(mod, _ModuleSequenceType):
363  d[name] = mod._postProcessFixup(self._cloneToObjectDict)
364  else:
365  d[name] = mod
366  if isinstance(mod,_Labelable):
mod.setLabel(name)
def _okToPlace
Definition: Config.py:338
def Config.Process._placeAnalyzer (   self,
  name,
  mod 
)
private

Definition at line 373 of file Config.py.

References Config.Process._place().

374  def _placeAnalyzer(self,name,mod):
self._place(name, mod, self.__analyzers)
def _placeAnalyzer
Definition: Config.py:373
def Config.Process._placeEndPath (   self,
  name,
  mod 
)
private

Definition at line 382 of file Config.py.

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

383  def _placeEndPath(self,name,mod):
384  self._validateSequence(mod, name)
385  try:
386  self._place(name, mod, self.__endpaths)
387  except ModuleCloneError, msg:
388  context = format_outerframe(4)
raise Exception("%sThe module %s in endpath %s is unknown to the process %s." %(context, msg, name, self._Process__name))
def _validateSequence
Definition: Config.py:559
def _placeEndPath
Definition: Config.py:382
def Config.Process._placeESPrefer (   self,
  name,
  mod 
)
private

Definition at line 394 of file Config.py.

References Config.Process._place().

395  def _placeESPrefer(self,name,mod):
self._place(name, mod, self.__esprefers)
def _placeESPrefer
Definition: Config.py:394
def Config.Process._placeESProducer (   self,
  name,
  mod 
)
private

Definition at line 392 of file Config.py.

References Config.Process._place().

393  def _placeESProducer(self,name,mod):
self._place(name, mod, self.__esproducers)
def _placeESProducer
Definition: Config.py:392
def Config.Process._placeESSource (   self,
  name,
  mod 
)
private

Definition at line 396 of file Config.py.

References Config.Process._place().

397  def _placeESSource(self,name,mod):
self._place(name, mod, self.__essources)
def _placeESSource
Definition: Config.py:396
def Config.Process._placeFilter (   self,
  name,
  mod 
)
private

Definition at line 371 of file Config.py.

References Config.Process._place().

372  def _placeFilter(self,name,mod):
self._place(name, mod, self.__filters)
def _placeFilter
Definition: Config.py:371
def Config.Process._placeLooper (   self,
  name,
  mod 
)
private

Definition at line 410 of file Config.py.

Referenced by Config.Process.setLooper_().

411  def _placeLooper(self,name,mod):
412  if name != 'looper':
413  raise ValueError("The label '"+name+"' can not be used for a Looper. Only 'looper' is allowed.")
414  self.__dict__['_Process__looper'] = mod
self.__dict__[mod.type_()] = mod
def _placeLooper
Definition: Config.py:410
def Config.Process._placeOutputModule (   self,
  name,
  mod 
)
private

Definition at line 367 of file Config.py.

References Config.Process._place().

368  def _placeOutputModule(self,name,mod):
self._place(name, mod, self.__outputmodules)
def _placeOutputModule
Definition: Config.py:367
def Config.Process._placePath (   self,
  name,
  mod 
)
private

Definition at line 375 of file Config.py.

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

376  def _placePath(self,name,mod):
377  self._validateSequence(mod, name)
378  try:
379  self._place(name, mod, self.__paths)
380  except ModuleCloneError, msg:
381  context = format_outerframe(4)
raise Exception("%sThe module %s in path %s is unknown to the process %s." %(context, msg, name, self._Process__name))
def _validateSequence
Definition: Config.py:559
def _placePath
Definition: Config.py:375
def Config.Process._placeProducer (   self,
  name,
  mod 
)
private

Definition at line 369 of file Config.py.

References Config.Process._place().

370  def _placeProducer(self,name,mod):
self._place(name, mod, self.__producers)
def _placeProducer
Definition: Config.py:369
def Config.Process._placePSet (   self,
  name,
  mod 
)
private

Definition at line 398 of file Config.py.

References Config.Process._place().

399  def _placePSet(self,name,mod):
self._place(name, mod, self.__psets)
def _placePSet
Definition: Config.py:398
def Config.Process._placeSequence (   self,
  name,
  mod 
)
private

Definition at line 389 of file Config.py.

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

390  def _placeSequence(self,name,mod):
391  self._validateSequence(mod, name)
self._place(name, mod, self.__sequences)
def _validateSequence
Definition: Config.py:559
def _placeSequence
Definition: Config.py:389
def Config.Process._placeService (   self,
  typeName,
  mod 
)
private

Definition at line 420 of file Config.py.

References Config.Process._place().

421  def _placeService(self,typeName,mod):
422  self._place(typeName, mod, self.__services)
self.__dict__[typeName]=mod
def _placeService
Definition: Config.py:420
def Config.Process._placeSource (   self,
  name,
  mod 
)
private
Allow the source to be referenced by 'source' or by type name

Definition at line 402 of file Config.py.

Referenced by Config.Process.setSource_().

403  def _placeSource(self,name,mod):
404  """Allow the source to be referenced by 'source' or by type name"""
405  if name != 'source':
406  raise ValueError("The label '"+name+"' can not be used for a Source. Only 'source' is allowed.")
407  if self.__dict__['_Process__source'] is not None :
408  del self.__dict__[self.__dict__['_Process__source'].type_()]
409  self.__dict__['_Process__source'] = mod
self.__dict__[mod.type_()] = mod
def _placeSource
Definition: Config.py:402
def Config.Process._placeSubProcess (   self,
  name,
  mod 
)
private

Definition at line 415 of file Config.py.

Referenced by Config.Process.setSubProcess_().

416  def _placeSubProcess(self,name,mod):
417  if name != 'subProcess':
418  raise ValueError("The label '"+name+"' can not be used for a SubProcess. Only 'subProcess' is allowed.")
419  self.__dict__['_Process__subProcess'] = mod
self.__dict__[mod.type_()] = mod
def _placeSubProcess
Definition: Config.py:415
def Config.Process._placeVPSet (   self,
  name,
  mod 
)
private

Definition at line 400 of file Config.py.

References Config.Process._place().

401  def _placeVPSet(self,name,mod):
self._place(name, mod, self.__vpsets)
def _placeVPSet
Definition: Config.py:400
def Config.Process._replaceInSequences (   self,
  label,
  new 
)
private

Definition at line 631 of file Config.py.

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

632  def _replaceInSequences(self, label, new):
633  old = getattr(self,label)
634  #TODO - replace by iterator concatenation
635  for sequenceable in self.sequences.itervalues():
636  sequenceable.replace(old,new)
637  for sequenceable in self.paths.itervalues():
638  sequenceable.replace(old,new)
639  for sequenceable in self.endpaths.itervalues():
sequenceable.replace(old,new)
def _replaceInSequences
Definition: Config.py:631
def Config.Process._sequencesInDependencyOrder (   self)
private

Definition at line 567 of file Config.py.

References python.multivaluedict.dict, join(), and Config.Process.sequences.

Referenced by Config.Process.dumpPython().

568  def _sequencesInDependencyOrder(self):
569  #for each sequence, see what other sequences it depends upon
570  returnValue=DictTypes.SortedKeysDict()
571  dependencies = {}
572  for label,seq in self.sequences.iteritems():
573  d = []
574  v = SequenceVisitor(d)
575  seq.visit(v)
576  dependencies[label]=[dep.label_() for dep in d if dep.hasLabel_()]
577  resolvedDependencies=True
578  #keep looping until we can no longer get rid of all dependencies
579  # if that happens it means we have circular dependencies
580  iterCount = 0
581  while resolvedDependencies:
582  iterCount += 1
583  resolvedDependencies = (0 != len(dependencies))
584  oldDeps = dict(dependencies)
585  for label,deps in oldDeps.iteritems():
586  # don't try too hard
587  if len(deps)==0 or iterCount > 100:
588  iterCount = 0
589  resolvedDependencies=True
590  returnValue[label]=self.sequences[label]
591  #remove this as a dependency for all other sequences
592  del dependencies[label]
593  for lb2,deps2 in dependencies.iteritems():
594  while deps2.count(label):
595  deps2.remove(label)
596  if len(dependencies):
597  raise RuntimeError("circular sequence dependency discovered \n"+
598  ",".join([label for label,junk in dependencies.iteritems()]))
return returnValue
def _sequencesInDependencyOrder
Definition: Config.py:567
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
def Config.Process._validateSequence (   self,
  sequence,
  label 
)
private

Definition at line 559 of file Config.py.

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

560  def _validateSequence(self, sequence, label):
561  # See if every module has been inserted into the process
562  try:
563  l = set()
564  nameVisitor = NodeNameVisitor(l)
565  sequence.visit(nameVisitor)
566  except:
raise RuntimeError("An entry in sequence "+label + ' has no label')
def _validateSequence
Definition: Config.py:559
def Config.Process.add_ (   self,
  value 
)
Allows addition of components which do not have to have a label, e.g. Services

Definition at line 323 of file Config.py.

References Config.Process.__isStrict.

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

324  def add_(self,value):
325  """Allows addition of components which do not have to have a label, e.g. Services"""
326  if not isinstance(value,_ConfigureComponent):
327  raise TypeError
328  if not isinstance(value,_Unlabelable):
329  raise TypeError
330  #clone the item
331  #clone the item
332  if self.__isStrict:
333  newValue =value.copy()
334  value.setIsFrozen()
335  else:
336  newValue =value
337  newValue._place('',self)
def Config.Process.analyzerNames (   self)

Definition at line 134 of file Config.py.

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

135  def analyzerNames(self):
return ' '.join(self.analyzers_().keys())
def analyzers_
Definition: Config.py:189
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
def analyzerNames
Definition: Config.py:134
def Config.Process.analyzers_ (   self)
returns a dict of the analyzers which have been added to the Process

Definition at line 189 of file Config.py.

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

190  def analyzers_(self):
191  """returns a dict of the analyzers which have been added to the Process"""
return DictTypes.FixedKeysDict(self.__analyzers)
def analyzers_
Definition: Config.py:189
def Config.Process.dumpConfig (   self,
  options = PrintOptions() 
)
return a string containing the equivalent process defined using the configuration language

Definition at line 487 of file Config.py.

References Config.Process._dumpConfigESPrefers(), Config.Process._dumpConfigNamedList(), Config.Process._dumpConfigOptionallyNamedList(), Config.Process._dumpConfigUnnamedList(), HLTMuonOfflineAnalyzer.analyzers_, Config.Process.analyzers_(), Config.Process.endpaths_(), Config.Process.es_producers_(), Config.Process.es_sources_(), pat::eventhypothesis::AndFilter.filters_, pat::eventhypothesis::OrFilter.filters_, pat::TriggerEvent.filters_, FilterOR.filters_, Config.Process.filters_(), Selection< C, Selector, StoreContainer >.filters_, Selections.filters_, FourVectorHLTOnline::PathInfo.filters_, TrigResRateMon::PathInfo.filters_, FourVectorHLTOffline::PathInfo.filters_, join(), Config.Process.looper_(), edm::EventProcessor.looper_, Config.Process.outputModules_(), edm::MainParameterSet.paths_, edm::HLTGlobalStatus.paths_, GraphPath< N, E >.paths_, evf::fuep::TriggerReportHelpers.paths_, pat::TriggerEvent.paths_, edm::EventSelector.paths_, HLTPerformanceInfo.paths_, Config.Process.paths_(), pf2pat::EventHypothesis.producers_, Config.Process.producers_(), ConfigBuilder.ConfigBuilder.schedule, Config.Process.schedule, Config.Process.sequences_(), edm::ProcessDesc.services_, Config.Process.services_(), CandOneToManyDeltaRMatcher.source_, CandOneToOneDeltaRMatcher.source_, SiStripFedCablingBuilderFromDb.source_, sistrip::SpyEventMatcher.source_, Config.Process.source_(), Config.Process.subProcess_(), edm::SubProcess.subProcess_, and edm::EventProcessor.subProcess_.

Referenced by Types.SecSource.configValue().

488  def dumpConfig(self, options=PrintOptions()):
489  """return a string containing the equivalent process defined using the configuration language"""
490  config = "process "+self.__name+" = {\n"
491  options.indent()
492  if self.source_():
493  config += options.indentation()+"source = "+self.source_().dumpConfig(options)
494  if self.looper_():
495  config += options.indentation()+"looper = "+self.looper_().dumpConfig(options)
496  if self.subProcess_():
497  config += options.indentation()+"subProcess = "+self.subProcess_().dumpConfig(options)
498 
499  config+=self._dumpConfigNamedList(self.producers_().iteritems(),
500  'module',
501  options)
502  config+=self._dumpConfigNamedList(self.filters_().iteritems(),
503  'module',
504  options)
505  config+=self._dumpConfigNamedList(self.analyzers_().iteritems(),
506  'module',
507  options)
508  config+=self._dumpConfigNamedList(self.outputModules_().iteritems(),
509  'module',
510  options)
511  config+=self._dumpConfigNamedList(self.sequences_().iteritems(),
512  'sequence',
513  options)
514  config+=self._dumpConfigNamedList(self.paths_().iteritems(),
515  'path',
516  options)
517  config+=self._dumpConfigNamedList(self.endpaths_().iteritems(),
518  'endpath',
519  options)
520  config+=self._dumpConfigUnnamedList(self.services_().iteritems(),
521  'service',
522  options)
523  config+=self._dumpConfigOptionallyNamedList(
524  self.es_producers_().iteritems(),
525  'es_module',
526  options)
527  config+=self._dumpConfigOptionallyNamedList(
528  self.es_sources_().iteritems(),
529  'es_source',
530  options)
531  config += self._dumpConfigESPrefers(options)
532  for name,item in self.psets.iteritems():
533  config +=options.indentation()+item.configTypeName()+' '+name+' = '+item.configValue(options)
534  for name,item in self.vpsets.iteritems():
535  config +=options.indentation()+'VPSet '+name+' = '+item.configValue(options)
536  if self.schedule:
537  pathNames = [p.label_() for p in self.schedule]
538  config +=options.indentation()+'schedule = {'+','.join(pathNames)+'}\n'
539 
540 # config+=self._dumpConfigNamedList(self.vpsets.iteritems(),
541 # 'VPSet',
542 # options)
543  config += "}\n"
544  options.unindent()
return config
def es_sources_
Definition: Config.py:237
def subProcess_
Definition: Config.py:183
def _dumpConfigUnnamedList
Definition: Config.py:475
def es_producers_
Definition: Config.py:233
def _dumpConfigESPrefers
Definition: Config.py:545
def _dumpConfigOptionallyNamedList
Definition: Config.py:480
def filters_
Definition: Config.py:158
def outputModules_
Definition: Config.py:193
def producers_
Definition: Config.py:167
def analyzers_
Definition: Config.py:189
def dumpConfig
Definition: Config.py:487
def services_
Definition: Config.py:229
def sequences_
Definition: Config.py:205
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
def _dumpConfigNamedList
Definition: Config.py:470
def endpaths_
Definition: Config.py:201
def Config.Process.dumpPython (   self,
  options = PrintOptions() 
)
return a string containing the equivalent process defined using the configuration language

Definition at line 604 of file Config.py.

References Config.Process._dumpPython(), Config.Process._dumpPythonList(), Config.Process._sequencesInDependencyOrder(), HLTMuonOfflineAnalyzer.analyzers_, Config.Process.analyzers_(), Config.Process.endpaths_(), Config.Process.es_prefers_(), Config.Process.es_producers_(), Config.Process.es_sources_(), pat::eventhypothesis::AndFilter.filters_, pat::eventhypothesis::OrFilter.filters_, pat::TriggerEvent.filters_, FilterOR.filters_, Config.Process.filters_(), Selection< C, Selector, StoreContainer >.filters_, Selections.filters_, FourVectorHLTOnline::PathInfo.filters_, TrigResRateMon::PathInfo.filters_, FourVectorHLTOffline::PathInfo.filters_, join(), Config.Process.looper_(), edm::EventProcessor.looper_, Config.Process.outputModules_(), edm::MainParameterSet.paths_, edm::HLTGlobalStatus.paths_, GraphPath< N, E >.paths_, evf::fuep::TriggerReportHelpers.paths_, pat::TriggerEvent.paths_, edm::EventSelector.paths_, HLTPerformanceInfo.paths_, Config.Process.paths_(), pf2pat::EventHypothesis.producers_, Config.Process.producers_(), CmsswTask.CmsswTask.psets, Config.Process.psets, ConfigBuilder.ConfigBuilder.schedule, Config.Process.schedule, edm::ProcessDesc.services_, Config.Process.services_(), CandOneToManyDeltaRMatcher.source_, CandOneToOneDeltaRMatcher.source_, SiStripFedCablingBuilderFromDb.source_, sistrip::SpyEventMatcher.source_, Config.Process.source_(), Config.Process.subProcess_(), edm::SubProcess.subProcess_, edm::EventProcessor.subProcess_, and Config.Process.vpsets.

Referenced by Mixins._Parameterizable.__addParameter(), Mixins._ParameterTypeBase.__repr__(), Mixins._Parameterizable.__repr__(), Mixins._ValidatingParameterListBase.__repr__(), Types.VPSet.__repr__(), and Mixins._Parameterizable.__setattr__().

605  def dumpPython(self, options=PrintOptions()):
606  """return a string containing the equivalent process defined using the configuration language"""
607  result = "import FWCore.ParameterSet.Config as cms\n\n"
608  result += "process = cms.Process(\""+self.__name+"\")\n\n"
609  if self.source_():
610  result += "process.source = "+self.source_().dumpPython(options)
611  if self.looper_():
612  result += "process.looper = "+self.looper_().dumpPython()
613  if self.subProcess_():
614  result += self.subProcess_().dumpPython(options)
615  result+=self._dumpPythonList(self.producers_(), options)
616  result+=self._dumpPythonList(self.filters_() , options)
617  result+=self._dumpPythonList(self.analyzers_(), options)
618  result+=self._dumpPythonList(self.outputModules_(), options)
619  result+=self._dumpPythonList(self._sequencesInDependencyOrder(), options)
620  result+=self._dumpPythonList(self.paths_(), options)
621  result+=self._dumpPythonList(self.endpaths_(), options)
622  result+=self._dumpPythonList(self.services_(), options)
623  result+=self._dumpPythonList(self.es_producers_(), options)
624  result+=self._dumpPythonList(self.es_sources_(), options)
625  result+=self._dumpPython(self.es_prefers_(), options)
626  result+=self._dumpPythonList(self.psets, options)
627  result+=self._dumpPythonList(self.vpsets, options)
628  if self.schedule:
629  pathNames = ['process.'+p.label_() for p in self.schedule]
630  result +='process.schedule = cms.Schedule('+','.join(pathNames)+')\n'
return result
def es_sources_
Definition: Config.py:237
def subProcess_
Definition: Config.py:183
def es_producers_
Definition: Config.py:233
def filters_
Definition: Config.py:158
def dumpPython
Definition: Config.py:604
def es_prefers_
Definition: Config.py:241
def _sequencesInDependencyOrder
Definition: Config.py:567
def outputModules_
Definition: Config.py:193
def producers_
Definition: Config.py:167
def analyzers_
Definition: Config.py:189
def services_
Definition: Config.py:229
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
def _dumpPythonList
Definition: Config.py:550
def _dumpPython
Definition: Config.py:599
def endpaths_
Definition: Config.py:201
def Config.Process.endpaths_ (   self)
returns a dict of the endpaths which have been added to the Process

Definition at line 201 of file Config.py.

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

202  def endpaths_(self):
203  """returns a dict of the endpaths which have been added to the Process"""
return DictTypes.SortedAndFixedKeysDict(self.__endpaths)
def endpaths_
Definition: Config.py:201
def Config.Process.es_prefers_ (   self)
returns a dict of the es_prefers which have been added to the Process

Definition at line 241 of file Config.py.

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

242  def es_prefers_(self):
243  """returns a dict of the es_prefers which have been added to the Process"""
return DictTypes.FixedKeysDict(self.__esprefers)
def es_prefers_
Definition: Config.py:241
def Config.Process.es_producers_ (   self)
returns a dict of the esproducers which have been added to the Process

Definition at line 233 of file Config.py.

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

234  def es_producers_(self):
235  """returns a dict of the esproducers which have been added to the Process"""
return DictTypes.FixedKeysDict(self.__esproducers)
def es_producers_
Definition: Config.py:233
def Config.Process.es_sources_ (   self)
returns a the es_sources which have been added to the Process

Definition at line 237 of file Config.py.

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

238  def es_sources_(self):
239  """returns a the es_sources which have been added to the Process"""
return DictTypes.FixedKeysDict(self.__essources)
def es_sources_
Definition: Config.py:237
def Config.Process.extend (   self,
  other,
  items = () 
)
Look in other and find types which we can use

Definition at line 427 of file Config.py.

References python.Node.Node.__setattr__(), Config.Process.__setattr__(), Config.FilteredStream.__setattr__, Config.Process.add_(), python.multivaluedict.dict, and dir.

Referenced by hltFindDuplicates.ModuleList.__init__(), Config.Process.load(), and Mixins._ValidatingParameterListBase.setValue().

428  def extend(self,other,items=()):
429  """Look in other and find types which we can use"""
430  # enable explicit check to avoid overwriting of existing objects
431  self.__dict__['_Process__InExtendCall'] = True
432 
433  seqs = dict()
434  labelled = dict()
435  for name in dir(other):
436  #'from XX import *' ignores these, and so should we.
437  if name.startswith('_'):
438  continue
439  item = getattr(other,name)
440  if name == "source" or name == "looper" or name == "subProcess":
441  self.__setattr__(name,item)
442  elif isinstance(item,_ModuleSequenceType):
443  seqs[name]=item
444  elif isinstance(item,_Labelable):
445  self.__setattr__(name,item)
446  labelled[name]=item
447  try:
448  item.label_()
449  except:
450  item.setLabel(name)
451  continue
452  elif isinstance(item,Schedule):
453  self.__setattr__(name,item)
454  elif isinstance(item,_Unlabelable):
455  self.add_(item)
456 
457  #now create a sequence which uses the newly made items
458  for name in seqs.iterkeys():
459  seq = seqs[name]
460  #newSeq = seq.copy()
461  #
462  if id(seq) not in self._cloneToObjectDict:
463  self.__setattr__(name,seq)
464  else:
465  newSeq = self._cloneToObjectDict[id(seq)]
466  self.__dict__[name]=newSeq
467  newSeq.setLabel(name)
468  #now put in proper bucket
469  newSeq._place(name,self)
self.__dict__['_Process__InExtendCall'] = False
def __setattr__
Definition: Config.py:253
dbl *** dir
Definition: mlp_gen.cc:35
def Config.Process.fillProcessDesc (   self,
  processPSet 
)

Definition at line 738 of file Config.py.

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

739  def fillProcessDesc(self, processPSet):
740  class ServiceInjectorAdaptor(object):
741  def __init__(self,ppset,thelist):
742  self.__thelist = thelist
743  self.__processPSet = ppset
744  def addService(self,pset):
745  self.__thelist.append(pset)
746  def newPSet(self):
747  return self.__processPSet.newPSet()
748  self.validate()
749  processPSet.addString(True, "@process_name", self.name_())
750  all_modules = self.producers_().copy()
751  all_modules.update(self.filters_())
752  all_modules.update(self.analyzers_())
753  all_modules.update(self.outputModules_())
754  self._insertInto(processPSet, self.psets_())
755  self._insertInto(processPSet, self.vpsets_())
756  self._insertManyInto(processPSet, "@all_modules", all_modules, True)
757  self._insertOneInto(processPSet, "@all_sources", self.source_(), True)
758  self._insertOneInto(processPSet, "@all_loopers", self.looper_(), True)
759  self._insertOneInto(processPSet, "@all_subprocesses", self.subProcess_(), False)
760  self._insertManyInto(processPSet, "@all_esmodules", self.es_producers_(), True)
761  self._insertManyInto(processPSet, "@all_essources", self.es_sources_(), True)
762  self._insertManyInto(processPSet, "@all_esprefers", self.es_prefers_(), True)
763  self._insertPaths(processPSet)
764  #handle services differently
765  services = []
766  for n in self.services_():
767  getattr(self,n).insertInto(ServiceInjectorAdaptor(processPSet,services))
768  processPSet.addVPSet(False,"services",services)
769  return processPSet
def es_sources_
Definition: Config.py:237
def subProcess_
Definition: Config.py:183
def _insertManyInto
Definition: Config.py:656
def es_producers_
Definition: Config.py:233
def filters_
Definition: Config.py:158
def es_prefers_
Definition: Config.py:241
def _insertPaths
Definition: Config.py:665
def outputModules_
Definition: Config.py:193
def producers_
Definition: Config.py:167
def fillProcessDesc
Definition: Config.py:738
def __init__
Definition: Config.py:102
def _insertInto
Definition: Config.py:646
def analyzers_
Definition: Config.py:189
def services_
Definition: Config.py:229
def validate
Definition: Config.py:770
def _insertOneInto
Definition: Config.py:649
list object
Definition: dbtoconf.py:77
def Config.Process.filterNames (   self)

Definition at line 136 of file Config.py.

References pat::eventhypothesis::AndFilter.filters_, pat::eventhypothesis::OrFilter.filters_, pat::TriggerEvent.filters_, FilterOR.filters_, Config.Process.filters_(), Selection< C, Selector, StoreContainer >.filters_, Selections.filters_, FourVectorHLTOnline::PathInfo.filters_, TrigResRateMon::PathInfo.filters_, FourVectorHLTOffline::PathInfo.filters_, join(), and relativeConstraints.keys.

137  def filterNames(self):
return ' '.join(self.filters_().keys())
def filterNames
Definition: Config.py:136
def filters_
Definition: Config.py:158
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
def Config.Process.filters_ (   self)
returns a dict of the filters which have been added to the Process

Definition at line 158 of file Config.py.

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

159  def filters_(self):
160  """returns a dict of the filters which have been added to the Process"""
return DictTypes.FixedKeysDict(self.__filters)
def filters_
Definition: Config.py:158
def Config.Process.globalReplace (   self,
  label,
  new 
)
Replace the item with label 'label' by object 'new' in the process and all sequences/paths

Definition at line 640 of file Config.py.

References Config.Process._replaceInSequences().

641  def globalReplace(self,label,new):
642  """ Replace the item with label 'label' by object 'new' in the process and all sequences/paths"""
643  if not hasattr(self,label):
644  raise LookupError("process has no item of label "+label)
645  self._replaceInSequences(label, new)
setattr(self,label,new)
def _replaceInSequences
Definition: Config.py:631
def globalReplace
Definition: Config.py:640
def Config.Process.load (   self,
  moduleName 
)

Definition at line 423 of file Config.py.

References ora::ContainerSchema.extend(), python.seqvaluedict.seqdict.extend(), svgfig.SVG.extend(), and Config.Process.extend().

424  def load(self, moduleName):
425  moduleName = moduleName.replace("/",".")
426  module = __import__(moduleName)
self.extend(sys.modules[moduleName])
def Config.Process.looper_ (   self)
returns the looper which has been added to the Process or None if none have been added

Definition at line 177 of file Config.py.

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

178  def looper_(self):
179  """returns the looper which has been added to the Process or None if none have been added"""
return self.__looper
def Config.Process.name_ (   self)

Definition at line 162 of file Config.py.

163  def name_(self):
return self.__name
def Config.Process.outputModules_ (   self)
returns a dict of the output modules which have been added to the Process

Definition at line 193 of file Config.py.

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

194  def outputModules_(self):
195  """returns a dict of the output modules which have been added to the Process"""
return DictTypes.FixedKeysDict(self.__outputmodules)
def outputModules_
Definition: Config.py:193
def Config.Process.pathNames (   self)

Definition at line 138 of file Config.py.

References join(), relativeConstraints.keys, edm::MainParameterSet.paths_, edm::HLTGlobalStatus.paths_, GraphPath< N, E >.paths_, evf::fuep::TriggerReportHelpers.paths_, pat::TriggerEvent.paths_, edm::EventSelector.paths_, HLTPerformanceInfo.paths_, and Config.Process.paths_().

139  def pathNames(self):
140  return ' '.join(self.paths_().keys())
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
def pathNames
Definition: Config.py:138
def Config.Process.paths_ (   self)
returns a dict of the paths which have been added to the Process

Definition at line 197 of file Config.py.

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

198  def paths_(self):
199  """returns a dict of the paths which have been added to the Process"""
return DictTypes.SortedAndFixedKeysDict(self.__paths)
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 which 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 777 of file Config.py.

778  def prefer(self, esmodule,*args,**kargs):
779  """Prefer this ES source or producer. The argument can
780  either be an object label, e.g.,
781  process.prefer(process.juicerProducer) (not supported yet)
782  or a name of an ESSource or ESProducer
783  process.prefer("juicer")
784  or a type of unnamed ESSource or ESProducer
785  process.prefer("JuicerProducer")
786  In addition, you can pass as a labelled arguments the name of the Record you wish to
787  prefer where the type passed is a cms.vstring and that vstring can contain the
788  name of the C++ types in the Record which are being preferred, e.g.,
789  #prefer all data in record 'OrangeRecord' from 'juicer'
790  process.prefer("juicer", OrangeRecord=cms.vstring())
791  or
792  #prefer only "Orange" data in "OrangeRecord" from "juicer"
793  process.prefer("juicer", OrangeRecord=cms.vstring("Orange"))
794  or
795  #prefer only "Orange" data with label "ExtraPulp" in "OrangeRecord" from "juicer"
796  ESPrefer("ESJuicerProd", OrangeRecord=cms.vstring("Orange/ExtraPulp"))
797  """
798  # see if this refers to a named ESProducer
799  if isinstance(esmodule, ESSource) or isinstance(esmodule, ESProducer):
800  raise RuntimeError("Syntax of process.prefer(process.esmodule) not supported yet")
801  elif self._findPreferred(esmodule, self.es_producers_(),*args,**kargs) or \
802  self._findPreferred(esmodule, self.es_sources_(),*args,**kargs):
803  pass
804  else:
805  raise RuntimeError("Cannot resolve prefer for "+repr(esmodule))
def es_sources_
Definition: Config.py:237
def _findPreferred
Definition: Config.py:806
def es_producers_
Definition: Config.py:233
def Config.Process.producerNames (   self)

Definition at line 132 of file Config.py.

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

133  def producerNames(self):
return ' '.join(self.producers_().keys())
def producers_
Definition: Config.py:167
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
def producerNames
Definition: Config.py:132
def Config.Process.producers_ (   self)
returns a dict of the producers which have been added to the Process

Definition at line 167 of file Config.py.

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

168  def producers_(self):
169  """returns a dict of the producers which have been added to the Process"""
return DictTypes.FixedKeysDict(self.__producers)
def producers_
Definition: Config.py:167
def Config.Process.prune (   self)
Remove clutter from the process which we think is unnecessary:
PSets, and unused modules.  Not working yet, because I need to remove
all unneeded sequences and paths that contain removed modules 

Definition at line 706 of file Config.py.

References HLTMuonOfflineAnalyzer.analyzers_, Config.Process.analyzers_(), pat::eventhypothesis::AndFilter.filters_, pat::eventhypothesis::OrFilter.filters_, pat::TriggerEvent.filters_, FilterOR.filters_, Config.Process.filters_(), Selection< C, Selector, StoreContainer >.filters_, Selections.filters_, FourVectorHLTOnline::PathInfo.filters_, TrigResRateMon::PathInfo.filters_, FourVectorHLTOffline::PathInfo.filters_, pf2pat::EventHypothesis.producers_, Config.Process.producers_(), Config.Process.pruneModules(), Config.Process.pruneSequences(), Config.Process.psets_(), edm::ModuleChanger.schedule_, edm::ScheduleInfo.schedule_, Config.Process.schedule_(), edm::SubProcess.schedule_, edm::EventProcessor.schedule_, and Config.Process.vpsets_().

707  def prune(self):
708  """ Remove clutter from the process which we think is unnecessary:
709  PSets, and unused modules. Not working yet, because I need to remove
710  all unneeded sequences and paths that contain removed modules """
711  for name in self.psets_():
712  delattr(self, name)
713  for name in self.vpsets_():
714  delattr(self, name)
715 
716  if self.schedule_():
717  self.pruneSequences()
718  scheduledNames = self.schedule_().moduleNames()
719  self.pruneModules(self.producers_(), scheduledNames)
720  self.pruneModules(self.filters_(), scheduledNames)
721  self.pruneModules(self.analyzers_(), scheduledNames)
def filters_
Definition: Config.py:158
def producers_
Definition: Config.py:167
def analyzers_
Definition: Config.py:189
def schedule_
Definition: Config.py:209
def pruneModules
Definition: Config.py:732
def pruneSequences
Definition: Config.py:722
def Config.Process.pruneModules (   self,
  d,
  scheduledNames 
)

Definition at line 732 of file Config.py.

Referenced by Config.Process.prune().

733  def pruneModules(self, d, scheduledNames):
734  moduleNames = set(d.keys())
735  junk = moduleNames - scheduledNames
736  for name in junk:
737  delattr(self, name)
def pruneModules
Definition: Config.py:732
def Config.Process.pruneSequences (   self)

Definition at line 722 of file Config.py.

Referenced by Config.Process.prune().

723  def pruneSequences(self):
724  scheduledSequences = []
725  visitor = SequenceVisitor(scheduledSequences)
726  #self.schedule_()._seq.visit(visitor)
727  #scheduledSequenceNames = set([seq.label_() for seq in scheduledSequences])
728  #sequenceNames = set(self.sequences_().keys())
729  #junk = sequenceNames - scheduledSequenceNames
730  #for name in junk:
731  # delattr(self, name)
def pruneSequences
Definition: Config.py:722
def Config.Process.psets_ (   self)
returns a dict of the PSets which have been added to the Process

Definition at line 245 of file Config.py.

Referenced by Config.Process.prune().

246  def psets_(self):
247  """returns a dict of the PSets which have been added to the Process"""
return DictTypes.FixedKeysDict(self.__psets)
def Config.Process.schedule_ (   self)
returns the schedule which has been added to the Process or None if none have been added

Definition at line 209 of file Config.py.

Referenced by Config.Process._insertPaths(), and Config.Process.prune().

210  def schedule_(self):
211  """returns the schedule which has been added to the Process or None if none have been added"""
return self.__schedule
def schedule_
Definition: Config.py:209
def Config.Process.sequences_ (   self)
returns a dict of the sequences which have been added to the Process

Definition at line 205 of file Config.py.

Referenced by Config.Process.dumpConfig().

206  def sequences_(self):
207  """returns a dict of the sequences which have been added to the Process"""
return DictTypes.FixedKeysDict(self.__sequences)
def sequences_
Definition: Config.py:205
def Config.Process.services_ (   self)
returns a dict of the services which have been added to the Process

Definition at line 229 of file Config.py.

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

230  def services_(self):
231  """returns a dict of the services which have been added to the Process"""
return DictTypes.FixedKeysDict(self.__services)
def services_
Definition: Config.py:229
def Config.Process.setLooper_ (   self,
  lpr 
)

Definition at line 180 of file Config.py.

References Config.Process._placeLooper().

181  def setLooper_(self,lpr):
self._placeLooper('looper',lpr)
def setLooper_
Definition: Config.py:180
def _placeLooper
Definition: Config.py:410
def Config.Process.setName_ (   self,
  name 
)

Definition at line 164 of file Config.py.

165  def setName_(self,name):
self.__dict__['_Process__name'] = name
def setName_
Definition: Config.py:164
def Config.Process.setPartialSchedule_ (   self,
  sch,
  label 
)

Definition at line 212 of file Config.py.

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

213  def setPartialSchedule_(self,sch,label):
214  if label == "schedule":
215  self.setSchedule_(sch)
216  else:
self._place(label, sch, self.__partialschedules)
def setSchedule_
Definition: Config.py:217
def setPartialSchedule_
Definition: Config.py:212
def Config.Process.setSchedule_ (   self,
  sch 
)

Definition at line 217 of file Config.py.

Referenced by Config.Process.setPartialSchedule_().

218  def setSchedule_(self,sch):
219  # See if every module has been inserted into the process
220  index = 0
221  try:
222  for p in sch:
223  p.label_()
224  index +=1
225  except:
226  raise RuntimeError("The path at index "+str(index)+" in the Schedule was not attached to the process.")
227 
self.__dict__['_Process__schedule'] = sch
def setSchedule_
Definition: Config.py:217
def Config.Process.setSource_ (   self,
  src 
)

Definition at line 174 of file Config.py.

References Config.Process._placeSource().

175  def setSource_(self,src):
self._placeSource('source',src)
def setSource_
Definition: Config.py:174
def _placeSource
Definition: Config.py:402
def Config.Process.setStrict (   self,
  value 
)

Definition at line 127 of file Config.py.

References Config.Process.__isStrict.

128  def setStrict(self, value):
129  self.__isStrict = value
130  _Module.__isStrict__ = True
def setStrict
Definition: Config.py:127
def Config.Process.setSubProcess_ (   self,
  lpr 
)

Definition at line 186 of file Config.py.

References Config.Process._placeSubProcess().

187  def setSubProcess_(self,lpr):
self._placeSubProcess('subProcess',lpr)
def setSubProcess_
Definition: Config.py:186
def _placeSubProcess
Definition: Config.py:415
def Config.Process.source_ (   self)
returns the source which has been added to the Process or None if none have been added

Definition at line 171 of file Config.py.

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

172  def source_(self):
173  """returns the source which has been added to the Process or None if none have been added"""
return self.__source
def Config.Process.subProcess_ (   self)
returns the sub-process which has been added to the Process or None if none have been added

Definition at line 183 of file Config.py.

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

184  def subProcess_(self):
185  """returns the sub-process which has been added to the Process or None if none have been added"""
return self.__subProcess
def subProcess_
Definition: Config.py:183
def Config.Process.validate (   self)

Definition at line 770 of file Config.py.

771  def validate(self):
772  # check if there's some input
773  # Breaks too many unit tests for now
774  #if self.source_() == None and self.looper_() == None:
775  # raise RuntimeError("No input source was found for this process")
776  pass
def validate
Definition: Config.py:770
def Config.Process.vpsets_ (   self)
returns a dict of the VPSets which have been added to the Process

Definition at line 249 of file Config.py.

Referenced by Config.Process.prune().

250  def vpsets_(self):
251  """returns a dict of the VPSets which have been added to the Process"""
return DictTypes.FixedKeysDict(self.__vpsets)

Member Data Documentation

Config.Process.__isStrict
private

Definition at line 125 of file Config.py.

Referenced by Config.Process.__setattr__(), Config.Process._okToPlace(), Config.Process._place(), Config.Process.add_(), and Config.Process.setStrict().

Config.Process.__processPSet
private

Definition at line 742 of file Config.py.

Config.Process.__thelist
private

Definition at line 741 of file Config.py.

Property Documentation

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

Definition at line 192 of file Config.py.

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

Definition at line 204 of file Config.py.

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

Definition at line 244 of file Config.py.

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

Definition at line 236 of file Config.py.

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

Definition at line 240 of file Config.py.

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

Definition at line 161 of file Config.py.

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

Definition at line 182 of file Config.py.

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

Definition at line 196 of file Config.py.

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

Definition at line 200 of file Config.py.

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

Definition at line 166 of file Config.py.

Referenced by python.Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigDataAccessor.dumpPython(), python.Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigDataAccessor.open(), python.Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigDataAccessor.outputEventContent(), python.Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigDataAccessor.setProcess(), and python.Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigDataAccessor.setProperty().

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

Definition at line 170 of file Config.py.

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

Definition at line 248 of file Config.py.

Referenced by Config.Process.dumpPython().

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

Definition at line 228 of file Config.py.

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

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

Definition at line 208 of file Config.py.

Referenced by Config.Process._sequencesInDependencyOrder().

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

Definition at line 232 of file Config.py.

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

Definition at line 176 of file Config.py.

Referenced by confdb.HLTProcess._build_source(), and confdb.HLTProcess.build_source().

Config.Process.subProcess = property(subProcess_,setSubProcess_,doc='the SubProcess or None if not set')
static

Definition at line 188 of file Config.py.

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

Definition at line 252 of file Config.py.

Referenced by Config.Process.dumpPython().