CMS 3D CMS Logo

Public Member Functions | Properties | Private Member Functions | Private Attributes

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 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 source_
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')
 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 _replaceInSequences
def _sequencesInDependencyOrder
def _validateSequence

Private Attributes

 __isStrict

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.

00103                            :
00104         self.__dict__['_Process__name'] = name
00105         self.__dict__['_Process__filters'] = {}
00106         self.__dict__['_Process__producers'] = {}
00107         self.__dict__['_Process__source'] = None
00108         self.__dict__['_Process__looper'] = None
00109         self.__dict__['_Process__schedule'] = None
00110         self.__dict__['_Process__analyzers'] = {}
00111         self.__dict__['_Process__outputmodules'] = {}
00112         self.__dict__['_Process__paths'] = DictTypes.SortedKeysDict()    # have to keep the order
00113         self.__dict__['_Process__endpaths'] = DictTypes.SortedKeysDict() # of definition
00114         self.__dict__['_Process__sequences'] = {}
00115         self.__dict__['_Process__services'] = {}
00116         self.__dict__['_Process__essources'] = {}
00117         self.__dict__['_Process__esproducers'] = {}
00118         self.__dict__['_Process__esprefers'] = {}
00119         self.__dict__['_Process__psets']={}
00120         self.__dict__['_Process__vpsets']={}
00121         self.__dict__['_cloneToObjectDict'] = {}
00122         # policy switch to avoid object overwriting during extend/load
00123         self.__dict__['_Process__InExtendCall'] = False
00124         self.__dict__['_Process__partialschedules'] = {}
00125         self.__isStrict = False


Member Function Documentation

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

Definition at line 296 of file Config.py.

00297                               :
00298         if not hasattr(self,name):
00299             raise KeyError('process does not know about '+name)
00300         elif name.startswith('_Process__'):
00301             raise ValueError('this attribute cannot be deleted')
00302         else:
00303             # we have to remove it from all dictionaries/registries
00304             dicts = [item for item in self.__dict__.values() if (type(item)==dict or type(item)==DictTypes.SortedKeysDict)]
00305             for reg in dicts:
00306                 if reg.has_key(name): del reg[name]
00307             # if it was a labelable object, the label needs to be removed
00308             obj = getattr(self,name)
00309             if isinstance(obj,_Labelable):
00310                 getattr(self,name).setLabel(None)
00311             # now remove it from the process itself
00312             try:
00313                 del self.__dict__[name]
00314             except:
00315                 pass

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

Definition at line 246 of file Config.py.

00247                                     :
00248         # check if the name is well-formed (only _ and alphanumerics are allowed)
00249         if not name.replace('_','').isalnum():
00250             raise ValueError('The label '+name+' contains forbiden characters')
00251 
00252         # private variable exempt from all this
00253         if name.startswith('_Process__'):
00254             self.__dict__[name]=value
00255             return
00256         if not isinstance(value,_ConfigureComponent):
00257             raise TypeError("can only assign labels to an object which inherits from '_ConfigureComponent'\n"
00258                             +"an instance of "+str(type(value))+" will not work")
00259         if not isinstance(value,_Labelable) and not isinstance(value,Source) and not isinstance(value,Looper) and not isinstance(value,Schedule):
00260             if name == value.type_():
00261                 self.add_(value)
00262                 return
00263             else:
00264                 raise TypeError("an instance of "+str(type(value))+" can not be assigned the label '"+name+"'.\n"+
00265                                 "Please either use the label '"+value.type_()+" or use the 'add_' method instead.")
00266         #clone the item
00267         if self.__isStrict:
00268             newValue =value.copy()
00269             try:
00270               newValue._filename = value._filename
00271             except:
00272               pass
00273             value.setIsFrozen()
00274         else:
00275             newValue =value
00276         if not self._okToPlace(name, value, self.__dict__):
00277             msg = "Trying to override definition of process."+name
00278             msg += "\n new object defined in: "+value._filename
00279             msg += "\n existing object defined in: "+getattr(self,name)._filename
00280             raise ValueError(msg)
00281         # remove the old object of the name (if there is one)
00282         if hasattr(self,name) and not (getattr(self,name)==newValue):
00283             # Allow items in sequences from load() statements to have
00284             # degeneratate names, but if the user overwrites a name in the
00285             # main config, replace it everywhere
00286             if not self.__InExtendCall and isinstance(newValue, _Sequenceable):
00287                 self._replaceInSequences(name, newValue)
00288             self.__delattr__(name)
00289         self.__dict__[name]=newValue
00290         if isinstance(newValue,_Labelable):
00291             newValue.setLabel(name)
00292             self._cloneToObjectDict[id(value)] = newValue
00293             self._cloneToObjectDict[id(newValue)] = newValue
00294         #now put in proper bucket
00295         newValue._place(name,self)

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

