CMS 3D CMS Logo

Config::Process Class Reference

List of all members.

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 include
def load
def looper_
def name_
def outputModules_
def pathNames
def paths_
def prefer
def producerNames
def producers_
def psets_
def schedule_
def sequences_
def services_
def setLooper_
def setName_
def setPartialSchedule_
def setSchedule_
def setSource_
def setStrict
def source_
def vpsets_

Static Public Attributes

tuple analyzers = property(analyzers_,doc="dictionary containing the analyzers for the process")
tuple endpaths = property(endpaths_,doc="dictionary containing the endpaths for the process")
tuple es_prefers = property(es_prefers_,doc="dictionary containing the es_prefers for the process")
tuple es_producers = property(es_producers_,doc="dictionary containing the es_producers for the process")
tuple es_sources = property(es_sources_,doc="dictionary containing the es_sources for the process")
tuple filters = property(filters_, doc="dictionary containing the filters for the process")
tuple looper = property(looper_,setLooper_,doc='the main looper or None if not set')
tuple outputModules = property(outputModules_,doc="dictionary containing the output_modules for the process")
tuple paths = property(paths_,doc="dictionary containing the paths for the process")
tuple process = property(name_,setName_, doc="name of the process")
tuple producers = property(producers_,doc="dictionary containing the producers for the process")
tuple psets = property(psets_,doc="dictionary containing the PSets for the process")
tuple schedule = property(schedule_,setSchedule_,doc='the schedule or None if not set')
tuple sequences = property(sequences_,doc="dictionary containing the sequences for the process")
tuple services = property(services_,doc="dictionary containing the services for the process")
tuple source = property(source_,setSource_,doc='the main source or None if not set')
tuple 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 _insertServices
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 _placeVPSet
def _sequencesInDependencyOrder

Private Attributes

 __isStrict


Detailed Description

Root class for a CMS configuration process

Definition at line 40 of file Config.py.


Member Function Documentation

def Config::Process::__delattr__ (   self,
  name 
)

Definition at line 216 of file Config.py.

00216                               :
00217         if not hasattr(self,name):
00218             raise KeyError('process does not know about '+name)
00219         elif name.startswith('_Process__'):
00220             raise ValueError('this attribute cannot be deleted')
00221         else: 
00222             # we have to remove it from all dictionaries/registries   
00223             dicts = [item for item in self.__dict__.values() if (type(item)==dict or type(item)==DictTypes.SortedKeysDict)]
00224             for reg in dicts:
00225                 if reg.has_key(name): del reg[name]
00226             # if it was a labelable object, the label needs to be removed
00227             obj = getattr(self,name)
00228             if isinstance(obj,_Labelable):
00229                 getattr(self,name).setLabel(None)
00230             # now remove it from the process itself
00231             try:
00232                 del self.__dict__[name]    
00233             except:
00234                 pass
00235             
    def add_(self,value):

def Config::Process::__init__ (   self,
  name 
)

Definition at line 42 of file Config.py.

00042                            :
00043         self.__dict__['_Process__name'] = name
00044         self.__dict__['_Process__filters'] = {}
00045         self.__dict__['_Process__producers'] = {}
00046         self.__dict__['_Process__source'] = None
00047         self.__dict__['_Process__looper'] = None
00048         self.__dict__['_Process__schedule'] = None
00049         self.__dict__['_Process__analyzers'] = {}
00050         self.__dict__['_Process__outputmodules'] = {}
00051         self.__dict__['_Process__paths'] = DictTypes.SortedKeysDict()    # have to keep the order
00052         self.__dict__['_Process__endpaths'] = DictTypes.SortedKeysDict() # of definition
00053         self.__dict__['_Process__sequences'] = {}
00054         self.__dict__['_Process__services'] = {}
00055         self.__dict__['_Process__essources'] = {}
00056         self.__dict__['_Process__esproducers'] = {}
00057         self.__dict__['_Process__esprefers'] = {}
00058         self.__dict__['_Process__psets']={}
00059         self.__dict__['_Process__vpsets']={}
00060         self.__dict__['_cloneToObjectDict'] = {}
00061         # policy switch to avoid object overwriting during extend/load
00062         self.__dict__['_Process__OverWriteCheck'] = False
00063         self.__dict__['_Process__partialschedules'] = {}
00064         self.__isStrict = False
00065 
    def setStrict(self, value):

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

Definition at line 177 of file Config.py.

