![]() |
![]() |
Public Member Functions | |
def | __delattr__ |
def | __init__ |
def | __setattr__ |
def | __setstate__ |
def | add_ |
def | analyzerNames |
def | analyzers_ |
def | dumpConfig |
def | dumpPython |
def | endpaths_ |
def | es_prefers_ |
def | es_producers_ |
def | es_sources_ |
def | extend |
def | fillProcessDesc |
def | filterNames |
def | filters_ |
def | globalReplace |
def | load |
def | looper_ |
def | name_ |
def | outputModules_ |
def | pathNames |
def | paths_ |
def | prefer |
def | producerNames |
def | producers_ |
def | prune |
def | pruneModules |
def | pruneSequences |
def | psets_ |
def | schedule_ |
def | sequences_ |
def | services_ |
def | setLooper_ |
def | setName_ |
def | setPartialSchedule_ |
def | setSchedule_ |
def | setSource_ |
def | setStrict |
def | setSubProcess_ |
def | source_ |
def | subProcess_ |
def | validate |
def | vpsets_ |
Properties | |
analyzers = property(analyzers_,doc="dictionary containing the analyzers for the process") | |
endpaths = property(endpaths_,doc="dictionary containing the endpaths for the process") | |
es_prefers = property(es_prefers_,doc="dictionary containing the es_prefers for the process") | |
es_producers = property(es_producers_,doc="dictionary containing the es_producers for the process") | |
es_sources = property(es_sources_,doc="dictionary containing the es_sources for the process") | |
filters = property(filters_, doc="dictionary containing the filters for the process") | |
looper = property(looper_,setLooper_,doc='the main looper or None if not set') | |
outputModules = property(outputModules_,doc="dictionary containing the output_modules for the process") | |
paths = property(paths_,doc="dictionary containing the paths for the process") | |
process = property(name_,setName_, doc="name of the process") | |
producers = property(producers_,doc="dictionary containing the producers for the process") | |
psets = property(psets_,doc="dictionary containing the PSets for the process") | |
schedule = property(schedule_,setSchedule_,doc='the schedule or None if not set') | |
sequences = property(sequences_,doc="dictionary containing the sequences for the process") | |
services = property(services_,doc="dictionary containing the services for the process") | |
source = property(source_,setSource_,doc='the main source or None if not set') | |
subProcess = property(subProcess_,setSubProcess_,doc='the SubProcess or None if not set') | |
vpsets = property(vpsets_,doc="dictionary containing the PSets for the process") | |
Private Member Functions | |
def | _dumpConfigESPrefers |
def | _dumpConfigNamedList |
def | _dumpConfigOptionallyNamedList |
def | _dumpConfigUnnamedList |
def | _dumpPython |
def | _dumpPythonList |
def | _findPreferred |
def | _insertInto |
def | _insertManyInto |
def | _insertOneInto |
def | _insertPaths |
def | _okToPlace |
def | _place |
def | _placeAnalyzer |
def | _placeEndPath |
def | _placeESPrefer |
def | _placeESProducer |
def | _placeESSource |
def | _placeFilter |
def | _placeLooper |
def | _placeOutputModule |
def | _placePath |
def | _placeProducer |
def | _placePSet |
def | _placeSequence |
def | _placeService |
def | _placeSource |
def | _placeSubProcess |
def | _placeVPSet |
def | _replaceInSequences |
def | _sequencesInDependencyOrder |
def | _validateSequence |
Private Attributes | |
__isStrict | |
__processPSet | |
__thelist |
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__subProcess'] = None 00110 self.__dict__['_Process__schedule'] = None 00111 self.__dict__['_Process__analyzers'] = {} 00112 self.__dict__['_Process__outputmodules'] = {} 00113 self.__dict__['_Process__paths'] = DictTypes.SortedKeysDict() # have to keep the order 00114 self.__dict__['_Process__endpaths'] = DictTypes.SortedKeysDict() # of definition 00115 self.__dict__['_Process__sequences'] = {} 00116 self.__dict__['_Process__services'] = {} 00117 self.__dict__['_Process__essources'] = {} 00118 self.__dict__['_Process__esproducers'] = {} 00119 self.__dict__['_Process__esprefers'] = {} 00120 self.__dict__['_Process__psets']={} 00121 self.__dict__['_Process__vpsets']={} 00122 self.__dict__['_cloneToObjectDict'] = {} 00123 # policy switch to avoid object overwriting during extend/load 00124 self.__dict__['_Process__InExtendCall'] = False 00125 self.__dict__['_Process__partialschedules'] = {} 00126 self.__isStrict = False
def Config::Process::__delattr__ | ( | self, | |
name | |||
) |
Definition at line 303 of file Config.py.
00304 : 00305 if not hasattr(self,name): 00306 raise KeyError('process does not know about '+name) 00307 elif name.startswith('_Process__'): 00308 raise ValueError('this attribute cannot be deleted') 00309 else: 00310 # we have to remove it from all dictionaries/registries 00311 dicts = [item for item in self.__dict__.values() if (type(item)==dict or type(item)==DictTypes.SortedKeysDict)] 00312 for reg in dicts: 00313 if reg.has_key(name): del reg[name] 00314 # if it was a labelable object, the label needs to be removed 00315 obj = getattr(self,name) 00316 if isinstance(obj,_Labelable): 00317 getattr(self,name).setLabel(None) 00318 # now remove it from the process itself 00319 try: 00320 del self.__dict__[name] 00321 except: 00322 pass
def Config::Process::__setattr__ | ( | self, | |
name, | |||
value | |||
) |
Definition at line 253 of file Config.py.
00254 : 00255 # check if the name is well-formed (only _ and alphanumerics are allowed) 00256 if not name.replace('_','').isalnum(): 00257 raise ValueError('The label '+name+' contains forbiden characters') 00258 00259 # private variable exempt from all this 00260 if name.startswith('_Process__'): 00261 self.__dict__[name]=value 00262 return 00263 if not isinstance(value,_ConfigureComponent): 00264 raise TypeError("can only assign labels to an object which inherits from '_ConfigureComponent'\n" 00265 +"an instance of "+str(type(value))+" will not work") 00266 if not isinstance(value,_Labelable) and not isinstance(value,Source) and not isinstance(value,Looper) and not isinstance(value,Schedule): 00267 if name == value.type_(): 00268 self.add_(value) 00269 return 00270 else: 00271 raise TypeError("an instance of "+str(type(value))+" can not be assigned the label '"+name+"'.\n"+ 00272 "Please either use the label '"+value.type_()+" or use the 'add_' method instead.") 00273 #clone the item 00274 if self.__isStrict: 00275 newValue =value.copy() 00276 try: 00277 newValue._filename = value._filename 00278 except: 00279 pass 00280 value.setIsFrozen() 00281 else: 00282 newValue =value 00283 if not self._okToPlace(name, value, self.__dict__): 00284 msg = "Trying to override definition of process."+name 00285 msg += "\n new object defined in: "+value._filename 00286 msg += "\n existing object defined in: "+getattr(self,name)._filename 00287 raise ValueError(msg) 00288 # remove the old object of the name (if there is one) 00289 if hasattr(self,name) and not (getattr(self,name)==newValue): 00290 # Allow items in sequences from load() statements to have 00291 # degeneratate names, but if the user overwrites a name in the 00292 # main config, replace it everywhere 00293 if not self.__InExtendCall and isinstance(newValue, _Sequenceable): 00294 self._replaceInSequences(name, newValue) 00295 self.__delattr__(name) 00296 self.__dict__[name]=newValue 00297 if isinstance(newValue,_Labelable): 00298 newValue.setLabel(name) 00299 self._cloneToObjectDict[id(value)] = newValue 00300 self._cloneToObjectDict[id(newValue)] = newValue 00301 #now put in proper bucket 00302 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 141 of file Config.py.
00142 : 00143 """ 00144 Unpickling hook. 00145 00146 Since cloneToObjectDict stores a hash of objects by their 00147 id() it needs to be updated when unpickling to use the 00148 new object id values instantiated during the unpickle. 00149 00150 """ 00151 self.__dict__.update(pkldict) 00152 tmpDict = {} 00153 for value in self._cloneToObjectDict.values(): 00154 tmpDict[id(value)] = value 00155 self.__dict__['_cloneToObjectDict'] = tmpDict 00156 00157
def Config::Process::_dumpConfigESPrefers | ( | self, | |
options | |||
) | [private] |
def Config::Process::_dumpConfigNamedList | ( | self, | |
items, | |||
typeName, | |||
options | |||
) | [private] |
def Config::Process::_dumpConfigOptionallyNamedList | ( | self, | |
items, | |||
typeName, | |||
options | |||
) | [private] |
def Config::Process::_dumpConfigUnnamedList | ( | self, | |
items, | |||
typeName, | |||
options | |||
) | [private] |
def Config::Process::_dumpPython | ( | self, | |
d, | |||
options | |||
) | [private] |
def Config::Process::_dumpPythonList | ( | self, | |
d, | |||
options | |||
) | [private] |
Definition at line 550 of file Config.py.
00551 : 00552 returnValue = '' 00553 if isinstance(d, DictTypes.SortedKeysDict): 00554 for name,item in d.items(): 00555 returnValue +='process.'+name+' = '+item.dumpPython(options)+'\n\n' 00556 else: 00557 for name,item in sorted(d.items()): 00558 returnValue +='process.'+name+' = '+item.dumpPython(options)+'\n\n' return returnValue
def Config::Process::_findPreferred | ( | self, | |
esname, | |||
d, | |||
args, | |||
kargs | |||
) | [private] |
Definition at line 806 of file Config.py.
00807 : 00808 # is esname a name in the dictionary? 00809 if esname in d: 00810 typ = d[esname].type_() 00811 if typ == esname: 00812 self.__setattr__( esname+"_prefer", ESPrefer(typ,*args,**kargs) ) 00813 else: 00814 self.__setattr__( esname+"_prefer", ESPrefer(typ, esname,*args,**kargs) ) 00815 return True 00816 else: 00817 # maybe it's an unnamed ESModule? 00818 found = False 00819 for name, value in d.iteritems(): 00820 if value.type_() == esname: 00821 if found: 00822 raise RuntimeError("More than one ES module for "+esname) 00823 found = True 00824 self.__setattr__(esname+"_prefer", ESPrefer(d[esname].type_()) ) 00825 return found
def Config::Process::_insertInto | ( | self, | |
parameterSet, | |||
itemDict | |||
) | [private] |
def Config::Process::_insertManyInto | ( | self, | |
parameterSet, | |||
label, | |||
itemDict, | |||
tracked | |||
) | [private] |
Definition at line 656 of file Config.py.
00657 : 00658 l = [] 00659 for name,value in itemDict.iteritems(): 00660 newLabel = value.nameInProcessDesc_(name) 00661 l.append(newLabel) 00662 value.insertInto(parameterSet, name) 00663 # alphabetical order is easier to compare with old language 00664 l.sort() parameterSet.addVString(tracked, label, l)
def Config::Process::_insertOneInto | ( | self, | |
parameterSet, | |||
label, | |||
item, | |||
tracked | |||
) | [private] |
def Config::Process::_insertPaths | ( | self, | |
processPSet | |||
) | [private] |
Definition at line 665 of file Config.py.
00666 : 00667 scheduledPaths = [] 00668 triggerPaths = [] 00669 endpaths = [] 00670 if self.schedule_() == None: 00671 # make one from triggerpaths & endpaths 00672 for name,value in self.paths_().iteritems(): 00673 scheduledPaths.append(name) 00674 triggerPaths.append(name) 00675 for name,value in self.endpaths_().iteritems(): 00676 scheduledPaths.append(name) 00677 endpaths.append(name) 00678 else: 00679 for path in self.schedule_(): 00680 pathname = path.label_() 00681 scheduledPaths.append(pathname) 00682 if self.endpaths_().has_key(pathname): 00683 endpaths.append(pathname) 00684 else: 00685 triggerPaths.append(pathname) 00686 processPSet.addVString(True, "@end_paths", endpaths) 00687 processPSet.addVString(True, "@paths", scheduledPaths) 00688 # trigger_paths are a little different 00689 p = processPSet.newPSet() 00690 p.addVString(True, "@trigger_paths", triggerPaths) 00691 processPSet.addPSet(True, "@trigger_paths", p) 00692 # add all these paths 00693 pathValidator = PathValidator() 00694 endpathValidator = EndPathValidator() 00695 for triggername in triggerPaths: 00696 #self.paths_()[triggername].insertInto(processPSet, triggername, self.sequences_()) 00697 pathValidator.setLabel(triggername) 00698 self.paths_()[triggername].visit(pathValidator) 00699 self.paths_()[triggername].insertInto(processPSet, triggername, self.__dict__) 00700 for endpathname in endpaths: 00701 #self.endpaths_()[endpathname].insertInto(processPSet, endpathname, self.sequences_()) 00702 endpathValidator.setLabel(endpathname) 00703 self.endpaths_()[endpathname].visit(endpathValidator) 00704 self.endpaths_()[endpathname].insertInto(processPSet, endpathname, self.__dict__) 00705 processPSet.addVString(False, "@filters_on_endpaths", endpathValidator.filtersOnEndpaths)
def Config::Process::_okToPlace | ( | self, | |
name, | |||
mod, | |||
d | |||
) | [private] |
Definition at line 338 of file Config.py.
00339 : 00340 if not self.__InExtendCall: 00341 # if going 00342 return True 00343 elif not self.__isStrict: 00344 return True 00345 elif name in d: 00346 # if there's an old copy, and the new one 00347 # hasn't been modified, we're done. Still 00348 # not quite safe if something has been defined twice. 00349 # Need to add checks 00350 if mod._isModified: 00351 if d[name]._isModified: 00352 return False 00353 else: 00354 return True 00355 else: 00356 return True 00357 else: 00358 return True
def Config::Process::_place | ( | self, | |
name, | |||
mod, | |||
d | |||
) | [private] |
def Config::Process::_placeAnalyzer | ( | self, | |
name, | |||
mod | |||
) | [private] |
def Config::Process::_placeEndPath | ( | self, | |
name, | |||
mod | |||
) | [private] |
def Config::Process::_placeESPrefer | ( | self, | |
name, | |||
mod | |||
) | [private] |
def Config::Process::_placeESProducer | ( | self, | |
name, | |||
mod | |||
) | [private] |
def Config::Process::_placeESSource | ( | self, | |
name, | |||
mod | |||
) | [private] |
def Config::Process::_placeFilter | ( | self, | |
name, | |||
mod | |||
) | [private] |
def Config::Process::_placeLooper | ( | self, | |
name, | |||
mod | |||
) | [private] |
def Config::Process::_placeOutputModule | ( | self, | |
name, | |||
mod | |||
) | [private] |
def Config::Process::_placePath | ( | self, | |
name, | |||
mod | |||
) | [private] |
def Config::Process::_placeProducer | ( | self, | |
name, | |||
mod | |||
) | [private] |
def Config::Process::_placePSet | ( | self, | |
name, | |||
mod | |||
) | [private] |
def Config::Process::_placeSequence | ( | self, | |
name, | |||
mod | |||
) | [private] |
def Config::Process::_placeService | ( | self, | |
typeName, | |||
mod | |||
) | [private] |
def Config::Process::_placeSource | ( | self, | |
name, | |||
mod | |||
) | [private] |
Allow the source to be referenced by 'source' or by type name
Definition at line 402 of file Config.py.
00403 : 00404 """Allow the source to be referenced by 'source' or by type name""" 00405 if name != 'source': 00406 raise ValueError("The label '"+name+"' can not be used for a Source. Only 'source' is allowed.") 00407 if self.__dict__['_Process__source'] is not None : 00408 del self.__dict__[self.__dict__['_Process__source'].type_()] 00409 self.__dict__['_Process__source'] = mod self.__dict__[mod.type_()] = mod
def Config::Process::_placeSubProcess | ( | self, | |
name, | |||
mod | |||
) | [private] |
def Config::Process::_placeVPSet | ( | self, | |
name, | |||
mod | |||
) | [private] |
def Config::Process::_replaceInSequences | ( | self, | |
label, | |||
new | |||
) | [private] |
Definition at line 631 of file Config.py.
00632 : 00633 old = getattr(self,label) 00634 #TODO - replace by iterator concatenation 00635 for sequenceable in self.sequences.itervalues(): 00636 sequenceable.replace(old,new) 00637 for sequenceable in self.paths.itervalues(): 00638 sequenceable.replace(old,new) 00639 for sequenceable in self.endpaths.itervalues(): sequenceable.replace(old,new)
def Config::Process::_sequencesInDependencyOrder | ( | self | ) | [private] |
Definition at line 567 of file Config.py.
00568 : 00569 #for each sequence, see what other sequences it depends upon 00570 returnValue=DictTypes.SortedKeysDict() 00571 dependencies = {} 00572 for label,seq in self.sequences.iteritems(): 00573 d = [] 00574 v = SequenceVisitor(d) 00575 seq.visit(v) 00576 dependencies[label]=[dep.label_() for dep in d if dep.hasLabel_()] 00577 resolvedDependencies=True 00578 #keep looping until we can no longer get rid of all dependencies 00579 # if that happens it means we have circular dependencies 00580 iterCount = 0 00581 while resolvedDependencies: 00582 iterCount += 1 00583 resolvedDependencies = (0 != len(dependencies)) 00584 oldDeps = dict(dependencies) 00585 for label,deps in oldDeps.iteritems(): 00586 # don't try too hard 00587 if len(deps)==0 or iterCount > 100: 00588 iterCount = 0 00589 resolvedDependencies=True 00590 returnValue[label]=self.sequences[label] 00591 #remove this as a dependency for all other sequences 00592 del dependencies[label] 00593 for lb2,deps2 in dependencies.iteritems(): 00594 while deps2.count(label): 00595 deps2.remove(label) 00596 if len(dependencies): 00597 raise RuntimeError("circular sequence dependency discovered \n"+ 00598 ",".join([label for label,junk in dependencies.iteritems()])) return returnValue
def Config::Process::_validateSequence | ( | self, | |
sequence, | |||
label | |||
) | [private] |
def Config::Process::add_ | ( | self, | |
value | |||
) |
Allows addition of components which do not have to have a label, e.g. Services
Definition at line 323 of file Config.py.
00324 : 00325 """Allows addition of components which do not have to have a label, e.g. Services""" 00326 if not isinstance(value,_ConfigureComponent): 00327 raise TypeError 00328 if not isinstance(value,_Unlabelable): 00329 raise TypeError 00330 #clone the item 00331 #clone the item 00332 if self.__isStrict: 00333 newValue =value.copy() 00334 value.setIsFrozen() 00335 else: 00336 newValue =value 00337 newValue._place('',self)
def Config::Process::analyzerNames | ( | self | ) |
def Config::Process::analyzers_ | ( | self | ) |
def Config::Process::dumpConfig | ( | self, | |
options = PrintOptions() |
|||
) |
return a string containing the equivalent process defined using the configuration language
Definition at line 487 of file Config.py.
00488 : 00489 """return a string containing the equivalent process defined using the configuration language""" 00490 config = "process "+self.__name+" = {\n" 00491 options.indent() 00492 if self.source_(): 00493 config += options.indentation()+"source = "+self.source_().dumpConfig(options) 00494 if self.looper_(): 00495 config += options.indentation()+"looper = "+self.looper_().dumpConfig(options) 00496 if self.subProcess_(): 00497 config += options.indentation()+"subProcess = "+self.subProcess_().dumpConfig(options) 00498 00499 config+=self._dumpConfigNamedList(self.producers_().iteritems(), 00500 'module', 00501 options) 00502 config+=self._dumpConfigNamedList(self.filters_().iteritems(), 00503 'module', 00504 options) 00505 config+=self._dumpConfigNamedList(self.analyzers_().iteritems(), 00506 'module', 00507 options) 00508 config+=self._dumpConfigNamedList(self.outputModules_().iteritems(), 00509 'module', 00510 options) 00511 config+=self._dumpConfigNamedList(self.sequences_().iteritems(), 00512 'sequence', 00513 options) 00514 config+=self._dumpConfigNamedList(self.paths_().iteritems(), 00515 'path', 00516 options) 00517 config+=self._dumpConfigNamedList(self.endpaths_().iteritems(), 00518 'endpath', 00519 options) 00520 config+=self._dumpConfigUnnamedList(self.services_().iteritems(), 00521 'service', 00522 options) 00523 config+=self._dumpConfigOptionallyNamedList( 00524 self.es_producers_().iteritems(), 00525 'es_module', 00526 options) 00527 config+=self._dumpConfigOptionallyNamedList( 00528 self.es_sources_().iteritems(), 00529 'es_source', 00530 options) 00531 config += self._dumpConfigESPrefers(options) 00532 for name,item in self.psets.iteritems(): 00533 config +=options.indentation()+item.configTypeName()+' '+name+' = '+item.configValue(options) 00534 for name,item in self.vpsets.iteritems(): 00535 config +=options.indentation()+'VPSet '+name+' = '+item.configValue(options) 00536 if self.schedule: 00537 pathNames = [p.label_() for p in self.schedule] 00538 config +=options.indentation()+'schedule = {'+','.join(pathNames)+'}\n' 00539 00540 # config+=self._dumpConfigNamedList(self.vpsets.iteritems(), 00541 # 'VPSet', 00542 # options) 00543 config += "}\n" 00544 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 604 of file Config.py.
00605 : 00606 """return a string containing the equivalent process defined using the configuration language""" 00607 result = "import FWCore.ParameterSet.Config as cms\n\n" 00608 result += "process = cms.Process(\""+self.__name+"\")\n\n" 00609 if self.source_(): 00610 result += "process.source = "+self.source_().dumpPython(options) 00611 if self.looper_(): 00612 result += "process.looper = "+self.looper_().dumpPython() 00613 if self.subProcess_(): 00614 result += self.subProcess_().dumpPython(options) 00615 result+=self._dumpPythonList(self.producers_(), options) 00616 result+=self._dumpPythonList(self.filters_() , options) 00617 result+=self._dumpPythonList(self.analyzers_(), options) 00618 result+=self._dumpPythonList(self.outputModules_(), options) 00619 result+=self._dumpPythonList(self._sequencesInDependencyOrder(), options) 00620 result+=self._dumpPythonList(self.paths_(), options) 00621 result+=self._dumpPythonList(self.endpaths_(), options) 00622 result+=self._dumpPythonList(self.services_(), options) 00623 result+=self._dumpPythonList(self.es_producers_(), options) 00624 result+=self._dumpPythonList(self.es_sources_(), options) 00625 result+=self._dumpPython(self.es_prefers_(), options) 00626 result+=self._dumpPythonList(self.psets, options) 00627 result+=self._dumpPythonList(self.vpsets, options) 00628 if self.schedule: 00629 pathNames = ['process.'+p.label_() for p in self.schedule] 00630 result +='process.schedule = cms.Schedule('+','.join(pathNames)+')\n' return result
def Config::Process::endpaths_ | ( | self | ) |
def Config::Process::es_prefers_ | ( | self | ) |
def Config::Process::es_producers_ | ( | self | ) |
def Config::Process::es_sources_ | ( | self | ) |
def Config::Process::extend | ( | self, | |
other, | |||
items = () |
|||
) |
Look in other and find types which we can use
Definition at line 427 of file Config.py.
00428 : 00429 """Look in other and find types which we can use""" 00430 # enable explicit check to avoid overwriting of existing objects 00431 self.__dict__['_Process__InExtendCall'] = True 00432 00433 seqs = dict() 00434 labelled = dict() 00435 for name in dir(other): 00436 #'from XX import *' ignores these, and so should we. 00437 if name.startswith('_'): 00438 continue 00439 item = getattr(other,name) 00440 if name == "source" or name == "looper" or name == "subProcess": 00441 self.__setattr__(name,item) 00442 elif isinstance(item,_ModuleSequenceType): 00443 seqs[name]=item 00444 elif isinstance(item,_Labelable): 00445 self.__setattr__(name,item) 00446 labelled[name]=item 00447 try: 00448 item.label_() 00449 except: 00450 item.setLabel(name) 00451 continue 00452 elif isinstance(item,Schedule): 00453 self.__setattr__(name,item) 00454 elif isinstance(item,_Unlabelable): 00455 self.add_(item) 00456 00457 #now create a sequence which uses the newly made items 00458 for name in seqs.iterkeys(): 00459 seq = seqs[name] 00460 #newSeq = seq.copy() 00461 # 00462 if id(seq) not in self._cloneToObjectDict: 00463 self.__setattr__(name,seq) 00464 else: 00465 newSeq = self._cloneToObjectDict[id(seq)] 00466 self.__dict__[name]=newSeq 00467 newSeq.setLabel(name) 00468 #now put in proper bucket 00469 newSeq._place(name,self) self.__dict__['_Process__InExtendCall'] = False
def Config::Process::fillProcessDesc | ( | self, | |
processPSet | |||
) |
Definition at line 738 of file Config.py.
00739 : 00740 class ServiceInjectorAdaptor(object): 00741 def __init__(self,ppset,thelist): 00742 self.__thelist = thelist 00743 self.__processPSet = ppset 00744 def addService(self,pset): 00745 self.__thelist.append(pset) 00746 def newPSet(self): 00747 return self.__processPSet.newPSet() 00748 self.validate() 00749 processPSet.addString(True, "@process_name", self.name_()) 00750 all_modules = self.producers_().copy() 00751 all_modules.update(self.filters_()) 00752 all_modules.update(self.analyzers_()) 00753 all_modules.update(self.outputModules_()) 00754 self._insertInto(processPSet, self.psets_()) 00755 self._insertInto(processPSet, self.vpsets_()) 00756 self._insertManyInto(processPSet, "@all_modules", all_modules, True) 00757 self._insertOneInto(processPSet, "@all_sources", self.source_(), True) 00758 self._insertOneInto(processPSet, "@all_loopers", self.looper_(), True) 00759 self._insertOneInto(processPSet, "@all_subprocesses", self.subProcess_(), False) 00760 self._insertManyInto(processPSet, "@all_esmodules", self.es_producers_(), True) 00761 self._insertManyInto(processPSet, "@all_essources", self.es_sources_(), True) 00762 self._insertManyInto(processPSet, "@all_esprefers", self.es_prefers_(), True) 00763 self._insertPaths(processPSet) 00764 #handle services differently 00765 services = [] 00766 for n in self.services_(): 00767 getattr(self,n).insertInto(ServiceInjectorAdaptor(processPSet,services)) 00768 processPSet.addVPSet(False,"services",services) 00769 return processPSet
def Config::Process::filterNames | ( | self | ) |
def Config::Process::filters_ | ( | self | ) |
def Config::Process::globalReplace | ( | self, | |
label, | |||
new | |||
) |
Replace the item with label 'label' by object 'new' in the process and all sequences/paths
def Config::Process::load | ( | self, | |
moduleName | |||
) |
def Config::Process::looper_ | ( | self | ) |
def Config::Process::name_ | ( | self | ) |
def Config::Process::outputModules_ | ( | self | ) |
def Config::Process::pathNames | ( | self | ) |
def Config::Process::paths_ | ( | self | ) |
def Config::Process::prefer | ( | self, | |
esmodule, | |||
args, | |||
kargs | |||
) |
Prefer this ES source or producer. The argument can either be an object label, e.g., process.prefer(process.juicerProducer) (not supported yet) or a name of an ESSource or ESProducer process.prefer("juicer") or a type of unnamed ESSource or ESProducer process.prefer("JuicerProducer") In addition, you can pass as a labelled arguments the name of the Record you wish to prefer where the type passed is a cms.vstring and that vstring can contain the name of the C++ types in the Record which are being preferred, e.g., #prefer all data in record 'OrangeRecord' from 'juicer' process.prefer("juicer", OrangeRecord=cms.vstring()) or #prefer only "Orange" data in "OrangeRecord" from "juicer" process.prefer("juicer", OrangeRecord=cms.vstring("Orange")) or #prefer only "Orange" data with label "ExtraPulp" in "OrangeRecord" from "juicer" ESPrefer("ESJuicerProd", OrangeRecord=cms.vstring("Orange/ExtraPulp"))
Definition at line 777 of file Config.py.
00778 : 00779 """Prefer this ES source or producer. The argument can 00780 either be an object label, e.g., 00781 process.prefer(process.juicerProducer) (not supported yet) 00782 or a name of an ESSource or ESProducer 00783 process.prefer("juicer") 00784 or a type of unnamed ESSource or ESProducer 00785 process.prefer("JuicerProducer") 00786 In addition, you can pass as a labelled arguments the name of the Record you wish to 00787 prefer where the type passed is a cms.vstring and that vstring can contain the 00788 name of the C++ types in the Record which are being preferred, e.g., 00789 #prefer all data in record 'OrangeRecord' from 'juicer' 00790 process.prefer("juicer", OrangeRecord=cms.vstring()) 00791 or 00792 #prefer only "Orange" data in "OrangeRecord" from "juicer" 00793 process.prefer("juicer", OrangeRecord=cms.vstring("Orange")) 00794 or 00795 #prefer only "Orange" data with label "ExtraPulp" in "OrangeRecord" from "juicer" 00796 ESPrefer("ESJuicerProd", OrangeRecord=cms.vstring("Orange/ExtraPulp")) 00797 """ 00798 # see if this refers to a named ESProducer 00799 if isinstance(esmodule, ESSource) or isinstance(esmodule, ESProducer): 00800 raise RuntimeError("Syntax of process.prefer(process.esmodule) not supported yet") 00801 elif self._findPreferred(esmodule, self.es_producers_(),*args,**kargs) or \ 00802 self._findPreferred(esmodule, self.es_sources_(),*args,**kargs): 00803 pass 00804 else: 00805 raise RuntimeError("Cannot resolve prefer for "+repr(esmodule))
def Config::Process::producerNames | ( | self | ) |
def Config::Process::producers_ | ( | self | ) |
def Config::Process::prune | ( | self | ) |
Remove clutter from the process which we think is unnecessary: PSets, and unused modules. Not working yet, because I need to remove all unneeded sequences and paths that contain removed modules
Definition at line 706 of file Config.py.
00707 : 00708 """ Remove clutter from the process which we think is unnecessary: 00709 PSets, and unused modules. Not working yet, because I need to remove 00710 all unneeded sequences and paths that contain removed modules """ 00711 for name in self.psets_(): 00712 delattr(self, name) 00713 for name in self.vpsets_(): 00714 delattr(self, name) 00715 00716 if self.schedule_(): 00717 self.pruneSequences() 00718 scheduledNames = self.schedule_().moduleNames() 00719 self.pruneModules(self.producers_(), scheduledNames) 00720 self.pruneModules(self.filters_(), scheduledNames) 00721 self.pruneModules(self.analyzers_(), scheduledNames)
def Config::Process::pruneModules | ( | self, | |
d, | |||
scheduledNames | |||
) |
def Config::Process::pruneSequences | ( | self | ) |
Definition at line 722 of file Config.py.
00723 : 00724 scheduledSequences = [] 00725 visitor = SequenceVisitor(scheduledSequences) 00726 #self.schedule_()._seq.visit(visitor) 00727 #scheduledSequenceNames = set([seq.label_() for seq in scheduledSequences]) 00728 #sequenceNames = set(self.sequences_().keys()) 00729 #junk = sequenceNames - scheduledSequenceNames 00730 #for name in junk: 00731 # delattr(self, name)
def Config::Process::psets_ | ( | self | ) |
def Config::Process::schedule_ | ( | self | ) |
def Config::Process::sequences_ | ( | self | ) |
def Config::Process::services_ | ( | self | ) |
def Config::Process::setLooper_ | ( | self, | |
lpr | |||
) |
def Config::Process::setName_ | ( | self, | |
name | |||
) |
def Config::Process::setPartialSchedule_ | ( | self, | |
sch, | |||
label | |||
) |
def Config::Process::setSchedule_ | ( | self, | |
sch | |||
) |
Definition at line 217 of file Config.py.
00218 : 00219 # See if every module has been inserted into the process 00220 index = 0 00221 try: 00222 for p in sch: 00223 p.label_() 00224 index +=1 00225 except: 00226 raise RuntimeError("The path at index "+str(index)+" in the Schedule was not attached to the process.") 00227 self.__dict__['_Process__schedule'] = sch
def Config::Process::setSource_ | ( | self, | |
src | |||
) |
def Config::Process::setStrict | ( | self, | |
value | |||
) |
def Config::Process::setSubProcess_ | ( | self, | |
lpr | |||
) |
def Config::Process::source_ | ( | self | ) |
def Config::Process::subProcess_ | ( | self | ) |
def Config::Process::validate | ( | self | ) |
def Config::Process::vpsets_ | ( | self | ) |
Config::Process::__isStrict [private] |
Config::Process::__processPSet [private] |
Config::Process::__thelist [private] |
Config::Process::analyzers = property(analyzers_,doc="dictionary containing the analyzers for the process") [static] |
Config::Process::endpaths = property(endpaths_,doc="dictionary containing the endpaths for the process") [static] |
Config::Process::es_prefers = property(es_prefers_,doc="dictionary containing the es_prefers for the process") [static] |
Config::Process::es_producers = property(es_producers_,doc="dictionary containing the es_producers for the process") [static] |
Config::Process::es_sources = property(es_sources_,doc="dictionary containing the es_sources for the process") [static] |
Config::Process::filters = property(filters_, doc="dictionary containing the filters for the process") [static] |
Config::Process::looper = property(looper_,setLooper_,doc='the main looper or None if not set') [static] |
Config::Process::outputModules = property(outputModules_,doc="dictionary containing the output_modules for the process") [static] |
Config::Process::paths = property(paths_,doc="dictionary containing the paths for the process") [static] |
Config::Process::process = property(name_,setName_, doc="name of the process") [static] |
Config::Process::producers = property(producers_,doc="dictionary containing the producers for the process") [static] |
Config::Process::psets = property(psets_,doc="dictionary containing the PSets for the process") [static] |
Config::Process::schedule = property(schedule_,setSchedule_,doc='the schedule or None if not set') [static] |
Config::Process::sequences = property(sequences_,doc="dictionary containing the sequences for the process") [static] |
Config::Process::services = property(services_,doc="dictionary containing the services for the process") [static] |
Config::Process::source = property(source_,setSource_,doc='the main source or None if not set') [static] |
Config::Process::subProcess = property(subProcess_,setSubProcess_,doc='the SubProcess or None if not set') [static] |