00141                                    :
00142         """
00143         Unpickling hook.
00144 
00145         Since cloneToObjectDict stores a hash of objects by their
00146         id() it needs to be updated when unpickling to use the
00147         new object id values instantiated during the unpickle.
00148 
00149         """
00150         self.__dict__.update(pkldict)
00151         tmpDict = {}
00152         for value in self._cloneToObjectDict.values():
00153             tmpDict[id(value)] = value
00154         self.__dict__['_cloneToObjectDict'] = tmpDict
00155 
00156 

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

Definition at line 530 of file Config.py.

00531                                            :
00532         result = ''
00533         for item in self.es_prefers_().itervalues():
00534             result +=options.indentation()+'es_prefer '+item.targetLabel_()+' = '+item.dumpConfig(options)
        return result
def Config::Process::_dumpConfigNamedList (   self,
  items,
  typeName,
  options 
) [private]

Definition at line 458 of file Config.py.

00459                                                          :
00460         returnValue = ''
00461         for name,item in items:
00462             returnValue +=options.indentation()+typeName+' '+name+' = '+item.dumpConfig(options)
        return returnValue
def Config::Process::_dumpConfigOptionallyNamedList (   self,
  items,
  typeName,
  options 
) [private]

Definition at line 468 of file Config.py.

00469                                                                    :
00470         returnValue = ''
00471         for name,item in items:
00472             if name == item.type_():
00473                 name = ''
00474             returnValue +=options.indentation()+typeName+' '+name+' = '+item.dumpConfig(options)
        return returnValue
def Config::Process::_dumpConfigUnnamedList (   self,
  items,
  typeName,
  options 
) [private]

Definition at line 463 of file Config.py.

00464                                                            :
00465         returnValue = ''
00466         for name,item in items:
00467             returnValue +=options.indentation()+typeName+' = '+item.dumpConfig(options)
        return returnValue
def Config::Process::_dumpPython (   self,
  d,
  options 
) [private]

Definition at line 584 of file Config.py.

00585                                      :
00586         result = ''
00587         for name, value in d.iteritems():
00588            result += value.dumpPythonAs(name,options)+'\n'
        return result
def Config::Process::_dumpPythonList (   self,
  d,
  options 
) [private]

Definition at line 535 of file Config.py.

00536                                          :
00537         returnValue = ''
00538         if isinstance(d, DictTypes.SortedKeysDict):
00539             for name,item in d.items():
00540                 returnValue +='process.'+name+' = '+item.dumpPython(options)+'\n\n'
00541         else:
00542             for name,item in sorted(d.items()):
00543                 returnValue +='process.'+name+' = '+item.dumpPython(options)+'\n\n'
        return returnValue
def Config::Process::_findPreferred (   self,
  esname,
  d,
  args,
  kargs 
) [private]

Definition at line 777 of file Config.py.

00778                                                      :
00779         # is esname a name in the dictionary?
00780         if esname in d:
00781             typ = d[esname].type_()
00782             if typ == esname:
00783                 self.__setattr__( esname+"_prefer", ESPrefer(typ,*args,**kargs) )
00784             else:
00785                 self.__setattr__( esname+"_prefer", ESPrefer(typ, esname,*args,**kargs) )
00786             return True
00787         else:
00788             # maybe it's an unnamed ESModule?
00789             found = False
00790             for name, value in d.iteritems():
00791                if value.type_() == esname:
00792                   if found:
00793                       raise RuntimeError("More than one ES module for "+esname)
00794                   found = True
00795                   self.__setattr__(esname+"_prefer",  ESPrefer(d[esname].type_()) )
00796             return found

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

Definition at line 629 of file Config.py.

00630                                                  :
00631         for name,value in itemDict.iteritems():
            value.insertInto(parameterSet, name)
def Config::Process::_insertManyInto (   self,
  parameterSet,
  label,
  itemDict 
) [private]

Definition at line 639 of file Config.py.

00640                                                             :
00641         l = []
00642         for name,value in itemDict.iteritems():
00643           newLabel = value.nameInProcessDesc_(name)
00644           l.append(newLabel)
00645           value.insertInto(parameterSet, name)
00646         # alphabetical order is easier to compare with old language
00647         l.sort()
        parameterSet.addVString(True, label, l)