00177                                     :
00178         # check if the name is well-formed (only _ and alphanumerics are allowed)  
00179         if not name.replace('_','').isalnum():
00180             raise ValueError('The label '+name+' contains forbiden characters')
00181         
00182         # private variable exempt from all this 
00183         if name.startswith('_Process__'):
00184             self.__dict__[name]=value
00185             return
00186         if not isinstance(value,_ConfigureComponent):
00187             raise TypeError("can only assign labels to an object which inherits from '_ConfigureComponent'\n"
00188                             +"an instance of "+str(type(value))+" will not work")
00189         if not isinstance(value,_Labelable) and not isinstance(value,Source) and not isinstance(value,Looper) and not isinstance(value,Schedule):
00190             if name == value.type_():
00191                 self.add_(value)
00192                 return
00193             else:
00194                 raise TypeError("an instance of "+str(type(value))+" can not be assigned the label '"+name+"'.\n"+
00195                                 "Please either use the label '"+value.type_()+" or use the 'add_' method instead.")
00196         #clone the item
00197         if self.__isStrict:
00198             newValue =value.copy()
00199             value.setIsFrozen()
00200         else:
00201             newValue =value
00202         if not self._okToPlace(name, value, self.__dict__):
00203             print "WARNING: trying to override definition of process."+name
00204             return
00205         # remove the old object of the name (if there is one) 
00206         if hasattr(self,name) and not (getattr(self,name)==newValue):
00207             self.__delattr__(name)
00208         self.__dict__[name]=newValue
00209         if isinstance(newValue,_Labelable):
00210             newValue.setLabel(name)
00211             self._cloneToObjectDict[id(value)] = newValue
00212             self._cloneToObjectDict[id(newValue)] = newValue
00213         #now put in proper bucket
00214         newValue._place(name,self)
00215         
    def __delattr__(self,name):

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

00080                                    :
00081         """
00082         Unpickling hook.
00083 
00084         Since cloneToObjectDict stores a hash of objects by their
00085         id() it needs to be updated when unpickling to use the
00086         new object id values instantiated during the unpickle.
00087         
00088         """
00089         self.__dict__.update(pkldict)
00090         tmpDict = {}
00091         for value in self._cloneToObjectDict.values():
00092             tmpDict[id(value)] = value
00093         self.__dict__['_cloneToObjectDict'] = tmpDict
00094         
00095 
00096         
    def filters_(self):

def Config::Process::_dumpConfigESPrefers (   self,
  options 
) [private]

Definition at line 449 of file Config.py.

00449                                            :
00450         result = ''
00451         for item in self.es_prefers_().itervalues():
00452             result +=options.indentation()+'es_prefer '+item.targetLabel_()+' = '+item.dumpConfig(options)
00453         return result
    def _dumpPythonList(self, d, options):

def Config::Process::_dumpConfigNamedList (   self,
  items,
  typeName,
  options 
) [private]

Definition at line 377 of file Config.py.

00377                                                          :
00378         returnValue = ''
00379         for name,item in items:
00380             returnValue +=options.indentation()+typeName+' '+name+' = '+item.dumpConfig(options)
00381         return returnValue    
    def _dumpConfigUnnamedList(self,items,typeName,options):

def Config::Process::_dumpConfigOptionallyNamedList (   self,
  items,
  typeName,
  options 
) [private]

Definition at line 387 of file Config.py.

00387                                                                    :
00388         returnValue = ''
00389         for name,item in items:
00390             if name == item.type_():
00391                 name = ''
00392             returnValue +=options.indentation()+typeName+' '+name+' = '+item.dumpConfig(options)
00393         return returnValue
    def dumpConfig(self, options=PrintOptions()):

def Config::Process::_dumpConfigUnnamedList (   self,
  items,
  typeName,
  options 
) [private]

Definition at line 382 of file Config.py.

00382                                                            :
00383         returnValue = ''
00384         for name,item in items:
00385             returnValue +=options.indentation()+typeName+' = '+item.dumpConfig(options)
00386         return returnValue
    def _dumpConfigOptionallyNamedList(self,items,typeName,options):

def Config::Process::_dumpPython (   self,
  d,
  options 
) [private]

Definition at line 491 of file Config.py.

00491                                      :
00492         result = ''
00493         for name, value in d.iteritems():
00494            result += value.dumpPythonAs(name,options)+'\n'
00495         return result
    def dumpPython(self, options=PrintOptions()):

def Config::Process::_dumpPythonList (   self,
  d,
  options 
) [private]

Definition at line 454 of file Config.py.

00454                                          :
00455         returnValue = ''
00456         for name,item in d.iteritems():
00457             returnValue +='process.'+name+' = '+item.dumpPython(options)+'\n\n'
00458         return returnValue
    def _sequencesInDependencyOrder(self):

def Config::Process::_findPreferred (   self,
  esname,
  d,
  args,
  kargs 
) [private]

Definition at line 646 of file Config.py.

00646                                                      :
00647         # is esname a name in the dictionary?
00648         if esname in d:
00649             typ = d[esname].type_()
00650             if typ == esname:
00651                 self.__setattr__( esname+"_prefer", ESPrefer(typ,*args,**kargs) )
00652             else:
00653                 self.__setattr__( esname+"_prefer", ESPrefer(typ, esname,*args,**kargs) )
00654             return True
00655         else:
00656             # maybe it's an unnamed ESModule?
00657             found = False
00658             for name, value in d.iteritems():
00659                if value.type_() == esname:
00660                   if found:
00661                       raise RuntimeError("More than one ES module for "+esname)
00662                   found = True
00663                   self.__setattr__(esname+"_prefer",  ESPrefer(d[esname].type_()) )
00664             return found
00665          
def include(fileName):

def Config::Process::_insertInto (   self,
  parameterSet,
  itemDict 
) [private]

Definition at line 536 of file Config.py.

00536                                                  :
00537         for name,value in itemDict.iteritems():
00538             value.insertInto(parameterSet, name)
    def _insertOneInto(self, parameterSet, label, item):

def Config::Process::_insertManyInto (   self,
  parameterSet,
  label,
  itemDict 
) [private]

Definition at line 546 of file Config.py.