def Config::Process::_insertOneInto (   self,
  parameterSet,
  label,
  item 
) [private]

Definition at line 632 of file Config.py.

00633                                                        :
00634         vitems = []
00635         if not item == None:
00636             newlabel = item.nameInProcessDesc_(label)
00637             vitems = [newlabel]
00638             item.insertInto(parameterSet, newlabel)
        parameterSet.addVString(True, label, vitems)
def Config::Process::_insertPaths (   self,
  processDesc,
  processPSet 
) [private]

Definition at line 651 of file Config.py.

00652                                                     :
00653         scheduledPaths = []
00654         triggerPaths = []
00655         endpaths = []
00656         if self.schedule_() == None:
00657             # make one from triggerpaths & endpaths
00658             for name,value in self.paths_().iteritems():
00659                 scheduledPaths.append(name)
00660                 triggerPaths.append(name)
00661             for name,value in self.endpaths_().iteritems():
00662                 scheduledPaths.append(name)
00663                 endpaths.append(name)
00664         else:
00665             for path in self.schedule_():
00666                pathname = path.label_()
00667                scheduledPaths.append(pathname)
00668                if self.endpaths_().has_key(pathname):
00669                    endpaths.append(pathname)
00670                else:
00671                    triggerPaths.append(pathname)
00672         processPSet.addVString(True, "@end_paths", endpaths)
00673         processPSet.addVString(True, "@paths", scheduledPaths)
00674         # trigger_paths are a little different
00675         p = processDesc.newPSet()
00676         p.addVString(True, "@trigger_paths", triggerPaths)
00677         processPSet.addPSet(True, "@trigger_paths", p)
00678         # add all these paths
00679         pathValidator = PathValidator()
00680         endpathValidator = EndPathValidator()
00681         for triggername in triggerPaths:
00682             #self.paths_()[triggername].insertInto(processPSet, triggername, self.sequences_())
00683             self.paths_()[triggername].visit(pathValidator)
00684             self.paths_()[triggername].insertInto(processPSet, triggername, self.__dict__)
00685         for endpathname in endpaths:
00686             #self.endpaths_()[endpathname].insertInto(processPSet, endpathname, self.sequences_())
00687             self.endpaths_()[endpathname].visit(endpathValidator)
00688             self.endpaths_()[endpathname].insertInto(processPSet, endpathname, self.__dict__)
00689         processPSet.addVString(False, "@filters_on_endpaths", endpathValidator.filtersOnEndpaths)

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

Definition at line 648 of file Config.py.

00649                                                     :
00650         for name,value in itemDict.iteritems():
           value.insertInto(processDesc)
def Config::Process::_okToPlace (   self,
  name,
  mod,
  d 
) [private]

Definition at line 331 of file Config.py.

00332                                       :
00333         if not self.__InExtendCall:
00334             # if going
00335             return True
00336         elif not self.__isStrict:
00337             return True
00338         elif name in d:
00339             # if there's an old copy, and the new one
00340             # hasn't been modified, we're done.  Still
00341             # not quite safe if something has been defined twice.
00342             #  Need to add checks
00343             if mod._isModified:
00344                 if d[name]._isModified:
00345                     return False
00346                 else:
00347                     return True
00348             else:
00349                 return True
00350         else:
00351             return True

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

Definition at line 352 of file Config.py.

00353                                   :
00354         if self._okToPlace(name, mod, d):
00355             if self.__isStrict and isinstance(mod, _ModuleSequenceType):
00356                 d[name] = mod._postProcessFixup(self._cloneToObjectDict)
00357             else:
00358                 d[name] = mod
00359             if isinstance(mod,_Labelable):
               mod.setLabel(name)
def Config::Process::_placeAnalyzer (   self,
  name,
  mod 
) [private]

Definition at line 366 of file Config.py.

00367                                      :
        self._place(name, mod, self.__analyzers)
def Config::Process::_placeEndPath (   self,
  name,
  mod 
) [private]

Definition at line 375 of file Config.py.

00376                                     :
00377         self._validateSequence(mod, name)
00378         try:
00379             self._place(name, mod, self.__endpaths)
00380         except ModuleCloneError, msg:
00381             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 Config::Process::_placeESPrefer (   self,
  name,
  mod 
) [private]

Definition at line 387 of file Config.py.

00388                                      :
        self._place(name, mod, self.__esprefers)
def Config::Process::_placeESProducer (   self,
  name,
  mod 
) [private]

Definition at line 385 of file Config.py.

00386                                        :
        self._place(name, mod, self.__esproducers)
def Config::Process::_placeESSource (   self,
  name,
  mod 
) [private]

Definition at line 389 of file Config.py.

00390                                      :
        self._place(name, mod, self.__essources)
def Config::Process::_placeFilter (   self,
  name,
  mod 
) [private]

Definition at line 364 of file Config.py.

00365                                    :
        self._place(name, mod, self.__filters)
def Config::Process::_placeLooper (   self,
  name,
  mod 
) [private]

Definition at line 403 of file Config.py.

00404                                    :
00405         if name != 'looper':
00406             raise ValueError("The label '"+name+"' can not be used for a Looper.  Only 'looper' is allowed.")
00407         self.__dict__['_Process__looper'] = mod
        self.__dict__[mod.type_()] = mod
def Config::Process::_placeOutputModule (   self,
  name,
  mod 
) [private]

Definition at line 360 of file Config.py.

00361                                          :
        self._place(name, mod, self.__outputmodules)
def Config::Process::_placePath (   self,
  name,
  mod 
) [private]

Definition at line 368 of file Config.py.

00369                                  :
00370         self._validateSequence(mod, name)
00371         try:
00372             self._place(name, mod, self.__paths)
00373         except ModuleCloneError, msg:
00374             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 Config::Process::_placeProducer (   self,
  name,
  mod 
) [private]

Definition at line 362 of file Config.py.

00363                                      :
        self._place(name, mod, self.__producers)
def Config::Process::_placePSet (   self,
  name,
  mod 
) [private]

Definition at line 391 of file Config.py.

00392                                  :
        self._place(name, mod, self.__psets)
def Config::Process::_placeSequence (   self,
  name,
  mod 
) [private]

Definition at line 382 of file Config.py.

00383                                      :
00384         self._validateSequence(mod, name)
        self._place(name, mod, self.__sequences)
def Config::Process::_placeService (   self,
  typeName,
  mod 
) [private]

Definition at line 408 of file Config.py.

00409                                         :
00410         self._place(typeName, mod, self.__services)
        self.__dict__[typeName]=mod
def Config::Process::_placeSource (   self,
  name,
  mod 
) [private]
Allow the source to be referenced by 'source' or by type name

Definition at line 395 of file Config.py.

00396                                    :
00397         """Allow the source to be referenced by 'source' or by type name"""
00398         if name != 'source':
00399             raise ValueError("The label '"+name+"' can not be used for a Source.  Only 'source' is allowed.")
00400         if self.__dict__['_Process__source'] is not None :
00401             del self.__dict__[self.__dict__['_Process__source'].type_()]
00402         self.__dict__['_Process__source'] = mod
        self.__dict__[mod.type_()] = mod
def Config::Process::_placeVPSet (   self,
  name,
  mod 
) [private]

Definition at line 393 of file Config.py.

00394                                   :
        self._place(name, mod, self.__vpsets)
def Config::Process::_replaceInSequences (   self,
  label,
  new 
) [private]

Definition at line 614 of file Config.py.

00615                                              :
00616         old = getattr(self,label)
00617         #TODO - replace by iterator concatenation
00618         for sequenceable in self.sequences.itervalues():
00619             sequenceable.replace(old,new)
00620         for sequenceable in self.paths.itervalues():
00621             sequenceable.replace(old,new)
00622         for sequenceable in self.endpaths.itervalues():
            sequenceable.replace(old,new)
def Config::Process::_sequencesInDependencyOrder (   self) [private]

Definition at line 552 of file Config.py.

00553                                          :
00554         #for each sequence, see what other sequences it depends upon
00555         returnValue=DictTypes.SortedKeysDict()
00556         dependencies = {}
00557         for label,seq in self.sequences.iteritems():
00558             d = []
00559             v = SequenceVisitor(d)
00560             seq.visit(v)
00561             dependencies[label]=[dep.label_() for dep in d if dep.label_() != None]
00562         resolvedDependencies=True
00563         #keep looping until we can no longer get rid of all dependencies
00564         # if that happens it means we have circular dependencies
00565         iterCount = 0
00566         while resolvedDependencies:
00567             iterCount += 1
00568             resolvedDependencies = (0 != len(dependencies))
00569             oldDeps = dict(dependencies)
00570             for label,deps in oldDeps.iteritems():
00571                 # don't try too hard
00572                 if len(deps)==0 or iterCount > 100:
00573                     iterCount = 0
00574                     resolvedDependencies=True
00575                     returnValue[label]=self.sequences[label]
00576                     #remove this as a dependency for all other sequences
00577                     del dependencies[label]
00578                     for lb2,deps2 in dependencies.iteritems():
00579                         while deps2.count(label):
00580                             deps2.remove(label)
00581         if len(dependencies):
00582             raise RuntimeError("circular sequence dependency discovered \n"+
00583                                ",".join([label for label,junk in dependencies.iteritems()]))
        return returnValue