00546                                                             :
00547         l = []
00548         for name,value in itemDict.iteritems():
00549           newLabel = value.nameInProcessDesc_(name)
00550           l.append(newLabel)
00551           value.insertInto(parameterSet, name)
00552         # alphabetical order is easier to compare with old language
00553         l.sort()
00554         parameterSet.addVString(True, label, l)
    def _insertServices(self, processDesc, itemDict):

def Config::Process::_insertOneInto (   self,
  parameterSet,
  label,
  item 
) [private]

Definition at line 539 of file Config.py.

00539                                                        :
00540         vitems = []
00541         if not item == None:
00542             newlabel = item.nameInProcessDesc_(label)
00543             vitems = [newlabel]
00544             item.insertInto(parameterSet, newlabel)
00545         parameterSet.addVString(True, label, vitems)
    def _insertManyInto(self, parameterSet, label, itemDict):

def Config::Process::_insertPaths (   self,
  processDesc,
  processPSet 
) [private]

Definition at line 558 of file Config.py.

00558                                                     :
00559         scheduledPaths = []
00560         triggerPaths = []
00561         endpaths = []
00562         if self.schedule_() == None:
00563             # make one from triggerpaths & endpaths
00564             for name,value in self.paths_().iteritems():
00565                 scheduledPaths.append(name)
00566                 triggerPaths.append(name)
00567             for name,value in self.endpaths_().iteritems():
00568                 scheduledPaths.append(name)
00569                 endpaths.append(name)
00570         else:
00571             for path in self.schedule_():
00572                pathname = path.label_()
00573                scheduledPaths.append(pathname)
00574                if self.endpaths_().has_key(pathname):
00575                    endpaths.append(pathname)
00576                else:
00577                    triggerPaths.append(pathname)
00578         processPSet.addVString(True, "@end_paths", endpaths)
00579         processPSet.addVString(True, "@paths", scheduledPaths)
00580         # trigger_paths are a little different
00581         p = processDesc.newPSet()
00582         p.addVString(True, "@trigger_paths", triggerPaths)
00583         processPSet.addPSet(False, "@trigger_paths", p)
00584         # add all these paths
00585         #pathValidator = PathValidator()
00586         #endpathValidator = EndPathValidator()
00587         for triggername in triggerPaths:
00588             #self.paths_()[triggername].insertInto(processPSet, triggername, self.sequences_())
00589             #self.paths_()[triggername].visit(pathValidator)
00590             self.paths_()[triggername].insertInto(processPSet, triggername, self.__dict__)
00591         for endpathname in endpaths:
00592             #self.endpaths_()[endpathname].insertInto(processPSet, endpathname, self.sequences_())
00593             #self.endpaths_()[endpathname].visit(endpathValidator)
00594             self.endpaths_()[endpathname].insertInto(processPSet, endpathname, self.__dict__)
00595         # all the placeholders should be resolved now, so...
00596         #if self.schedule_() != None:
00597         #    self.schedule_().enforceDependencies()
00598         
    def fillProcessDesc(self, processDesc, processPSet):

def Config::Process::_insertServices (   self,
  processDesc,
  itemDict 
) [private]

Definition at line 555 of file Config.py.

00555                                                     :
00556         for name,value in itemDict.iteritems():
00557            value.insertInto(processDesc)
    def _insertPaths(self, processDesc, processPSet):

def Config::Process::_okToPlace (   self,
  name,
  mod,
  d 
) [private]

Definition at line 251 of file Config.py.

00251                                       :
00252         if not self.__OverWriteCheck:  
00253             # if going     
00254             return True
00255         elif not self.__isStrict:
00256             return True
00257         elif name in d:
00258             # if there's an old copy, and the new one
00259             # hasn't been modified, we're done.  Still
00260             # not quite safe if something has been defined twice.
00261             #  Need to add checks
00262             if mod._isModified:
00263                 if d[name]._isModified:
00264                     return False
00265                 else:
00266                     return True
00267             else:
00268                 return False
00269         else:
00270             return True
00271 
    def _place(self, name, mod, d):

def Config::Process::_place (   self,
  name,
  mod,
  d 
) [private]

Definition at line 272 of file Config.py.

00272                                   :
00273         if self._okToPlace(name, mod, d):
00274             if self.__isStrict and isinstance(mod, _ModuleSequenceType):
00275                 d[name] = mod._postProcessFixup(self._cloneToObjectDict)
00276             else:
00277                 d[name] = mod
00278             if isinstance(mod,_Labelable):
00279                mod.setLabel(name)
    def _placeOutputModule(self,name,mod):

def Config::Process::_placeAnalyzer (   self,
  name,
  mod 
) [private]

Definition at line 286 of file Config.py.

00286                                      :
00287         self._place(name, mod, self.__analyzers)
    def _placePath(self,name,mod):

def Config::Process::_placeEndPath (   self,
  name,
  mod 
) [private]

Definition at line 294 of file Config.py.

00294                                     :
00295         try: 
00296             self._place(name, mod, self.__endpaths)
00297         except ModuleCloneError, msg:
00298             context = format_outerframe(4)
00299             raise Exception("%sThe module %s in endpath %s is unknown to the process %s." %(context, msg, name, self._Process__name))
    def _placeSequence(self,name,mod):