def Config::Process::_validateSequence (   self,
  sequence,
  label 
) [private]

Definition at line 544 of file Config.py.

00545                                                 :
00546         # See if every module has been inserted into the process
00547         try:
00548             l = set()
00549             nameVisitor = NodeNameVisitor(l)
00550             sequence.visit(nameVisitor)
00551         except:
            raise RuntimeError("An entry in sequence "+label + ' has no label')
def Config::Process::add_ (   self,
  value 
)
Allows addition of components which do not have to have a label, e.g. Services

Definition at line 316 of file Config.py.

00317                         :
00318         """Allows addition of components which do not have to have a label, e.g. Services"""
00319         if not isinstance(value,_ConfigureComponent):
00320             raise TypeError
00321         if not isinstance(value,_Unlabelable):
00322             raise TypeError
00323         #clone the item
00324         #clone the item
00325         if self.__isStrict:
00326             newValue =value.copy()
00327             value.setIsFrozen()
00328         else:
00329             newValue =value
00330         newValue._place('',self)

def Config::Process::analyzerNames (   self)

Definition at line 133 of file Config.py.

00134                            :
        return ' '.join(self.analyzers_().keys())
def Config::Process::analyzers_ (   self)
returns a dict of the analyzers which have been added to the Process

Definition at line 182 of file Config.py.

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

Definition at line 475 of file Config.py.

00476                                                 :
00477         """return a string containing the equivalent process defined using the configuration language"""
00478         config = "process "+self.__name+" = {\n"
00479         options.indent()
00480         if self.source_():
00481             config += options.indentation()+"source = "+self.source_().dumpConfig(options)
00482         if self.looper_():
00483             config += options.indentation()+"looper = "+self.looper_().dumpConfig(options)
00484         config+=self._dumpConfigNamedList(self.producers_().iteritems(),
00485                                   'module',
00486                                   options)
00487         config+=self._dumpConfigNamedList(self.filters_().iteritems(),
00488                                   'module',
00489                                   options)
00490         config+=self._dumpConfigNamedList(self.analyzers_().iteritems(),
00491                                   'module',
00492                                   options)
00493         config+=self._dumpConfigNamedList(self.outputModules_().iteritems(),
00494                                   'module',
00495                                   options)
00496         config+=self._dumpConfigNamedList(self.sequences_().iteritems(),
00497                                   'sequence',
00498                                   options)
00499         config+=self._dumpConfigNamedList(self.paths_().iteritems(),
00500                                   'path',
00501                                   options)
00502         config+=self._dumpConfigNamedList(self.endpaths_().iteritems(),
00503                                   'endpath',
00504                                   options)
00505         config+=self._dumpConfigUnnamedList(self.services_().iteritems(),
00506                                   'service',
00507                                   options)
00508         config+=self._dumpConfigOptionallyNamedList(
00509             self.es_producers_().iteritems(),
00510             'es_module',
00511             options)
00512         config+=self._dumpConfigOptionallyNamedList(
00513             self.es_sources_().iteritems(),
00514             'es_source',
00515             options)
00516         config += self._dumpConfigESPrefers(options)
00517         for name,item in self.psets.iteritems():
00518             config +=options.indentation()+item.configTypeName()+' '+name+' = '+item.configValue(options)
00519         for name,item in self.vpsets.iteritems():
00520             config +=options.indentation()+'VPSet '+name+' = '+item.configValue(options)
00521         if self.schedule:
00522             pathNames = [p.label_() for p in self.schedule]
00523             config +=options.indentation()+'schedule = {'+','.join(pathNames)+'}\n'
00524 
00525 #        config+=self._dumpConfigNamedList(self.vpsets.iteritems(),
00526 #                                  'VPSet',
00527 #                                  options)
00528         config += "}\n"
00529         options.unindent()
        return config
def Config::Process::dumpPython (   self,
  options = PrintOptions() 
)
return a string containing the equivalent process defined using the configuration language

Definition at line 589 of file Config.py.