def Config::Process::_placeESPrefer (   self,
  name,
  mod 
) [private]

Definition at line 304 of file Config.py.

00304                                      :
00305         self._place(name, mod, self.__esprefers)
    def _placeESSource(self,name,mod):

def Config::Process::_placeESProducer (   self,
  name,
  mod 
) [private]

Definition at line 302 of file Config.py.

00302                                        :
00303         self._place(name, mod, self.__esproducers)
    def _placeESPrefer(self,name,mod):

def Config::Process::_placeESSource (   self,
  name,
  mod 
) [private]

Definition at line 306 of file Config.py.

00306                                      :
00307         self._place(name, mod, self.__essources)
    def _placePSet(self,name,mod):

def Config::Process::_placeFilter (   self,
  name,
  mod 
) [private]

Definition at line 284 of file Config.py.

00284                                    :
00285         self._place(name, mod, self.__filters)
    def _placeAnalyzer(self,name,mod):

def Config::Process::_placeLooper (   self,
  name,
  mod 
) [private]

Definition at line 320 of file Config.py.

00320                                    :
00321         if name != 'looper':
00322             raise ValueError("The label '"+name+"' can not be used for a Looper.  Only 'looper' is allowed.")
00323         self.__dict__['_Process__looper'] = mod
00324         self.__dict__[mod.type_()] = mod
    def _placeService(self,typeName,mod):

def Config::Process::_placeOutputModule (   self,
  name,
  mod 
) [private]

Definition at line 280 of file Config.py.

00280                                          :
00281         self._place(name, mod, self.__outputmodules)
    def _placeProducer(self,name,mod):

def Config::Process::_placePath (   self,
  name,
  mod 
) [private]

Definition at line 288 of file Config.py.

00288                                  :
00289         try:
00290             self._place(name, mod, self.__paths)
00291         except ModuleCloneError, msg:
00292             context = format_outerframe(4)
00293             raise Exception("%sThe module %s in path %s is unknown to the process %s." %(context, msg, name, self._Process__name))
    def _placeEndPath(self,name,mod):

def Config::Process::_placeProducer (   self,
  name,
  mod 
) [private]

Definition at line 282 of file Config.py.

00282                                      :
00283         self._place(name, mod, self.__producers)
    def _placeFilter(self,name,mod):

def Config::Process::_placePSet (   self,
  name,
  mod 
) [private]

Definition at line 308 of file Config.py.

00308                                  :
00309         self._place(name, mod, self.__psets)
    def _placeVPSet(self,name,mod):

def Config::Process::_placeSequence (   self,
  name,
  mod 
) [private]

Definition at line 300 of file Config.py.

00300                                      :
00301         self._place(name, mod, self.__sequences)
    def _placeESProducer(self,name,mod):

def Config::Process::_placeService (   self,
  typeName,
  mod 
) [private]

Definition at line 325 of file Config.py.

00325                                         :
00326         self._place(typeName, mod, self.__services)
00327         self.__dict__[typeName]=mod
    def load(self, moduleName):

def Config::Process::_placeSource (   self,
  name,
  mod 
) [private]

Allow the source to be referenced by 'source' or by type name

Definition at line 312 of file Config.py.

00312                                    :
00313         """Allow the source to be referenced by 'source' or by type name"""
00314         if name != 'source':
00315             raise ValueError("The label '"+name+"' can not be used for a Source.  Only 'source' is allowed.")
00316         if self.__dict__['_Process__source'] is not None :
00317             del self.__dict__[self.__dict__['_Process__source'].type_()]
00318         self.__dict__['_Process__source'] = mod
00319         self.__dict__[mod.type_()] = mod
    def _placeLooper(self,name,mod):

def Config::Process::_placeVPSet (   self,
  name,
  mod 
) [private]

Definition at line 310 of file Config.py.

00310                                   :
00311         self._place(name, mod, self.__vpsets)
    def _placeSource(self,name,mod):

def Config::Process::_sequencesInDependencyOrder (   self  )  [private]

Definition at line 459 of file Config.py.

00459                                          :
00460         #for each sequence, see what other sequences it depends upon
00461         returnValue=DictTypes.SortedKeysDict()
00462         dependencies = {}
00463         for label,seq in self.sequences.iteritems():
00464             d = []
00465             v = SequenceVisitor(d)
00466             seq.visit(v)
00467             dependencies[label]=(seq,d)
00468         resolvedDependencies=True
00469         #keep looping until we can no longer get rid of all dependencies
00470         # if that happens it means we have circular dependencies
00471         iterCount = 0
00472         while resolvedDependencies:
00473             iterCount += 1
00474             resolvedDependencies = (0 != len(dependencies))
00475             oldDeps = dict(dependencies)
00476             for label,(seq,deps) in oldDeps.iteritems():
00477                 # don't try too hard
00478                 if len(deps)==0 or iterCount > 100:
00479                     iterCount = 0
00480                     resolvedDependencies=True
00481                     returnValue[label]=seq
00482                     #remove this as a dependency for all other sequences
00483                     del dependencies[label]
00484                     for lb2,(seq2,deps2) in dependencies.iteritems():
00485                         while deps2.count(seq):
00486                             deps2.remove(seq)
00487         if len(dependencies):
00488             raise RuntimeError("circular sequence dependency discovered \n"+
00489                                ",".join([label for label,junk in dependencies.iteritems()]))
00490         return returnValue
    def _dumpPython(self, d, options):