00590                                                 :
00591         """return a string containing the equivalent process defined using the configuration language"""
00592         result = "import FWCore.ParameterSet.Config as cms\n\n"
00593         result += "process = cms.Process(\""+self.__name+"\")\n\n"
00594         if self.source_():
00595             result += "process.source = "+self.source_().dumpPython(options)
00596         if self.looper_():
00597             result += "process.looper = "+self.looper_().dumpPython()
00598         result+=self._dumpPythonList(self.producers_(), options)
00599         result+=self._dumpPythonList(self.filters_() , options)
00600         result+=self._dumpPythonList(self.analyzers_(), options)
00601         result+=self._dumpPythonList(self.outputModules_(), options)
00602         result+=self._dumpPythonList(self._sequencesInDependencyOrder(), options)
00603         result+=self._dumpPythonList(self.paths_(), options)
00604         result+=self._dumpPythonList(self.endpaths_(), options)
00605         result+=self._dumpPythonList(self.services_(), options)
00606         result+=self._dumpPythonList(self.es_producers_(), options)
00607         result+=self._dumpPythonList(self.es_sources_(), options)
00608         result+=self._dumpPython(self.es_prefers_(), options)
00609         result+=self._dumpPythonList(self.psets, options)
00610         result+=self._dumpPythonList(self.vpsets, options)
00611         if self.schedule:
00612             pathNames = ['process.'+p.label_() for p in self.schedule]
00613             result +='process.schedule = cms.Schedule('+','.join(pathNames)+')\n'
        return result
def Config::Process::endpaths_ (   self)
returns a dict of the endpaths which have been added to the Process

Definition at line 194 of file Config.py.

00195                        :
00196         """returns a dict of the endpaths which have been added to the Process"""
        return DictTypes.SortedAndFixedKeysDict(self.__endpaths)
def Config::Process::es_prefers_ (   self)
returns a dict of the es_prefers which have been added to the Process

Definition at line 234 of file Config.py.

00235                          :
00236         """returns a dict of the es_prefers which have been added to the Process"""
        return DictTypes.FixedKeysDict(self.__esprefers)
def Config::Process::es_producers_ (   self)
returns a dict of the esproducers which have been added to the Process

Definition at line 226 of file Config.py.

00227                            :
00228         """returns a dict of the esproducers which have been added to the Process"""
        return DictTypes.FixedKeysDict(self.__esproducers)
def Config::Process::es_sources_ (   self)
returns a the es_sources which have been added to the Process

Definition at line 230 of file Config.py.

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

Definition at line 415 of file Config.py.

00416                                    :
00417         """Look in other and find types which we can use"""
00418         # enable explicit check to avoid overwriting of existing objects
00419         self.__dict__['_Process__InExtendCall'] = True
00420 
00421         seqs = dict()
00422         labelled = dict()
00423         for name in dir(other):
00424             #'from XX import *' ignores these, and so should we.
00425             if name.startswith('_'):
00426                 continue
00427             item = getattr(other,name)
00428             if name == "source" or name == "looper":
00429                 self.__setattr__(name,item)
00430             elif isinstance(item,_ModuleSequenceType):
00431                 seqs[name]=item
00432             elif isinstance(item,_Labelable):
00433                 self.__setattr__(name,item)
00434                 labelled[name]=item
00435                 try:
00436                     item.label_()
00437                 except:
00438                     item.setLabel(name)
00439                 continue
00440             elif isinstance(item,Schedule):
00441                 self.__setattr__(name,item)
00442             elif isinstance(item,_Unlabelable):
00443                 self.add_(item)
00444 
00445         #now create a sequence which uses the newly made items
00446         for name in seqs.iterkeys():
00447             seq = seqs[name]
00448             #newSeq = seq.copy()
00449             #
00450             if id(seq) not in self._cloneToObjectDict:
00451                 self.__setattr__(name,seq)
00452             else:
00453                 newSeq = self._cloneToObjectDict[id(seq)]
00454                 self.__dict__[name]=newSeq
00455                 newSeq.setLabel(name)
00456                 #now put in proper bucket
00457                 newSeq._place(name,self)
        self.__dict__['_Process__InExtendCall'] = False
def Config::Process::fillProcessDesc (   self,
  processDesc,
  processPSet 
)

Definition at line 722 of file Config.py.