def Config::Process::add_ (   self,
  value 
)

Allows addition of components which do not have to have a label, e.g. Services

Definition at line 236 of file Config.py.

00236                         :
00237         """Allows addition of components which do not have to have a label, e.g. Services"""
00238         if not isinstance(value,_ConfigureComponent):
00239             raise TypeError
00240         if not isinstance(value,_Unlabelable):
00241             raise TypeError
00242         #clone the item
00243         #clone the item
00244         if self.__isStrict:
00245             newValue =value.copy()
00246             value.setIsFrozen()
00247         else:
00248             newValue =value
00249         newValue._place('',self)
00250         
    def _okToPlace(self, name, mod, d):

def Config::Process::analyzerNames (   self  ) 

Definition at line 73 of file Config.py.

00073                            :
00074         return ' '.join(self.analyzers_().keys())
    def filterNames(self):

def Config::Process::analyzers_ (   self  ) 

returns a dict of the analyzers which have been added to the Process

Definition at line 122 of file Config.py.

00122                         :
00123         """returns a dict of the analyzers which have been added to the Process"""
00124         return DictTypes.FixedKeysDict(self.__analyzers)
    analyzers = property(analyzers_,doc="dictionary containing the analyzers for the process")

def Config::Process::dumpConfig (   self,
  options = PrintOptions() 
)

return a string containing the equivalent process defined using the configuration language

Definition at line 394 of file Config.py.

00394                                                 :
00395         """return a string containing the equivalent process defined using the configuration language"""
00396         config = "process "+self.__name+" = {\n"
00397         options.indent()
00398         if self.source_():
00399             config += options.indentation()+"source = "+self.source_().dumpConfig(options)
00400         if self.looper_():
00401             config += options.indentation()+"looper = "+self.looper_().dumpConfig(options)
00402         config+=self._dumpConfigNamedList(self.producers_().iteritems(),
00403                                   'module',
00404                                   options)
00405         config+=self._dumpConfigNamedList(self.filters_().iteritems(),
00406                                   'module',
00407                                   options)
00408         config+=self._dumpConfigNamedList(self.analyzers_().iteritems(),
00409                                   'module',
00410                                   options)
00411         config+=self._dumpConfigNamedList(self.outputModules_().iteritems(),
00412                                   'module',
00413                                   options)
00414         config+=self._dumpConfigNamedList(self.sequences_().iteritems(),
00415                                   'sequence',
00416                                   options)
00417         config+=self._dumpConfigNamedList(self.paths_().iteritems(),
00418                                   'path',
00419                                   options)
00420         config+=self._dumpConfigNamedList(self.endpaths_().iteritems(),
00421                                   'endpath',
00422                                   options)
00423         config+=self._dumpConfigUnnamedList(self.services_().iteritems(),
00424                                   'service',
00425                                   options)
00426         config+=self._dumpConfigOptionallyNamedList(
00427             self.es_producers_().iteritems(),
00428             'es_module',
00429             options)
00430         config+=self._dumpConfigOptionallyNamedList(
00431             self.es_sources_().iteritems(),
00432             'es_source',
00433             options)
00434         config += self._dumpConfigESPrefers(options)
00435         for name,item in self.psets.iteritems():
00436             config +=options.indentation()+item.configTypeName()+' '+name+' = '+item.configValue(options)
00437         for name,item in self.vpsets.iteritems():
00438             config +=options.indentation()+'VPSet '+name+' = '+item.configValue(options)
00439         if self.schedule:
00440             pathNames = [p.label_() for p in self.schedule]
00441             config +=options.indentation()+'schedule = {'+','.join(pathNames)+'}\n'
00442             
00443 #        config+=self._dumpConfigNamedList(self.vpsets.iteritems(),
00444 #                                  'VPSet',
00445 #                                  options)
00446         config += "}\n"
00447         options.unindent()
00448         return config
    def _dumpConfigESPrefers(self, options):

def Config::Process::dumpPython (   self,
  options = PrintOptions() 
)

return a string containing the equivalent process defined using the configuration language

Definition at line 496 of file Config.py.

00496                                                 :
00497         """return a string containing the equivalent process defined using the configuration language"""
00498         result = "import FWCore.ParameterSet.Config as cms\n\n"
00499         result += "process = cms.Process(\""+self.__name+"\")\n\n"
00500         if self.source_():
00501             result += "process.source = "+self.source_().dumpPython(options)
00502         if self.looper_():
00503             result += "process.looper = "+self.looper_().dumpPython()
00504         result+=self._dumpPythonList(self.producers_(), options)
00505         result+=self._dumpPythonList(self.filters_() , options)
00506         result+=self._dumpPythonList(self.analyzers_(), options)
00507         result+=self._dumpPythonList(self.outputModules_(), options)
00508         result+=self._dumpPythonList(self._sequencesInDependencyOrder(), options)
00509         result+=self._dumpPythonList(self.paths_(), options)
00510         result+=self._dumpPythonList(self.endpaths_(), options)
00511         result+=self._dumpPythonList(self.services_(), options)
00512         result+=self._dumpPythonList(self.es_producers_(), options)
00513         result+=self._dumpPythonList(self.es_sources_(), options)
00514         result+=self._dumpPython(self.es_prefers_(), options)
00515         result+=self._dumpPythonList(self.psets, options)
00516         result+=self._dumpPythonList(self.vpsets, options)
00517         if self.schedule:
00518             pathNames = ['process.'+p.label_() for p in self.schedule]
00519             result +='process.schedule = cms.Schedule('+','.join(pathNames)+')\n'
00520         return result
00521 
    def globalReplace(self,label,new):