00723                                                        :
00724         self.validate()
00725         processPSet.addString(True, "@process_name", self.name_())
00726         all_modules = self.producers_().copy()
00727         all_modules.update(self.filters_())
00728         all_modules.update(self.analyzers_())
00729         all_modules.update(self.outputModules_())
00730         self._insertInto(processPSet, self.psets_())
00731         self._insertInto(processPSet, self.vpsets_())
00732         self._insertManyInto(processPSet, "@all_modules", all_modules)
00733         self._insertOneInto(processPSet,  "@all_sources", self.source_())
00734         self._insertOneInto(processPSet,  "@all_loopers",   self.looper_())
00735         self._insertManyInto(processPSet, "@all_esmodules", self.es_producers_())
00736         self._insertManyInto(processPSet, "@all_essources", self.es_sources_())
00737         self._insertManyInto(processPSet, "@all_esprefers", self.es_prefers_())
00738         self._insertPaths(processDesc, processPSet)
00739         self._insertServices(processDesc, self.services_())
00740         return processDesc

def Config::Process::filterNames (   self)

Definition at line 135 of file Config.py.

00136                          :
       return ' '.join(self.filters_().keys())
def Config::Process::filters_ (   self)
returns a dict of the filters which have been added to the Process

Definition at line 157 of file Config.py.

00158                       :
00159         """returns a dict of the filters which have been added to the Process"""
        return DictTypes.FixedKeysDict(self.__filters)
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 623 of file Config.py.

00624                                      :
00625         """ Replace the item with label 'label' by object 'new' in the process and all sequences/paths"""
00626         if not hasattr(self,label):
00627             raise LookupError("process has no item of label "+label)
00628         self._replaceInSequences(label, new)
        setattr(self,label,new)
def Config::Process::load (   self,
  moduleName 
)

Definition at line 411 of file Config.py.

00412                               :
00413         moduleName = moduleName.replace("/",".")
00414         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 176 of file Config.py.

00177                      :
00178         """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 161 of file Config.py.

00162                    :
        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 186 of file Config.py.

00187                             :
00188         """returns a dict of the output modules which have been added to the Process"""
        return DictTypes.FixedKeysDict(self.__outputmodules)
def Config::Process::pathNames (   self)

Definition at line 137 of file Config.py.

00138                        :
00139        return ' '.join(self.paths_().keys())

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

Definition at line 190 of file Config.py.

00191                     :
00192         """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 748 of file Config.py.

00749                                             :
00750         """Prefer this ES source or producer.  The argument can
00751            either be an object label, e.g.,
00752              process.prefer(process.juicerProducer) (not supported yet)
00753            or a name of an ESSource or ESProducer
00754              process.prefer("juicer")
00755            or a type of unnamed ESSource or ESProducer
00756              process.prefer("JuicerProducer")
00757            In addition, you can pass as a labelled arguments the name of the Record you wish to
00758            prefer where the type passed is a cms.vstring and that vstring can contain the
00759            name of the C++ types in the Record which are being preferred, e.g.,
00760               #prefer all data in record 'OrangeRecord' from 'juicer'
00761               process.prefer("juicer", OrangeRecord=cms.vstring())
00762            or
00763               #prefer only "Orange" data in "OrangeRecord" from "juicer"
00764               process.prefer("juicer", OrangeRecord=cms.vstring("Orange"))
00765            or
00766               #prefer only "Orange" data with label "ExtraPulp" in "OrangeRecord" from "juicer"
00767               ESPrefer("ESJuicerProd", OrangeRecord=cms.vstring("Orange/ExtraPulp"))
00768         """
00769         # see if this refers to a named ESProducer
00770         if isinstance(esmodule, ESSource) or isinstance(esmodule, ESProducer):
00771             raise RuntimeError("Syntax of process.prefer(process.esmodule) not supported yet")
00772         elif self._findPreferred(esmodule, self.es_producers_(),*args,**kargs) or \
00773                 self._findPreferred(esmodule, self.es_sources_(),*args,**kargs):
00774             pass
00775         else:
00776             raise RuntimeError("Cannot resolve prefer for "+repr(esmodule))

def Config::Process::producerNames (   self)

Definition at line 131 of file Config.py.

00132                            :
        return ' '.join(self.producers_().keys())
def Config::Process::producers_ (   self)
returns a dict of the producers which have been added to the Process

Definition at line 166 of file Config.py.

00167                         :
00168         """returns a dict of the producers which have been added to the Process"""
        return DictTypes.FixedKeysDict(self.__producers)
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 690 of file Config.py.

00691                    :
00692         """ Remove clutter from the process which we think is unnecessary:
00693         PSets, and unused modules.  Not working yet, because I need to remove
00694         all unneeded sequences and paths that contain removed modules """
00695         for name in self.psets_():
00696             delattr(self, name)
00697         for name in self.vpsets_():
00698             delattr(self, name)
00699 
00700         if self.schedule_():
00701             self.pruneSequences()
00702             scheduledNames = self.schedule_().moduleNames()
00703             self.pruneModules(self.producers_(), scheduledNames)
00704             self.pruneModules(self.filters_(), scheduledNames)
00705             self.pruneModules(self.analyzers_(), scheduledNames)