def Config::Process::endpaths_ (   self  ) 

returns a dict of the endpaths which have been added to the Process

Definition at line 134 of file Config.py.

00134                        :
00135         """returns a dict of the endpaths which have been added to the Process"""
00136         return DictTypes.SortedAndFixedKeysDict(self.__endpaths)
    endpaths = property(endpaths_,doc="dictionary containing the endpaths for the process")

def Config::Process::es_prefers_ (   self  ) 

returns a dict of the es_prefers which have been added to the Process

Definition at line 165 of file Config.py.

00165                          :
00166         """returns a dict of the es_prefers which have been added to the Process"""
00167         return DictTypes.FixedKeysDict(self.__esprefers)
    es_prefers = property(es_prefers_,doc="dictionary containing the es_prefers for the process")

def Config::Process::es_producers_ (   self  ) 

returns a dict of the esproducers which have been added to the Process

Definition at line 157 of file Config.py.

00157                            :
00158         """returns a dict of the esproducers which have been added to the Process"""
00159         return DictTypes.FixedKeysDict(self.__esproducers)
    es_producers = property(es_producers_,doc="dictionary containing the es_producers for the process")

def Config::Process::es_sources_ (   self  ) 

returns a the es_sources which have been added to the Process

Definition at line 161 of file Config.py.

00161                          :
00162         """returns a the es_sources which have been added to the Process"""
00163         return DictTypes.FixedKeysDict(self.__essources)
    es_sources = property(es_sources_,doc="dictionary containing the es_sources for the process")

def Config::Process::extend (   self,
  other,
  items = () 
)

Look in other and find types which we can use

Definition at line 332 of file Config.py.

00332                                    :
00333         """Look in other and find types which we can use"""
00334         # enable explicit check to avoid overwriting of existing objects
00335         self.__dict__['_Process__OverWriteCheck'] = True
00336 
00337         seqs = dict()
00338         labelled = dict()
00339         for name in dir(other):
00340             item = getattr(other,name)
00341             if name == "source" or name == "looper":
00342                 self.__setattr__(name,item)
00343             elif isinstance(item,_ModuleSequenceType):
00344                 seqs[name]=item
00345             elif isinstance(item,_Labelable):
00346                 self.__setattr__(name,item)
00347                 labelled[name]=item
00348                 try:
00349                     item.label_()
00350                 except:
00351                     item.setLabel(name)
00352                 continue
00353             elif isinstance(item,Schedule):
00354                 self.__setattr__(name,item)
00355             elif isinstance(item,_Unlabelable):
00356                 self.add_(item)
00357                 
00358         #now create a sequence which uses the newly made items
00359         for name in seqs.iterkeys():
00360             seq = seqs[name]
00361             #newSeq = seq.copy()
00362             #
00363             if id(seq) not in self._cloneToObjectDict:
00364                 self.__setattr__(name,seq)
00365             else:
00366                 newSeq = self._cloneToObjectDict[id(seq)]
00367                 self.__dict__[name]=newSeq
00368                 newSeq.setLabel(name)
00369                 #now put in proper bucket
00370                 newSeq._place(name,self)
00371         self.__dict__['_Process__OverWriteCheck'] = False
    def include(self,filename):

def Config::Process::fillProcessDesc (   self,
  processDesc,
  processPSet 
)

Definition at line 599 of file Config.py.

00599                                                        :
00600         processPSet.addString(True, "@process_name", self.name_())
00601         all_modules = self.producers_().copy()
00602         all_modules.update(self.filters_())
00603         all_modules.update(self.analyzers_())
00604         all_modules.update(self.outputModules_())
00605         self._insertInto(processPSet, self.psets_())
00606         self._insertInto(processPSet, self.vpsets_())
00607         self._insertManyInto(processPSet, "@all_modules", all_modules)
00608         self._insertOneInto(processPSet,  "@all_sources", self.source_())
00609         self._insertOneInto(processPSet,  "@all_loopers",   self.looper_())
00610         self._insertManyInto(processPSet, "@all_esmodules", self.es_producers_())
00611         self._insertManyInto(processPSet, "@all_essources", self.es_sources_())
00612         self._insertManyInto(processPSet, "@all_esprefers", self.es_prefers_())
00613         self._insertPaths(processDesc, processPSet)
00614         self._insertServices(processDesc, self.services_())
00615         return processDesc
00616 
    def prefer(self, esmodule,*args,**kargs):

def Config::Process::filterNames (   self  ) 

Definition at line 75 of file Config.py.

00075                          :
00076        return ' '.join(self.filters_().keys())
    def pathNames(self):

def Config::Process::filters_ (   self  ) 

returns a dict of the filters which have been added to the Process

Definition at line 97 of file Config.py.

00097                       :
00098         """returns a dict of the filters which have been added to the Process"""
00099         return DictTypes.FixedKeysDict(self.__filters)
    filters = property(filters_, doc="dictionary containing the filters for the process")

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

00522                                      :
00523         """ Replace the item with label 'label' by object 'new' in the process and all sequences/paths"""
00524         if not hasattr(self,label):
00525             raise LookupError("process has no item of label "+label)
00526         old = getattr(self,label)
00527         #TODO - replace by iterator concatenation
00528         for sequenceable in self.sequences.itervalues():
00529             sequenceable.replace(old,new)
00530         for sequenceable in self.paths.itervalues():
00531             sequenceable.replace(old,new)
00532         for sequenceable in self.endpaths.itervalues():
00533             sequenceable.replace(old,new)
00534                 
00535         setattr(self,label,new)    
    def _insertInto(self, parameterSet, itemDict):

def Config::Process::include (   self,
  filename 
)

include the content of a configuration language file into the process
     this is identical to calling process.extend(include('filename'))

Definition at line 372 of file Config.py.

00372                               :
00373         """include the content of a configuration language file into the process
00374              this is identical to calling process.extend(include('filename'))
00375         """
00376         self.extend(include(filename))
    def _dumpConfigNamedList(self,items,typeName,options):

def Config::Process::load (   self,
  moduleName 
)

Definition at line 328 of file Config.py.

00328                               :
00329         module = __import__(moduleName)
00330         import sys
00331         self.extend(sys.modules[moduleName])
    def extend(self,other,items=()):

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

00116                      :
00117         """returns the looper which has been added to the Process or None if none have been added"""
00118         return self.__looper
    def setLooper_(self,lpr):

def Config::Process::name_ (   self  ) 

Definition at line 101 of file Config.py.

00101                    :
00102         return self.__name
    def setName_(self,name):

def Config::Process::outputModules_ (   self  ) 

returns a dict of the output modules which have been added to the Process

Definition at line 126 of file Config.py.

00126                             :
00127         """returns a dict of the output modules which have been added to the Process"""
00128         return DictTypes.FixedKeysDict(self.__outputmodules)
    outputModules = property(outputModules_,doc="dictionary containing the output_modules for the process")

def Config::Process::pathNames (   self  ) 

Definition at line 77 of file Config.py.

00077                        :
00078        return ' '.join(self.paths_().keys())
00079 
    def __setstate__(self, pkldict):

def Config::Process::paths_ (   self  ) 

returns a dict of the paths which have been added to the Process

Definition at line 130 of file Config.py.

00130                     :
00131         """returns a dict of the paths which have been added to the Process"""
00132         return DictTypes.SortedAndFixedKeysDict(self.__paths)
    paths = property(paths_,doc="dictionary containing the paths for the process")

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

00617                                             :
00618         """Prefer this ES source or producer.  The argument can
00619            either be an object label, e.g., 
00620              process.prefer(process.juicerProducer) (not supported yet)
00621            or a name of an ESSource or ESProducer
00622              process.prefer("juicer")
00623            or a type of unnamed ESSource or ESProducer
00624              process.prefer("JuicerProducer")
00625            In addition, you can pass as a labelled arguments the name of the Record you wish to
00626            prefer where the type passed is a cms.vstring and that vstring can contain the
00627            name of the C++ types in the Record which are being preferred, e.g.,
00628               #prefer all data in record 'OrangeRecord' from 'juicer'
00629               process.prefer("juicer", OrangeRecord=cms.vstring())
00630            or
00631               #prefer only "Orange" data in "OrangeRecord" from "juicer" 
00632               process.prefer("juicer", OrangeRecord=cms.vstring("Orange"))
00633            or 
00634               #prefer only "Orange" data with label "ExtraPulp" in "OrangeRecord" from "juicer" 
00635               ESPrefer("ESJuicerProd", OrangeRecord=cms.vstring("Orange/ExtraPulp"))
00636         """
00637         # see if this refers to a named ESProducer
00638         if isinstance(esmodule, ESSource) or isinstance(esmodule, ESProducer):
00639             raise RuntimeError("Syntax of process.prefer(process.esmodule) not supported yet")
00640         elif self._findPreferred(esmodule, self.es_producers_(),*args,**kargs) or \
00641                 self._findPreferred(esmodule, self.es_sources_(),*args,**kargs):
00642             pass
00643         else:
00644             raise RuntimeError("Cannot resolve prefer for "+repr(esmodule))
00645 
    def _findPreferred(self, esname, d,*args,**kargs):

def Config::Process::producerNames (   self  ) 

Definition at line 71 of file Config.py.

00071                            :
00072         return ' '.join(self.producers_().keys())
    def analyzerNames(self):

def Config::Process::producers_ (   self  ) 

returns a dict of the producers which have been added to the Process

Definition at line 106 of file Config.py.

00106                         :
00107         """returns a dict of the producers which have been added to the Process"""
00108         return DictTypes.FixedKeysDict(self.__producers)
    producers = property(producers_,doc="dictionary containing the producers for the process")

def Config::Process::psets_ (   self  ) 

returns a dict of the PSets which have been added to the Process

Definition at line 169 of file Config.py.

00169                     :
00170         """returns a dict of the PSets which have been added to the Process"""
00171         return DictTypes.FixedKeysDict(self.__psets)
    psets = property(psets_,doc="dictionary containing the PSets for the process")

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