def Config::Process::pruneModules (   self,
  d,
  scheduledNames 
)

Definition at line 716 of file Config.py.

00717                                              :
00718         moduleNames = set(d.keys())
00719         junk = moduleNames - scheduledNames
00720         for name in junk:
00721             delattr(self, name)

def Config::Process::pruneSequences (   self)

Definition at line 706 of file Config.py.

00707                             :
00708         scheduledSequences = []
00709         visitor = SequenceVisitor(scheduledSequences)
00710         #self.schedule_()._seq.visit(visitor)
00711         #scheduledSequenceNames = set([seq.label_() for seq in scheduledSequences])
00712         #sequenceNames = set(self.sequences_().keys())
00713         #junk = sequenceNames - scheduledSequenceNames
00714         #for name in junk:
00715         #    delattr(self, name)

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

Definition at line 238 of file Config.py.

00239                     :
00240         """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 202 of file Config.py.

00203                        :
00204         """returns the schedule which has been added to the Process or None if none have been added"""
        return self.__schedule
def Config::Process::sequences_ (   self)
returns a dict of the sequences which have been added to the Process

Definition at line 198 of file Config.py.

00199                         :
00200         """returns a dict of the sequences which have been added to the Process"""
        return DictTypes.FixedKeysDict(self.__sequences)
def Config::Process::services_ (   self)
returns a dict of the services which have been added to the Process

Definition at line 222 of file Config.py.

00223                        :
00224         """returns a dict of the services which have been added to the Process"""
        return DictTypes.FixedKeysDict(self.__services)
def Config::Process::setLooper_ (   self,
  lpr 
)

Definition at line 179 of file Config.py.

00180                             :
        self._placeLooper('looper',lpr)
def Config::Process::setName_ (   self,
  name 
)

Definition at line 163 of file Config.py.

00164                            :
        self.__dict__['_Process__name'] = name
def Config::Process::setPartialSchedule_ (   self,
  sch,
  label 
)

Definition at line 205 of file Config.py.

00206                                            :
00207         if label == "schedule":
00208             self.setSchedule_(sch)
00209         else:
            self._place(label, sch, self.__partialschedules)
def Config::Process::setSchedule_ (   self,
  sch 
)

Definition at line 210 of file Config.py.

00211                               :
00212                 # See if every module has been inserted into the process
00213         index = 0
00214         try:
00215             for p in sch:
00216                p.label_()
00217                index +=1
00218         except:
00219             raise RuntimeError("The path at index "+str(index)+" in the Schedule was not attached to the process.")
00220 
        self.__dict__['_Process__schedule'] = sch
def Config::Process::setSource_ (   self,
  src 
)

Definition at line 173 of file Config.py.

00174                             :
        self._placeSource('source',src)
def Config::Process::setStrict (   self,
  value 
)

Definition at line 126 of file Config.py.

00127                               :
00128         self.__isStrict = value
00129         _Module.__isStrict__ = True

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

00171                      :
00172         """returns the source which has been added to the Process or None if none have been added"""
        return self.__source
def Config::Process::validate (   self)

Definition at line 741 of file Config.py.

00742                       :
00743         # check if there's some input
00744         # Breaks too many unit tests for now
00745         #if self.source_() == None and self.looper_() == None:
00746         #    raise RuntimeError("No input source was found for this process")
00747         pass

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

Definition at line 242 of file Config.py.

00243                      :
00244         """returns a dict of the VPSets which have been added to the Process"""
        return DictTypes.FixedKeysDict(self.__vpsets)

Member Data Documentation

Definition at line 102 of file Config.py.


Property Documentation

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

Definition at line 185 of file Config.py.

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

Definition at line 197 of file Config.py.

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

Definition at line 237 of file Config.py.

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

Definition at line 229 of file Config.py.

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

Definition at line 233 of file Config.py.

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

Definition at line 160 of file Config.py.

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

Definition at line 181 of file Config.py.

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

Definition at line 189 of file Config.py.

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

Definition at line 193 of file Config.py.

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

Definition at line 165 of file Config.py.

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

Definition at line 169 of file Config.py.

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

Definition at line 241 of file Config.py.

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

Definition at line 221 of file Config.py.

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

Definition at line 201 of file Config.py.

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

Definition at line 225 of file Config.py.

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

Definition at line 175 of file Config.py.

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

Definition at line 245 of file Config.py.