00142                        :
00143         """returns the schedule which has been added to the Process or None if none have been added"""
00144         return self.__schedule
    def setPartialSchedule_(self,sch,label):

def Config::Process::sequences_ (   self  ) 

returns a dict of the sequences which have been added to the Process

Definition at line 138 of file Config.py.

00138                         :
00139         """returns a dict of the sequences which have been added to the Process"""
00140         return DictTypes.FixedKeysDict(self.__sequences)
    sequences = property(sequences_,doc="dictionary containing the sequences for the process")

def Config::Process::services_ (   self  ) 

returns a dict of the services which have been added to the Process

Definition at line 153 of file Config.py.

00153                        :
00154         """returns a dict of the services which have been added to the Process"""
00155         return DictTypes.FixedKeysDict(self.__services)
    services = property(services_,doc="dictionary containing the services for the process")

def Config::Process::setLooper_ (   self,
  lpr 
)

Definition at line 119 of file Config.py.

00119                             :
00120         self._placeLooper('looper',lpr)
    looper = property(looper_,setLooper_,doc='the main looper or None if not set')

def Config::Process::setName_ (   self,
  name 
)

Definition at line 103 of file Config.py.

00103                            :
00104         self.__dict__['_Process__name'] = name
    process = property(name_,setName_, doc="name of the process")

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

Definition at line 145 of file Config.py.

00145                                            :
00146         if label == "schedule":
00147             self.setSchedule_(sch)
00148         else:     
00149             self._place(label, sch, self.__partialschedules)
    def setSchedule_(self,sch):

def Config::Process::setSchedule_ (   self,
  sch 
)

Definition at line 150 of file Config.py.

00150                               :
00151         self.__dict__['_Process__schedule'] = sch
    schedule = property(schedule_,setSchedule_,doc='the schedule or None if not set')

def Config::Process::setSource_ (   self,
  src 
)

Definition at line 113 of file Config.py.

00113                             :
00114         self._placeSource('source',src)
    source = property(source_,setSource_,doc='the main source or None if not set')

def Config::Process::setStrict (   self,
  value 
)

Definition at line 66 of file Config.py.

00066                               :
00067         self.__isStrict = value
00068         _Module.__isStrict__ = True 
00069 
00070     # some user-friendly methods for command-line browsing
    def producerNames(self):

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

00110                      :
00111         """returns the source which has been added to the Process or None if none have been added"""
00112         return self.__source
    def setSource_(self,src):

def Config::Process::vpsets_ (   self  ) 

returns a dict of the VPSets which have been added to the Process

Definition at line 173 of file Config.py.

00173                      :
00174         """returns a dict of the VPSets which have been added to the Process"""
00175         return DictTypes.FixedKeysDict(self.__vpsets)
    vpsets = property(vpsets_,doc="dictionary containing the PSets for the process")


Member Data Documentation

Config::Process::__isStrict [private]

Definition at line 64 of file Config.py.

tuple Config::Process::analyzers = property(analyzers_,doc="dictionary containing the analyzers for the process") [static]

Definition at line 125 of file Config.py.

tuple Config::Process::endpaths = property(endpaths_,doc="dictionary containing the endpaths for the process") [static]

Definition at line 137 of file Config.py.

tuple Config::Process::es_prefers = property(es_prefers_,doc="dictionary containing the es_prefers for the process") [static]

Definition at line 168 of file Config.py.

tuple Config::Process::es_producers = property(es_producers_,doc="dictionary containing the es_producers for the process") [static]

Definition at line 160 of file Config.py.

tuple Config::Process::es_sources = property(es_sources_,doc="dictionary containing the es_sources for the process") [static]

Definition at line 164 of file Config.py.

tuple Config::Process::filters = property(filters_, doc="dictionary containing the filters for the process") [static]

Definition at line 100 of file Config.py.

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

Definition at line 121 of file Config.py.

tuple Config::Process::outputModules = property(outputModules_,doc="dictionary containing the output_modules for the process") [static]

Definition at line 129 of file Config.py.

tuple Config::Process::paths = property(paths_,doc="dictionary containing the paths for the process") [static]

Definition at line 133 of file Config.py.

tuple Config::Process::process = property(name_,setName_, doc="name of the process") [static]

Definition at line 105 of file Config.py.

tuple Config::Process::producers = property(producers_,doc="dictionary containing the producers for the process") [static]

Definition at line 109 of file Config.py.

tuple Config::Process::psets = property(psets_,doc="dictionary containing the PSets for the process") [static]

Definition at line 172 of file Config.py.

tuple Config::Process::schedule = property(schedule_,setSchedule_,doc='the schedule or None if not set') [static]

Definition at line 152 of file Config.py.

tuple Config::Process::sequences = property(sequences_,doc="dictionary containing the sequences for the process") [static]

Definition at line 141 of file Config.py.

tuple Config::Process::services = property(services_,doc="dictionary containing the services for the process") [static]

Definition at line 156 of file Config.py.

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

Definition at line 115 of file Config.py.

tuple Config::Process::vpsets = property(vpsets_,doc="dictionary containing the PSets for the process") [static]

Definition at line 176 of file Config.py.


The documentation for this class was generated from the following file:
Generated on Tue Jun 9 18:36:51 2009 for CMSSW by  doxygen 1.5.4