4 from Options
import Options
10 from Mixins
import PrintOptions,_ParameterTypeBase,_SimpleParameterTypeBase, _Parameterizable, _ConfigureComponent, _TypedParameterizable, _Labelable, _Unlabelable, _ValidatingListBase, _modifyParametersFromDict
14 from Modules
import _Module
15 from SequenceTypes
import *
16 from SequenceTypes
import _ModuleSequenceType, _Sequenceable
17 from SequenceVisitors
import PathValidator, EndPathValidator, ScheduleTaskValidator, NodeVisitor, CompositeVisitor
20 from ExceptionHandling
import *
23 if sys.getrecursionlimit()<5000:
24 sys.setrecursionlimit(5000)
28 Raise an exception if called by special config files. This checks 29 the call or import stack for the importing file. An exception is raised if 30 the importing module is not in allowedPatterns and if it is called too deeply: 31 minLevel = 2: inclusion by top lvel cfg only 32 minLevel = 1: No inclusion allowed 33 allowedPatterns = ['Module1','Module2/SubModule1'] allows import 34 by any module in Module1 or Submodule1 40 ignorePatterns = [
'FWCore/ParameterSet/Config.py',
'<string>']
41 CMSSWPath = [os.environ[
'CMSSW_BASE'],os.environ[
'CMSSW_RELEASE_BASE']]
45 for item
in inspect.stack():
49 for pattern
in CMSSWPath:
50 if item[1].
find(pattern) != -1:
53 if item[1].
find(
'/') == -1:
56 for pattern
in ignorePatterns:
57 if item[1].
find(pattern) != -1:
61 if inPath
and not ignore:
62 trueStack.append(item[1])
64 importedFile = trueStack[0]
66 if len(trueStack) > 1:
67 importedBy = trueStack[1]
69 for pattern
in allowedPatterns:
70 if importedBy.find(pattern) > -1:
73 if len(trueStack) <= minLevel:
76 raise ImportError(
"Inclusion of %s is allowed only by cfg or specified cfi files." 80 """Look inside the module and find the Processes it contains""" 84 if isinstance(module,dict):
85 if 'process' in module:
89 if hasattr(module,
'process'):
90 if isinstance(module.process,Process):
91 process = module.process
93 raise RuntimeError(
"The attribute named 'process' does not inherit from the Process class")
95 raise RuntimeError(
"no 'process' attribute found in the module, please add one")
99 """Root class for a CMS configuration process""" 101 """The argument 'name' will be the name applied to this Process 102 Can optionally pass as additional arguments cms.Modifier instances 103 that will be used to modify the Process as it is built 105 self.__dict__[
'_Process__name'] = name
106 if not name.isalnum():
107 raise RuntimeError(
"Error: The process name is an empty string or contains non-alphanumeric characters")
108 self.__dict__[
'_Process__filters'] = {}
109 self.__dict__[
'_Process__producers'] = {}
110 self.__dict__[
'_Process__source'] =
None 111 self.__dict__[
'_Process__looper'] =
None 112 self.__dict__[
'_Process__subProcesses'] = []
113 self.__dict__[
'_Process__schedule'] =
None 114 self.__dict__[
'_Process__analyzers'] = {}
115 self.__dict__[
'_Process__outputmodules'] = {}
118 self.__dict__[
'_Process__sequences'] = {}
119 self.__dict__[
'_Process__tasks'] = {}
120 self.__dict__[
'_Process__services'] = {}
121 self.__dict__[
'_Process__essources'] = {}
122 self.__dict__[
'_Process__esproducers'] = {}
123 self.__dict__[
'_Process__esprefers'] = {}
124 self.__dict__[
'_Process__aliases'] = {}
125 self.__dict__[
'_Process__psets']={}
126 self.__dict__[
'_Process__vpsets']={}
127 self.__dict__[
'_cloneToObjectDict'] = {}
129 self.__dict__[
'_Process__InExtendCall'] =
False 130 self.__dict__[
'_Process__partialschedules'] = {}
132 self.__dict__[
'_Process__modifiers'] = Mods
133 for m
in self.__modifiers:
138 _Module.__isStrict__ =
True 142 """Returns a string containing all the EDProducer labels separated by a blank""" 145 """Returns a string containing all the EDAnalyzer labels separated by a blank""" 148 """Returns a string containing all the EDFilter labels separated by a blank""" 151 """Returns a string containing all the Path names separated by a blank""" 158 Since cloneToObjectDict stores a hash of objects by their 159 id() it needs to be updated when unpickling to use the 160 new object id values instantiated during the unpickle. 163 self.__dict__.update(pkldict)
165 for value
in self._cloneToObjectDict.values():
166 tmpDict[
id(value)] = value
167 self.__dict__[
'_cloneToObjectDict'] = tmpDict
172 """returns a dict of the filters that have been added to the Process""" 174 filters = property(filters_, doc=
"dictionary containing the filters for the process")
178 if not name.isalnum():
179 raise RuntimeError(
"Error: The process name is an empty string or contains non-alphanumeric characters")
180 self.__dict__[
'_Process__name'] = name
181 process = property(name_,setName_, doc=
"name of the process")
183 """returns a dict of the producers that have been added to the Process""" 185 producers = property(producers_,doc=
"dictionary containing the producers for the process")
187 """returns the source that has been added to the Process or None if none have been added""" 191 source = property(source_,setSource_,doc=
'the main source or None if not set')
193 """returns the looper that has been added to the Process or None if none have been added""" 197 looper = property(looper_,setLooper_,doc=
'the main looper or None if not set')
199 """returns a list of the subProcesses that have been added to the Process""" 200 return self.__subProcesses
201 subProcesses = property(subProcesses_,doc=
'the SubProcesses that have been added to the Process')
203 """returns a dict of the analyzers that have been added to the Process""" 205 analyzers = property(analyzers_,doc=
"dictionary containing the analyzers for the process")
207 """returns a dict of the output modules that have been added to the Process""" 209 outputModules = property(outputModules_,doc=
"dictionary containing the output_modules for the process")
211 """returns a dict of the paths that have been added to the Process""" 213 paths = property(paths_,doc=
"dictionary containing the paths for the process")
215 """returns a dict of the endpaths that have been added to the Process""" 217 endpaths = property(endpaths_,doc=
"dictionary containing the endpaths for the process")
219 """returns a dict of the sequences that have been added to the Process""" 221 sequences = property(sequences_,doc=
"dictionary containing the sequences for the process")
223 """returns a dict of the tasks that have been added to the Process""" 225 tasks = property(tasks_,doc=
"dictionary containing the tasks for the process")
227 """returns the schedule that has been added to the Process or None if none have been added""" 228 return self.__schedule
230 if label ==
"schedule":
233 self.
_place(label, sch, self.__partialschedules)
242 raise RuntimeError(
"The path at index "+
str(index)+
" in the Schedule was not attached to the process.")
243 self.__dict__[
'_Process__schedule'] = sch
244 schedule = property(schedule_,setSchedule_,doc=
'the schedule or None if not set')
246 """returns a dict of the services that have been added to the Process""" 248 services = property(services_,doc=
"dictionary containing the services for the process")
250 """returns a dict of the esproducers that have been added to the Process""" 252 es_producers = property(es_producers_,doc=
"dictionary containing the es_producers for the process")
254 """returns a the es_sources that have been added to the Process""" 256 es_sources = property(es_sources_,doc=
"dictionary containing the es_sources for the process")
258 """returns a dict of the es_prefers that have been added to the Process""" 260 es_prefers = property(es_prefers_,doc=
"dictionary containing the es_prefers for the process")
262 """returns a dict of the aliases that have been added to the Process""" 264 aliases = property(aliases_,doc=
"dictionary containing the aliases for the process")
266 """returns a dict of the PSets that have been added to the Process""" 268 psets = property(psets_,doc=
"dictionary containing the PSets for the process")
270 """returns a dict of the VPSets that have been added to the Process""" 272 vpsets = property(vpsets_,doc=
"dictionary containing the PSets for the process")
275 """returns True if the Modifier is in used by this Process""" 277 for m
in self.__modifiers:
278 if m._isOrContains(mod):
283 if not object.hasLabel_() :
284 object.setLabel(newLabel)
286 if newLabel == object.label_() :
288 if newLabel
is None :
289 object.setLabel(
None)
291 if (hasattr(self, object.label_())
and id(getattr(self, object.label_())) ==
id(object)) :
292 msg100 =
"Attempting to change the label of an attribute of the Process\n" 293 msg101 =
"Old label = "+object.label_()+
" New label = "+newLabel+
"\n" 294 msg102 =
"Type = "+
str(type(object))+
"\n" 295 msg103 =
"Some possible solutions:\n" 296 msg104 =
" 1. Clone modules instead of using simple assignment. Cloning is\n" 297 msg105 =
" also preferred for other types when possible.\n" 298 msg106 =
" 2. Declare new names starting with an underscore if they are\n" 299 msg107 =
" for temporaries you do not want propagated into the Process. The\n" 300 msg108 =
" underscore tells \"from x import *\" and process.load not to import\n" 301 msg109 =
" the name.\n" 302 msg110 =
" 3. Reorganize so the assigment is not necessary. Giving a second\n" 303 msg111 =
" name to the same object usually causes confusion and problems.\n" 304 msg112 =
" 4. Compose Sequences: newName = cms.Sequence(oldName)\n" 305 raise ValueError(msg100+msg101+msg102+msg103+msg104+msg105+msg106+msg107+msg108+msg109+msg110+msg111+msg112)
306 object.setLabel(
None)
307 object.setLabel(newLabel)
311 if not name.replace(
'_',
'').isalnum():
312 raise ValueError(
'The label '+name+
' contains forbiden characters')
315 if name.startswith(
'_Process__'):
316 self.__dict__[name]=value
318 if not isinstance(value,_ConfigureComponent):
319 raise TypeError(
"can only assign labels to an object that inherits from '_ConfigureComponent'\n" 320 +
"an instance of "+
str(type(value))+
" will not work - requested label is "+name)
321 if not isinstance(value,_Labelable)
and not isinstance(value,Source)
and not isinstance(value,Looper)
and not isinstance(value,Schedule):
322 if name == value.type_():
327 raise TypeError(
"an instance of "+
str(type(value))+
" can not be assigned the label '"+name+
"'.\n"+
328 "Please either use the label '"+value.type_()+
" or use the 'add_' method instead.")
331 newValue =value.copy()
333 newValue._filename = value._filename
339 if not self.
_okToPlace(name, value, self.__dict__):
340 newFile=
'top level config' 341 if hasattr(value,
'_filename'):
342 newFile = value._filename
343 oldFile=
'top level config' 344 oldValue = getattr(self,name)
345 if hasattr(oldValue,
'_filename'):
346 oldFile = oldValue._filename
347 msg =
"Trying to override definition of process."+name
348 msg +=
"\n new object defined in: "+newFile
349 msg +=
"\n existing object defined in: "+oldFile
350 raise ValueError(msg)
352 if hasattr(self,name)
and not (getattr(self,name)==newValue):
356 if newValue._isTaskComponent():
357 if not self.__InExtendCall:
361 if not isinstance(newValue, Task):
363 newFile=
'top level config' 364 if hasattr(value,
'_filename'):
365 newFile = value._filename
366 oldFile=
'top level config' 367 oldValue = getattr(self,name)
368 if hasattr(oldValue,
'_filename'):
369 oldFile = oldValue._filename
370 msg1 =
"Trying to override definition of "+name+
" while it is used by the task " 371 msg2 =
"\n new object defined in: "+newFile
372 msg2 +=
"\n existing object defined in: "+oldFile
375 raise ValueError(msg1+s.label_()+msg2)
377 if isinstance(newValue, _Sequenceable)
or newValue._isTaskComponent():
378 if not self.__InExtendCall:
382 newFile=
'top level config' 383 if hasattr(value,
'_filename'):
384 newFile = value._filename
385 oldFile=
'top level config' 386 oldValue = getattr(self,name)
387 if hasattr(oldValue,
'_filename'):
388 oldFile = oldValue._filename
389 msg1 =
"Trying to override definition of "+name+
" while it is used by the " 390 msg2 =
"\n new object defined in: "+newFile
391 msg2 +=
"\n existing object defined in: "+oldFile
394 raise ValueError(msg1+
"sequence "+s.label_()+msg2)
397 raise ValueError(msg1+
"path "+s.label_()+msg2)
400 raise ValueError(msg1+
"endpath "+s.label_()+msg2)
402 self.__dict__[name]=newValue
403 if isinstance(newValue,_Labelable):
405 self._cloneToObjectDict[
id(value)] = newValue
406 self._cloneToObjectDict[
id(newValue)] = newValue
408 newValue._place(name,self)
410 """Given a container of sequences or tasks, find the first sequence or task 411 containing mod and return it. If none is found, return None""" 414 for seqOrTask
in seqsOrTasks.itervalues():
423 if not hasattr(self,name):
424 raise KeyError(
'process does not know about '+name)
425 elif name.startswith(
'_Process__'):
426 raise ValueError(
'this attribute cannot be deleted')
431 if name
in reg: del reg[name]
433 obj = getattr(self,name)
434 if isinstance(obj,_Labelable):
436 if isinstance(obj,Service):
437 obj._inProcess =
False 441 obj = getattr(self,name)
443 if not isinstance(obj, Sequence)
and not isinstance(obj, Task):
453 if obj._isTaskComponent():
456 if isinstance(obj, _Sequenceable)
or obj._isTaskComponent():
460 del self.__dict__[name]
465 """Similar to __delattr__ but we need different behavior when called from __setattr__""" 469 del self.__dict__[name]
474 """Allows addition of components that do not have to have a label, e.g. Services""" 475 if not isinstance(value,_ConfigureComponent):
477 if not isinstance(value,_Unlabelable):
482 newValue =value.copy()
486 newValue._place(
'',self)
489 if not self.__InExtendCall:
500 if d[name]._isModified:
511 if self.
__isStrict and isinstance(mod, _ModuleSequenceType):
512 d[name] = mod._postProcessFixup(self._cloneToObjectDict)
515 if isinstance(mod,_Labelable):
518 self.
_place(name, mod, self.__outputmodules)
520 self.
_place(name, mod, self.__producers)
522 self.
_place(name, mod, self.__filters)
524 self.
_place(name, mod, self.__analyzers)
528 self.
_place(name, mod, self.__paths)
529 except ModuleCloneError
as msg:
531 raise Exception(
"%sThe module %s in path %s is unknown to the process %s." %(context, msg, name, self._Process__name))
535 self.
_place(name, mod, self.__endpaths)
536 except ModuleCloneError
as msg:
538 raise Exception(
"%sThe module %s in endpath %s is unknown to the process %s." %(context, msg, name, self._Process__name))
541 self.
_place(name, mod, self.__sequences)
543 self.
_place(name, mod, self.__esproducers)
545 self.
_place(name, mod, self.__esprefers)
547 self.
_place(name, mod, self.__essources)
550 self.
_place(name, task, self.__tasks)
552 self.
_place(name, mod, self.__aliases)
554 self.
_place(name, mod, self.__psets)
556 self.
_place(name, mod, self.__vpsets)
558 """Allow the source to be referenced by 'source' or by type name""" 560 raise ValueError(
"The label '"+name+
"' can not be used for a Source. Only 'source' is allowed.")
561 if self.__dict__[
'_Process__source']
is not None :
562 del self.__dict__[self.__dict__[
'_Process__source'].type_()]
563 self.__dict__[
'_Process__source'] = mod
564 self.__dict__[mod.type_()] = mod
567 raise ValueError(
"The label '"+name+
"' can not be used for a Looper. Only 'looper' is allowed.")
568 self.__dict__[
'_Process__looper'] = mod
569 self.__dict__[mod.type_()] = mod
571 self.__dict__[
'_Process__subProcess'] = mod
572 self.__dict__[mod.type_()] = mod
574 self.__subProcesses.append(mod)
576 self.
_place(typeName, mod, self.__services)
577 if typeName
in self.__dict__:
578 self.__dict__[typeName]._inProcess =
False 579 self.__dict__[typeName]=mod
581 moduleName = moduleName.replace(
"/",
".")
582 module = __import__(moduleName)
583 self.
extend(sys.modules[moduleName])
585 """Look in other and find types that we can use""" 587 self.__dict__[
'_Process__InExtendCall'] =
True 590 tasksToAttach =
dict()
592 for name
in dir(other):
594 if name.startswith(
'_'):
596 item = getattr(other,name)
597 if name ==
"source" or name ==
"looper":
601 elif isinstance(item,_ModuleSequenceType):
603 elif isinstance(item,Task):
604 tasksToAttach[name] = item
605 elif isinstance(item,_Labelable):
607 if not item.hasLabel_() :
609 elif isinstance(item,Schedule):
611 elif isinstance(item,_Unlabelable):
613 elif isinstance(item,ProcessModifier):
615 elif isinstance(item,ProcessFragment):
619 for name
in seqs.iterkeys():
623 if id(seq)
not in self._cloneToObjectDict:
626 newSeq = self._cloneToObjectDict[
id(seq)]
627 self.__dict__[name]=newSeq
630 newSeq._place(name,self)
632 for name
in tasksToAttach.iterkeys():
633 task = tasksToAttach[name]
640 self.__dict__[
'_Process__InExtendCall'] =
False 644 for name,item
in items:
645 returnValue +=options.indentation()+typeName+
' '+name+
' = '+item.dumpConfig(options)
649 for name,item
in items:
650 returnValue +=options.indentation()+typeName+
' = '+item.dumpConfig(options)
654 for name,item
in items:
655 if name == item.type_():
657 returnValue +=options.indentation()+typeName+
' '+name+
' = '+item.dumpConfig(options)
660 """return a string containing the equivalent process defined using the old configuration language""" 661 config =
"process "+self.__name+
" = {\n" 707 for name,item
in self.psets.iteritems():
708 config +=options.indentation()+item.configTypeName()+
' '+name+
' = '+item.configValue(options)
709 for name,item
in self.vpsets.iteritems():
710 config +=options.indentation()+
'VPSet '+name+
' = '+item.configValue(options)
712 pathNames = [p.label_()
for p
in self.
schedule]
713 config +=options.indentation()+
'schedule = {'+
','.
join(pathNames)+
'}\n' 724 result +=options.indentation()+
'es_prefer '+item.targetLabel_()+
' = '+item.dumpConfig(options)
729 returnValue += item.dumpPython(options)+
'\n\n' 734 for name,item
in d.items():
735 returnValue +=
'process.'+name+
' = '+item.dumpPython(options)+
'\n\n' 737 for name,item
in sorted(d.items()):
738 returnValue +=
'process.'+name+
' = '+item.dumpPython(options)+
'\n\n' 745 sequence.visit(visitor)
747 raise RuntimeError(
"An entry in sequence "+label +
' has no label')
755 raise RuntimeError(
"An entry in task " + label +
' has not been attached to the process')
766 for label,item
in processDictionaryOfItems.iteritems():
768 if isinstance(item, Task):
775 if isinstance(item, Task):
776 raise RuntimeError(
"Failed in a Task visitor. Probably " \
777 "a circular dependency discovered in Task with label " + label)
779 raise RuntimeError(
"Failed in a Sequence visitor. Probably a " \
780 "circular dependency discovered in Sequence with label " + label)
781 for containedItem
in containedItems:
787 if containedItem.hasLabel_():
788 testItem = processDictionaryOfItems.get(containedItem.label_())
789 if testItem
is None or containedItem != testItem:
790 if isinstance(item, Task):
791 raise RuntimeError(
"Task has a label, but using its label to get an attribute" \
792 " from the process yields a different object or None\n"+
793 "label = " + containedItem.label_())
795 raise RuntimeError(
"Sequence has a label, but using its label to get an attribute" \
796 " from the process yields a different object or None\n"+
797 "label = " + containedItem.label_())
798 dependencies[label]=[dep.label_()
for dep
in containedItems
if dep.hasLabel_()]
802 oldDeps =
dict(dependencies)
803 for label,deps
in oldDeps.iteritems():
805 returnValue[label]=processDictionaryOfItems[label]
807 del dependencies[label]
808 for lb2,deps2
in dependencies.iteritems():
809 while deps2.count(label):
814 for name, value
in sorted(d.iteritems()):
815 result += value.dumpPythonAs(name,options)+
'\n' 818 """return a string containing the equivalent process defined using python""" 819 result =
"import FWCore.ParameterSet.Config as cms\n\n" 820 result +=
"process = cms.Process(\""+self.__name+
"\")\n\n" 842 result +=
'process.schedule = ' + self.schedule.dumpPython(options)
845 old = getattr(self,label)
847 for sequenceable
in self.sequences.itervalues():
848 sequenceable.replace(old,new)
849 for sequenceable
in self.paths.itervalues():
850 sequenceable.replace(old,new)
851 for sequenceable
in self.endpaths.itervalues():
852 sequenceable.replace(old,new)
854 old = getattr(self,label)
855 for task
in self.tasks.itervalues():
856 task.replace(old, new)
860 old = getattr(self,label)
862 task.replace(old, new)
864 """ Replace the item with label 'label' by object 'new' in the process and all sequences/paths/tasks""" 865 if not hasattr(self,label):
866 raise LookupError(
"process has no item of label "+label)
867 setattr(self,label,new)
869 for name,value
in itemDict.iteritems():
870 value.insertInto(parameterSet, name)
874 newlabel = item.nameInProcessDesc_(label)
876 item.insertInto(parameterSet, newlabel)
877 parameterSet.addVString(tracked, label, vitems)
880 for name,value
in itemDict.iteritems():
881 newLabel = value.nameInProcessDesc_(name)
883 value.insertInto(parameterSet, name)
886 parameterSet.addVString(tracked, label, l)
890 for value
in itemList:
891 name = value.getProcessName()
892 newLabel = value.nameInProcessDesc_(name)
894 pset = value.getSubProcessPSet(parameterSet)
895 subprocs.append(pset)
898 parameterSet.addVString(tracked, label, l)
899 parameterSet.addVPSet(
False,
"subProcesses",subprocs)
906 for name
in self.
paths_():
907 scheduledPaths.append(name)
908 triggerPaths.append(name)
910 scheduledPaths.append(name)
911 endpaths.append(name)
914 pathname = path.label_()
915 scheduledPaths.append(pathname)
917 endpaths.append(pathname)
919 triggerPaths.append(pathname)
922 task.visit(scheduleTaskValidator)
923 task.visit(nodeVisitor)
924 processPSet.addVString(
True,
"@end_paths", endpaths)
925 processPSet.addVString(
True,
"@paths", scheduledPaths)
927 p = processPSet.newPSet()
928 p.addVString(
True,
"@trigger_paths", triggerPaths)
929 processPSet.addPSet(
True,
"@trigger_paths", p)
936 endpathCompositeVisitor =
CompositeVisitor(endpathValidator, nodeVisitor, lister)
937 for triggername
in triggerPaths:
938 iPath = self.
paths_()[triggername]
939 iPath.resolve(self.__dict__)
940 pathValidator.setLabel(triggername)
942 iPath.visit(pathCompositeVisitor)
943 iPath.insertInto(processPSet, triggername, decoratedList)
944 for endpathname
in endpaths:
946 iEndPath.resolve(self.__dict__)
947 endpathValidator.setLabel(endpathname)
949 iEndPath.visit(endpathCompositeVisitor)
950 iEndPath.insertInto(processPSet, endpathname, decoratedList)
951 processPSet.addVString(
False,
"@filters_on_endpaths", endpathValidator.filtersOnEndpaths)
953 def resolve(self,keepUnresolvedSequencePlaceholders=False):
954 for x
in self.paths.itervalues():
955 x.resolve(self.__dict__,keepUnresolvedSequencePlaceholders)
956 for x
in self.endpaths.itervalues():
957 x.resolve(self.__dict__,keepUnresolvedSequencePlaceholders)
959 def prune(self,verbose=False,keepUnresolvedSequencePlaceholders=False):
960 """ Remove clutter from the process that we think is unnecessary: 961 tracked PSets, VPSets and unused modules and sequences. If a Schedule has been set, then Paths and EndPaths 962 not in the schedule will also be removed, along with an modules and sequences used only by 963 those removed Paths and EndPaths.""" 972 self.
resolve(keepUnresolvedSequencePlaceholders)
974 unneededPaths = set()
976 usedModules=set(self.
schedule_().moduleNames())
978 schedNames = set(( x.label_()
for x
in self.
schedule_()))
979 names = set(self.
paths)
981 unneededPaths = names - schedNames
982 for n
in unneededPaths:
985 pths =
list(self.paths.itervalues())
986 pths.extend(self.endpaths.itervalues())
988 usedModules=set(temp.moduleNames())
995 for p
in self.paths.itervalues():
997 for p
in self.endpaths.itervalues():
999 keepSeqSet = set(( s
for s
in seqs
if s.hasLabel_()))
1000 availableSeqs = set(self.sequences.itervalues())
1001 unneededSeqs = availableSeqs-keepSeqSet
1002 unneededSeqLabels = []
1003 for s
in unneededSeqs:
1004 unneededSeqLabels.append(s.label_())
1005 delattr(self,s.label_())
1007 print "prune removed the following:" 1008 print " modules:"+
",".
join(unneededModules)
1009 print " sequences:"+
",".
join(unneededSeqLabels)
1010 print " paths/endpaths:"+
",".
join(unneededPaths)
1012 moduleNames = set(d.keys())
1013 junk = moduleNames - scheduledNames
1019 """Used by the framework to convert python to C++ objects""" 1020 class ServiceInjectorAdaptor(
object):
1024 def addService(self,pset):
1025 self.__thelist.append(pset)
1027 return self.__processPSet.newPSet()
1031 class TopLevelPSetAcessorAdaptor(
object):
1035 def __getattr__(self,attr):
1036 return getattr(self.
__ppset,attr)
1037 def getTopPSet_(self,label):
1040 return TopLevelPSetAcessorAdaptor(self.__ppset.newPSet(),self.
__process)
1041 def addPSet(self,tracked,name,ppset):
1042 return self.__ppset.addPSet(tracked,name,self.__extractPSet(ppset))
1043 def addVPSet(self,tracked,name,vpset):
1044 return self.__ppset.addVPSet(tracked,name,[self.__extractPSet(x)
for x
in vpset])
1045 def __extractPSet(self,pset):
1046 if isinstance(pset,TopLevelPSetAcessorAdaptor):
1051 processPSet.addString(
True,
"@process_name", self.
name_())
1053 all_modules.update(self.
filters_())
1056 adaptor = TopLevelPSetAcessorAdaptor(processPSet,self)
1069 all_modules_onTasksOrScheduled = { key:value
for key, value
in all_modules.iteritems()
if value
in nodeVisitor.modules }
1070 self.
_insertManyInto(adaptor,
"@all_modules", all_modules_onTasksOrScheduled,
True)
1074 for pTask
in self.tasks.itervalues():
1075 pTask.visit(processNodeVisitor)
1076 esProducersToEnable = {}
1077 for esProducerName, esProducer
in self.
es_producers_().iteritems():
1078 if esProducer
in nodeVisitor.esProducers
or not (esProducer
in processNodeVisitor.esProducers):
1079 esProducersToEnable[esProducerName] = esProducer
1080 self.
_insertManyInto(adaptor,
"@all_esmodules", esProducersToEnable,
True)
1081 esSourcesToEnable = {}
1082 for esSourceName, esSource
in self.
es_sources_().iteritems():
1083 if esSource
in nodeVisitor.esSources
or not (esSource
in processNodeVisitor.esSources):
1084 esSourcesToEnable[esSourceName] = esSource
1085 self.
_insertManyInto(adaptor,
"@all_essources", esSourcesToEnable,
True)
1088 for serviceName, serviceObject
in self.
services_().iteritems():
1089 if serviceObject
in nodeVisitor.services
or not (serviceObject
in processNodeVisitor.services):
1090 serviceObject.insertInto(ServiceInjectorAdaptor(adaptor,services))
1091 adaptor.addVPSet(
False,
"services",services)
1102 """Prefer this ES source or producer. The argument can 1103 either be an object label, e.g., 1104 process.prefer(process.juicerProducer) (not supported yet) 1105 or a name of an ESSource or ESProducer 1106 process.prefer("juicer") 1107 or a type of unnamed ESSource or ESProducer 1108 process.prefer("JuicerProducer") 1109 In addition, you can pass as a labelled arguments the name of the Record you wish to 1110 prefer where the type passed is a cms.vstring and that vstring can contain the 1111 name of the C++ types in the Record that are being preferred, e.g., 1112 #prefer all data in record 'OrangeRecord' from 'juicer' 1113 process.prefer("juicer", OrangeRecord=cms.vstring()) 1115 #prefer only "Orange" data in "OrangeRecord" from "juicer" 1116 process.prefer("juicer", OrangeRecord=cms.vstring("Orange")) 1118 #prefer only "Orange" data with label "ExtraPulp" in "OrangeRecord" from "juicer" 1119 ESPrefer("ESJuicerProd", OrangeRecord=cms.vstring("Orange/ExtraPulp")) 1122 if isinstance(esmodule, ESSource)
or isinstance(esmodule, ESProducer):
1123 raise RuntimeError(
"Syntax of process.prefer(process.esmodule) not supported yet")
1124 elif self._findPreferred(esmodule, self.es_producers_(),*args,**kargs)
or \
1125 self._findPreferred(esmodule, self.es_sources_(),*args,**kargs):
1128 raise RuntimeError(
"Cannot resolve prefer for "+repr(esmodule))
1133 typ = d[esname].type_()
1142 for name, value
in d.iteritems():
1143 if value.type_() == esname:
1145 raise RuntimeError(
"More than one ES module for "+esname)
1153 if isinstance(process, Process):
1155 elif isinstance(process, str):
1158 raise TypeError(
'a ProcessFragment can only be constructed from an existig Process or from process name')
1160 return [ x
for x
in dir(self.
__process)
if isinstance(getattr(self.
__process, x), _ConfigureComponent) ]
1162 if name ==
'_ProcessFragment__process':
1163 return object.__getattribute__(self,
'_ProcessFragment__process')
1167 if name ==
'_ProcessFragment__process':
1168 object.__setattr__(self, name, value)
1172 if name ==
'_ProcessFragment__process':
1179 """a dictionary with fixed keys""" 1181 raise AttributeError(
"An FilteredStream defintion cannot be modified after creation.")
1182 _blocked_attribute = property(_blocked_attribute)
1183 __setattr__ = __delitem__ = __setitem__ = clear = _blocked_attribute
1184 pop = popitem = setdefault = update = _blocked_attribute
1186 new = dict.__new__(cls)
1187 dict.__init__(new, *args, **kw)
1190 if keys != [
'content',
'dataTier',
'name',
'paths',
'responsible',
'selectEvents']:
1191 raise ValueError(
"The needed parameters are: content, dataTier, name, paths, responsible, selectEvents")
1192 if not isinstance(kw[
'name'],str):
1193 raise ValueError(
"name must be of type string")
1194 if not isinstance(kw[
'content'], vstring)
and not isinstance(kw[
'content'],str):
1195 raise ValueError(
"content must be of type vstring or string")
1196 if not isinstance(kw[
'dataTier'], string):
1197 raise ValueError(
"dataTier must be of type string")
1198 if not isinstance(kw[
'selectEvents'], PSet):
1199 raise ValueError(
"selectEvents must be of type PSet")
1200 if not isinstance(kw[
'paths'],(tuple, Path)):
1201 raise ValueError(
"'paths' must be a tuple of paths")
1206 return "FilteredStream object: %s" %self[
"name"]
1211 """Allows embedding another process within a parent process. This allows one to 1212 chain processes together directly in one cmsRun job rather than having to run 1213 separate jobs that are connected via a temporary file. 1215 def __init__(self,process, SelectEvents = untracked.PSet(), outputCommands = untracked.vstring()):
1218 if not isinstance(process, Process):
1219 raise ValueError(
"the 'process' argument must be of type cms.Process")
1220 if not isinstance(SelectEvents,PSet):
1221 raise ValueError(
"the 'SelectEvents' argument must be of type cms.untracked.PSet")
1222 if not isinstance(outputCommands,vstring):
1223 raise ValueError(
"the 'outputCommands' argument must be of type cms.untracked.vstring")
1228 out =
"parentProcess"+
str(
hash(self))+
" = process\n" 1229 out += self.__process.dumpPython()
1230 out +=
"childProcess = process\n" 1231 out +=
"process = parentProcess"+
str(
hash(self))+
"\n" 1232 out +=
"process.addSubProcess(cms.SubProcess(process = childProcess, SelectEvents = "+self.__SelectEvents.dumpPython(options) +
", outputCommands = "+self.__outputCommands.dumpPython(options) +
"))" 1235 return self.__process.name_()
1247 process._placeSubProcess(
'subProcess',self)
1249 topPSet = parameterSet.newPSet()
1250 self.__process.fillProcessDesc(topPSet)
1251 subProcessPSet = parameterSet.newPSet()
1252 self.__SelectEvents.insertInto(subProcessPSet,
"SelectEvents")
1253 self.__outputCommands.insertInto(subProcessPSet,
"outputCommands")
1254 subProcessPSet.addPSet(
False,
"process",topPSet)
1255 return subProcessPSet
1258 """Helper class for Modifier that takes key/value pairs and uses them to reset parameters of the object""" 1263 for k
in self.__args.iterkeys():
1265 params[k] = getattr(obj,k)
1267 for k
in self.__args.iterkeys():
1269 setattr(obj,k,params[k])
1275 raise KeyError(
"Unknown parameter name "+key+
" specified while calling Modifier")
1278 """A modifier which only applies if multiple Modifiers are chosen""" 1283 return self.__lhs.isChosen()
and self.__rhs.isChosen()
1287 self.__lhs.toModify(obj,func, **kw)
1289 """This is used to create a ProcessModifer that can perform actions on the process as a whole. 1290 This takes as argument a callable object (e.g. function) that takes as its sole argument an instance of Process. 1291 In order to work, the value returned from this function must be assigned to a uniquely named variable.""" 1299 """This class is used to define standard modifications to a Process. 1300 An instance of this class is declared to denote a specific modification,e.g. era2017 could 1301 reconfigure items in a process to match our expectation of running in 2017. Once declared, 1302 these Modifier instances are imported into a configuration and items that need to be modified 1303 are then associated with the Modifier and with the action to do the modification. 1304 The registered modifications will only occur if the Modifier was passed to 1305 the cms.Process' constructor. 1311 """This is used to create a ProcessModifer that can perform actions on the process as a whole. 1312 This takes as argument a callable object (e.g. function) that takes as its sole argument an instance of Process. 1313 In order to work, the value returned from this function must be assigned to a uniquely named variable. 1317 """This is used to register an action to be performed on the specific object. Two different forms are allowed 1318 Form 1: A callable object (e.g. function) can be passed as the second. This callable object is expected to take one argument 1319 that will be the object passed in as the first argument. 1320 Form 2: A list of parameter name, value pairs can be passed 1321 mod.toModify(foo, fred=cms.int32(7), barney = cms.double(3.14)) 1322 This form can also be used to remove a parameter by passing the value of None 1323 #remove the parameter foo.fred 1324 mod.toModify(foo, fred = None) 1325 Additionally, parameters embedded within PSets can also be modified using a dictionary 1326 #change foo.fred.pebbles to 3 and foo.fred.friend to "barney" 1327 mod.toModify(foo, fred = dict(pebbles = 3, friend = "barney)) ) 1329 if func
is not None and len(kw) != 0:
1330 raise TypeError(
"toModify takes either two arguments or one argument and key/value pairs")
1333 if func
is not None:
1339 """If the Modifier is chosen the internals of toObj will be associated with the internals of fromObj 1341 if type(fromObj) != type(toObj):
1342 raise TypeError(
"toReplaceWith requires both arguments to be the same class type")
1345 if isinstance(fromObj,_ModuleSequenceType):
1346 toObj._seq = fromObj._seq
1347 toObj._tasks = fromObj._tasks
1348 elif isinstance(fromObj,Task):
1349 toObj._collection = fromObj._collection
1350 elif isinstance(fromObj,_Parameterizable):
1352 for p
in toObj.parameterNames_():
1354 for p
in fromObj.parameterNames_():
1355 setattr(toObj,p,getattr(fromObj,p))
1356 if isinstance(fromObj,_TypedParameterizable):
1357 toObj._TypedParameterizable__type = fromObj._TypedParameterizable__type
1360 raise TypeError(
"toReplaceWith does not work with type "+
str(type(toObj)))
1363 """Should only be called by cms.Process instances""" 1370 return self == other
1374 """A Modifier made up of a list of Modifiers 1380 """Should only be called by cms.Process instances 1381 applies list of accumulated changes to the process""" 1383 m._applyNewProcessModifiers(process)
1385 """Should only be called by cms.Process instances""" 1392 """Creates a new ModifierChain which is a copy of 1393 this ModifierChain but excludes any Modifier or 1394 ModifierChain in the list toExclude. 1395 The exclusion is done recursively down the chain. 1399 if m
not in toExclude:
1401 if isinstance(m,ModifierChain):
1402 s = m.__copyIfExclude(toExclude)
1418 if m._isOrContains(other):
1423 """A class used by a Modifier to affect an entire Process instance. 1424 When a Process 'loads' a module containing a ProcessModifier, that 1425 ProcessModifier will be applied to the Process if and only if the 1426 Modifier passed to the constructor has been chosen. 1433 if self.__modifier.isChosen():
1436 self.__seenProcesses.add(process)
1438 if __name__==
"__main__":
1443 """Has same interface as the C++ object that creates PSets 1448 self.
values[label]=(tracked,value)
1506 """Nothing to do """ 1510 self.assertEqual(len(p.parameterNames_()),0)
1512 self.assert_(
'a' in p.parameterNames_())
1513 self.assertEqual(p.a.value(), 1)
1515 self.assertEqual(p.a.value(), 10)
1516 p.a = untracked(
int32(1))
1517 self.assertEqual(p.a.value(), 1)
1518 self.failIf(p.a.isTracked())
1519 p.a = untracked.int32(1)
1520 self.assertEqual(p.a.value(), 1)
1521 self.failIf(p.a.isTracked())
1523 self.assertEqual(p.foo.value(), 10)
1524 self.assertEqual(p.bar.value(),1.0)
1525 self.failIf(p.bar.isTracked())
1526 self.assertRaises(TypeError,setattr,(p,
'c',1))
1528 self.assertEqual(p.a.foo.value(),10)
1529 self.assertEqual(p.a.bar.value(),1.0)
1531 self.assertEqual(p.b.fii.value(),1)
1532 self.failIf(p.b.isTracked())
1537 self.assertEqual(p.a.value(),11)
1539 self.assertEqual(p.a.value(),12)
1540 self.assertEqual(v.value(),12)
1546 self.assertNotEqual(p.b,other.b)
1551 self.assert_(
'a' in p.analyzers_() )
1552 self.assert_(
'a' in p.analyzers)
1553 p.add_(
Service(
"MessageLogger"))
1554 self.assert_(
'MessageLogger' in p.services_())
1555 self.assertEqual(p.MessageLogger.type_(),
"MessageLogger")
1557 self.assert_(
'Tracer' in p.services_())
1558 self.assertRaises(TypeError, setattr, *(p,
'b',
"this should fail"))
1559 self.assertRaises(TypeError, setattr, *(p,
'bad',
Service(
"MessageLogger")))
1560 self.assertRaises(ValueError, setattr, *(p,
'bad',
Source(
"PoolSource")))
1562 self.assertEqual(p.out.type_(),
'Outer')
1563 self.assert_(
'out' in p.outputModules_() )
1566 self.assert_(
'geom' in p.es_sources_())
1568 self.assert_(
'ConfigDB' in p.es_sources_())
1571 self.assert_(
'aliasfoo1' in p.aliases_())
1575 def __init__(self,*arg,**args):
1576 for name
in args.iterkeys():
1577 self.__dict__[name]=args[name]
1596 self.assertEqual(p.a.type_(),
"MyAnalyzer")
1597 self.assertEqual(p.a.label_(),
"a")
1598 self.assertRaises(AttributeError,getattr,p,
'b')
1599 self.assertEqual(p.Full.type_(),
"Full")
1600 self.assertEqual(
str(p.c),
'a')
1601 self.assertEqual(
str(p.d),
'a')
1616 self.assertRaises(ValueError, p1.extend, z1)
1625 aaa=copy.deepcopy(a),
1626 s4=copy.deepcopy(s3),
1633 self.assertEqual(p2.s4.label_(),
"s4")
1635 self.assertRaises(ValueError, p2.s4.setLabel,
"foo")
1636 p2.s4.setLabel(
"s4")
1637 p2.s4.setLabel(
None)
1638 p2.s4.setLabel(
"foo")
1639 p2._Process__setObjectLabel(p2.s4,
"foo")
1640 p2._Process__setObjectLabel(p2.s4,
None)
1641 p2._Process__setObjectLabel(p2.s4,
"bar")
1653 """import FWCore.ParameterSet.Config as cms 1655 process = cms.Process("test") 1657 process.a = cms.EDAnalyzer("MyAnalyzer") 1660 process.s = cms.Sequence(process.a) 1663 process.r = cms.Sequence(process.s) 1666 process.p = cms.Path(process.a) 1669 process.p2 = cms.Path(process.s) 1672 process.schedule = cms.Schedule(*[ process.p2, process.p ]) 1685 """import FWCore.ParameterSet.Config as cms 1687 process = cms.Process("test") 1689 process.a = cms.EDAnalyzer("MyAnalyzer") 1692 process.b = cms.EDAnalyzer("YourAnalyzer") 1695 process.r = cms.Sequence(process.a) 1698 process.s = cms.Sequence(process.r) 1701 process.p = cms.Path(process.a) 1704 process.p2 = cms.Path(process.r) 1707 process.schedule = cms.Schedule(*[ process.p2, process.p ]) 1719 """import FWCore.ParameterSet.Config as cms 1721 process = cms.Process("test") 1723 process.a = cms.EDAnalyzer("MyAnalyzer") 1726 process.r = cms.Sequence((process.a)) 1729 process.p = cms.Path(process.a) 1732 process.p2 = cms.Path(process.r) 1735 process.schedule = cms.Schedule(*[ process.p2, process.p ]) 1749 p.task2 =
Task(p.c, p.task3)
1750 p.task4 =
Task(p.f, p.task2)
1751 p.task1 =
Task(p.task5)
1752 p.task3.add(p.task1)
1756 p.p2 =
Path(p.r, p.task1, p.task2)
1757 p.schedule =
Schedule(p.p2,p.p,tasks=[p.task3,p.task4, p.task5])
1760 """import FWCore.ParameterSet.Config as cms 1762 process = cms.Process("test") 1764 process.b = cms.EDProducer("bProducer") 1767 process.c = cms.EDProducer("cProducer") 1770 process.d = cms.EDProducer("dProducer") 1773 process.e = cms.EDProducer("eProducer") 1776 process.f = cms.EDProducer("fProducer") 1779 process.g = cms.EDProducer("gProducer") 1782 process.a = cms.EDAnalyzer("MyAnalyzer") 1785 process.task5 = cms.Task() 1788 process.task1 = cms.Task(process.task5) 1791 process.task3 = cms.Task(process.task1) 1794 process.task2 = cms.Task(process.c, process.task3) 1797 process.task4 = cms.Task(process.f, process.task2) 1800 process.r = cms.Sequence((process.a)) 1803 process.p = cms.Path(process.a) 1806 process.p2 = cms.Path(process.r, process.task1, process.task2) 1809 process.schedule = cms.Schedule(*[ process.p2, process.p ], tasks=[process.task3, process.task4, process.task5]) 1817 p.task1 =
Task(p.d, p.e)
1818 task2 =
Task(p.f, p.g)
1819 p.schedule =
Schedule(tasks=[p.task1,task2])
1822 """import FWCore.ParameterSet.Config as cms 1824 process = cms.Process("test") 1826 process.d = cms.EDProducer("dProducer") 1829 process.e = cms.EDProducer("eProducer") 1832 process.f = cms.EDProducer("fProducer") 1835 process.g = cms.EDProducer("gProducer") 1838 process.task1 = cms.Task(process.d, process.e) 1841 process.schedule = cms.Schedule(tasks=[cms.Task(process.f, process.g), process.task1]) 1848 """import FWCore.ParameterSet.Config as cms 1850 process = cms.Process("test") 1852 process.schedule = cms.Schedule() 1862 d=process.dumpPython()
1864 """import FWCore.ParameterSet.Config as cms 1866 process = cms.Process("DUMP") 1868 process.a = cms.EDProducer("A") 1871 process.s2 = cms.Sequence(process.a) 1884 d=process.dumpPython()
1886 """import FWCore.ParameterSet.Config as cms 1888 process = cms.Process("DUMP") 1890 process.a = cms.EDProducer("A") 1893 process.s2 = cms.Sequence(process.a+(process.a+process.a)) 1901 self.assertEqual(p.dumpPython().
replace(
'\n',
''),
'import FWCore.ParameterSet.Config as cmsprocess = cms.Process("test")process.a = cms.SecSource("MySecSource")')
1921 p.p =
Path(p.c+s+p.a)
1927 self.assertTrue(visitor1.modules == set([old,old2,p.b,p.c]))
1929 p.globalReplace(
"a",new)
1930 p.globalReplace(
"d",new2)
1933 self.assertTrue(visitor2.modules == set([new,new2,p.b,p.c]))
1935 p.e3.visit(visitor3)
1936 self.assertTrue(visitor3.modules == set([new,new2,p.b,p.c]))
1938 p.s4.visit(visitor4)
1939 self.assertTrue(visitor4.modules == set([new,new2,p.b]))
1941 p.t1.visit(visitor5)
1942 self.assertTrue(visitor5.modules == set([new2]))
1944 listOfTasks =
list(p.schedule._tasks)
1945 listOfTasks[0].
visit(visitor6)
1946 self.assertTrue(visitor6.modules == set([new2]))
1954 self.assertEqual(
str(p.s),
'a+b')
1955 self.assertEqual(p.s.label_(),
's')
1956 path =
Path(p.c+p.s)
1957 self.assertEqual(
str(path),
'c+a+b')
1958 p._validateSequence(path,
'p1')
1960 p2 =
Path(p.c+p.s*notInProcess)
1961 self.assertRaises(RuntimeError, p._validateSequence, p2,
'p2')
1971 self.assertRaises(ValueError, p.__setattr__,
"y", testseq)
1975 self.assertFalse(service._inProcess)
1978 self.assertTrue(service._inProcess)
1980 process.d = service2
1981 self.assertFalse(service._inProcess)
1982 self.assertTrue(service2._inProcess)
1984 self.assertFalse(service2._inProcess)
2004 testTask1 =
Task(edproducer, edfilter)
2005 self.assertRaises(RuntimeError, testTask1.add, edanalyzer)
2006 testTask1.add(essource, service)
2007 testTask1.add(essource, esproducer)
2008 testTask1.add(testTask2)
2009 coll = testTask1._collection
2010 self.assertTrue(edproducer
in coll)
2011 self.assertTrue(edfilter
in coll)
2012 self.assertTrue(service
in coll)
2013 self.assertTrue(essource
in coll)
2014 self.assertTrue(esproducer
in coll)
2015 self.assertTrue(testTask2
in coll)
2016 self.assertTrue(len(coll) == 6)
2017 self.assertTrue(len(testTask2._collection) == 0)
2021 taskContents.append(i)
2022 self.assertTrue(taskContents == [edproducer, edfilter, essource, service, esproducer, testTask2])
2027 process.mproducer = edproducer
2028 process.mproducer2 = edproducer2
2029 process.mfilter = edfilter
2030 process.messource = essource
2031 process.mesproducer = esproducer
2034 testTask3 =
Task(edproducer, edproducer2)
2035 testTask1.add(testTask3)
2036 process.myTask1 = testTask1
2043 testTask1.visit(visitor)
2044 self.assertTrue(l == set([
'mesproducer',
'mproducer',
'mproducer2',
'mfilter',
'd',
'messource']))
2045 l2 = testTask1.moduleNames
2046 self.assertTrue(l == set([
'mesproducer',
'mproducer',
'mproducer2',
'mfilter',
'd',
'messource']))
2048 testTask4 =
Task(edproducer3)
2050 self.assertRaises(RuntimeError, testTask4.visit, visitor)
2052 process.myTask4 = testTask4
2053 self.assertTrue(
False)
2054 except RuntimeError:
2057 testTask5 =
Task(service3)
2059 self.assertRaises(RuntimeError, testTask5.visit, visitor)
2061 process.myTask5 = testTask5
2062 self.assertTrue(
False)
2063 except RuntimeError:
2066 process.d = service3
2067 process.myTask5 = testTask5
2070 expectedDict = {
'myTask1' : testTask1,
'myTask5' : testTask5 }
2072 self.assertTrue(process.tasks == expectedFixedDict)
2073 self.assertTrue(process.tasks[
'myTask1'] == testTask1)
2074 self.assertTrue(process.myTask1 == testTask1)
2078 process.mproducer2 = edproducer4
2082 testTask1.visit(visitor1)
2084 expectedList = [edproducer,essource,esproducer,service,edfilter,edproducer,edproducer4]
2086 self.assertTrue(expectedList == l)
2088 process.myTask6 =
Task()
2089 process.myTask7 =
Task()
2090 process.mproducer8 = edproducer8
2091 process.myTask8 =
Task(process.mproducer8)
2092 process.myTask6.add(process.myTask7)
2093 process.myTask7.add(process.myTask8)
2094 process.myTask1.add(process.myTask6)
2095 process.myTask8.add(process.myTask5)
2097 testDict = process._itemsInDependencyOrder(process.tasks)
2098 expectedLabels = [
"myTask5",
"myTask8",
"myTask7",
"myTask6",
"myTask1"]
2099 expectedTasks = [process.myTask5, process.myTask8, process.myTask7, process.myTask6, process.myTask1]
2101 for testLabel, testTask
in testDict.items():
2102 self.assertTrue(testLabel == expectedLabels[index])
2103 self.assertTrue(testTask == expectedTasks[index])
2109 expectedPythonDump =
'cms.Task(process.d, process.mesproducer, process.messource, process.mfilter, process.mproducer, process.mproducer2, process.myTask6)\n' 2110 self.assertTrue(pythonDump == expectedPythonDump)
2112 process.myTask5 =
Task()
2113 process.myTask100 =
Task()
2114 process.mproducer9 = edproducer9
2115 sequence1 =
Sequence(process.mproducer8, process.myTask1, process.myTask5, testTask2, testTask3)
2116 sequence2 =
Sequence(process.mproducer8 + process.mproducer9)
2117 process.sequence3 =
Sequence((process.mproducer8 + process.mfilter))
2119 process.path1 =
Path(process.mproducer+process.mproducer8+sequence1+sequence2+process.sequence3+sequence4)
2120 process.path1.associate(process.myTask1, process.myTask5, testTask2, testTask3)
2121 process.path11 =
Path(process.mproducer+process.mproducer8+sequence1+sequence2+process.sequence3+ sequence4,process.myTask1, process.myTask5, testTask2, testTask3, process.myTask100)
2122 process.path2 =
Path(process.mproducer)
2123 process.path3 =
Path(process.mproducer9+process.mproducer8,testTask2)
2125 self.assertTrue(process.path1.dumpPython(
PrintOptions()) ==
'cms.Path(process.mproducer+process.mproducer8+cms.Sequence(process.mproducer8, cms.Task(), cms.Task(process.None, process.mproducer), process.myTask1, process.myTask5)+(process.mproducer8+process.mproducer9)+process.sequence3, cms.Task(), cms.Task(process.None, process.mproducer), process.myTask1, process.myTask5)\n')
2127 self.assertTrue(process.path11.dumpPython(
PrintOptions()) ==
'cms.Path(process.mproducer+process.mproducer8+cms.Sequence(process.mproducer8, cms.Task(), cms.Task(process.None, process.mproducer), process.myTask1, process.myTask5)+(process.mproducer8+process.mproducer9)+process.sequence3, cms.Task(), cms.Task(process.None, process.mproducer), process.myTask1, process.myTask100, process.myTask5)\n')
2132 process.path1.visit(nameVisitor)
2133 self.assertTrue(l == set([
'mproducer',
'd',
'mesproducer',
None,
'mproducer9',
'mproducer8',
'messource',
'mproducer2',
'mfilter']))
2134 self.assertTrue(process.path1.moduleNames() == set([
'mproducer',
'd',
'mesproducer',
None,
'mproducer9',
'mproducer8',
'messource',
'mproducer2',
'mfilter']))
2138 process.path21 = process.path11.copy()
2139 process.path21.replace(process.mproducer, process.mproducer10)
2141 self.assertTrue(process.path11.dumpPython(
PrintOptions()) ==
'cms.Path(process.mproducer+process.mproducer8+cms.Sequence(process.mproducer8, cms.Task(), cms.Task(process.None, process.mproducer), process.myTask1, process.myTask5)+(process.mproducer8+process.mproducer9)+process.sequence3, cms.Task(), cms.Task(process.None, process.mproducer), process.myTask1, process.myTask100, process.myTask5)\n')
2150 self.assertTrue(process.path21.dumpPython(
PrintOptions()) ==
'cms.Path(process.mproducer10+process.mproducer8+process.mproducer8+(process.mproducer8+process.mproducer9)+process.sequence3, cms.Task(), cms.Task(process.None, process.mproducer10), cms.Task(process.d, process.mesproducer, process.messource, process.mfilter, process.mproducer10, process.mproducer2, process.myTask6), process.myTask100, process.myTask5)\n')
2152 process.path22 = process.path21.copyAndExclude([process.d, process.mesproducer, process.mfilter])
2153 self.assertTrue(process.path22.dumpPython(
PrintOptions()) ==
'cms.Path(process.mproducer10+process.mproducer8+process.mproducer8+(process.mproducer8+process.mproducer9)+process.mproducer8, cms.Task(), cms.Task(process.None, process.mproducer10), cms.Task(process.messource, process.mproducer10, process.mproducer2, process.myTask6), process.myTask100, process.myTask5)\n')
2155 process.path23 = process.path22.copyAndExclude([process.messource, process.mproducer10])
2156 self.assertTrue(process.path23.dumpPython(
PrintOptions()) ==
'cms.Path(process.mproducer8+process.mproducer8+(process.mproducer8+process.mproducer9)+process.mproducer8, cms.Task(), cms.Task(process.None), cms.Task(process.mproducer2, process.myTask6), process.myTask100, process.myTask5)\n')
2165 process.path24 =
Path(process.a+process.b+process.c+process.d)
2166 process.path25 = process.path24.copyAndExclude([process.a,process.b,process.c])
2167 self.assertTrue(process.path25.dumpPython(
None) ==
'cms.Path(process.d)\n')
2172 process.path200.replace(process.c,process.b)
2173 process.path200.replace(process.e,process.f)
2174 self.assertEqual(process.path200.dumpPython(
None),
"cms.EndPath(process.b, cms.Task(process.f))\n")
2175 process.path200.replace(process.b,process.c)
2176 process.path200.replace(process.f,process.e)
2177 self.assertEqual(process.path200.dumpPython(
None),
"cms.EndPath(process.c, cms.Task(process.e))\n")
2178 process.path200.replace(process.c,process.a)
2179 process.path200.replace(process.e,process.g)
2180 self.assertEqual(process.path200.dumpPython(
None),
"cms.EndPath(process.a, cms.Task(process.g))\n")
2181 process.path200.replace(process.a,process.c)
2182 process.path200.replace(process.g,process.e)
2183 self.assertEqual(process.path200.dumpPython(
None),
"cms.EndPath(process.c, cms.Task(process.e))\n")
2194 self.assertEqual(
str(path),
'a+b+c')
2195 path =
Path(p.a*p.b+p.c)
2196 self.assertEqual(
str(path),
'a+b+c')
2199 path =
Path(p.a+ p.b*p.c)
2200 self.assertEqual(
str(path),
'a+b+c')
2201 path =
Path(p.a*(p.b+p.c))
2202 self.assertEqual(
str(path),
'a+b+c')
2203 path =
Path(p.a*(p.b+~p.c))
2205 self.assertEqual(
str(path),
'a+b+~c')
2207 self.assertRaises(TypeError,Path,p.es)
2210 self.assertTrue(t.dumpPython(
PrintOptions()) ==
'cms.Path()\n')
2213 self.assertTrue(t.dumpPython(
PrintOptions()) ==
'cms.Path(process.a)\n')
2216 self.assertTrue(t.dumpPython(
PrintOptions()) ==
'cms.Path(cms.Task())\n')
2219 self.assertTrue(t.dumpPython(
PrintOptions()) ==
'cms.Path(process.a, cms.Task())\n')
2224 self.assertTrue(t.dumpPython(
PrintOptions()) ==
'cms.Path(process.a, cms.Task(), process.t1)\n')
2235 p.path =
Path(p.a*p.b)
2236 lookuptable = {
id(a): p.a,
id(b): p.b}
2240 self.assertEqual(
str(path),
str(p.path))
2253 self.assertEqual(s[0],p.path1)
2254 self.assertEqual(s[1],p.path2)
2256 self.assert_(
'b' in p.schedule.moduleNames())
2257 self.assert_(hasattr(p,
'b'))
2258 self.assert_(hasattr(p,
'c'))
2259 self.assert_(hasattr(p,
'd'))
2260 self.assert_(hasattr(p,
'path1'))
2261 self.assert_(hasattr(p,
'path2'))
2262 self.assert_(hasattr(p,
'path3'))
2264 self.assert_(
'b' in p.schedule.moduleNames())
2265 self.assert_(hasattr(p,
'b'))
2266 self.assert_(
not hasattr(p,
'c'))
2267 self.assert_(
not hasattr(p,
'd'))
2268 self.assert_(hasattr(p,
'path1'))
2269 self.assert_(hasattr(p,
'path2'))
2270 self.assert_(
not hasattr(p,
'path3'))
2272 self.assertTrue(len(p.schedule._tasks) == 0)
2286 p.task2 =
Task(p.f, p.Tracer)
2287 s =
Schedule(p.path1,p.path2,tasks=[p.task1,p.task2,p.task1])
2288 self.assertEqual(s[0],p.path1)
2289 self.assertEqual(s[1],p.path2)
2290 self.assertTrue(len(s._tasks) == 2)
2291 self.assertTrue(p.task1
in s._tasks)
2292 self.assertTrue(p.task2
in s._tasks)
2293 listOfTasks =
list(s._tasks)
2294 self.assertTrue(len(listOfTasks) == 2)
2295 self.assertTrue(p.task1 == listOfTasks[0])
2296 self.assertTrue(p.task2 == listOfTasks[1])
2298 self.assert_(
'b' in p.schedule.moduleNames())
2303 process2.path1 =
Path(process2.a)
2304 process2.task1 =
Task(process2.e)
2305 process2.schedule =
Schedule(process2.path1,tasks=process2.task1)
2306 listOfTasks =
list(process2.schedule._tasks)
2307 self.assertTrue(listOfTasks[0] == process2.task1)
2311 self.assertEqual(s2[0],p.path1)
2312 self.assertEqual(s2[1],p.path2)
2313 self.assertTrue(len(s2._tasks) == 2)
2314 self.assertTrue(p.task1
in s2._tasks)
2315 self.assertTrue(p.task2
in s2._tasks)
2316 listOfTasks =
list(s2._tasks)
2317 self.assertTrue(len(listOfTasks) == 2)
2318 self.assertTrue(p.task1 == listOfTasks[0])
2319 self.assertTrue(p.task2 == listOfTasks[1])
2321 names = s.moduleNames()
2322 self.assertTrue(names == set([
'a',
'b',
'e',
'Tracer',
'f']))
2328 self.assertRaises(RuntimeError,
lambda : p.setSchedule_(s) )
2337 self.assert_(
'a' in s.moduleNames())
2338 self.assert_(
'b' in s.moduleNames())
2339 self.assert_(
'c' in s.moduleNames())
2343 self.assert_(
'a' in s.moduleNames())
2344 self.assert_(
'b' in s.moduleNames())
2345 self.assert_(
'c' in s.moduleNames())
2354 self.assert_(p.schedule
is None)
2357 self.assertEqual(pths[keys[0]],p.path1)
2358 self.assertEqual(pths[keys[1]],p.path2)
2360 self.assert_(hasattr(p,
'a'))
2361 self.assert_(hasattr(p,
'b'))
2362 self.assert_(
not hasattr(p,
'c'))
2363 self.assert_(hasattr(p,
'path1'))
2364 self.assert_(hasattr(p,
'path2'))
2373 self.assert_(p.schedule
is None)
2376 self.assertEqual(pths[keys[1]],p.path1)
2377 self.assertEqual(pths[keys[0]],p.path2)
2384 self.assertEqual(p.modu.a.value(),1)
2385 self.assertEqual(p.modu.b.value(),2)
2390 self.assert_(
not a.isModified())
2392 self.assert_(a.isModified())
2394 self.assertEqual(p.a.a1.value(), 1)
2398 self.assertEqual(p.a.a1.value(), 2)
2407 self.assertRaises(ValueError, EDProducer,
'C', ps1, ps2)
2408 self.assertRaises(ValueError, EDProducer,
'C', ps1, a=
int32(3))
2412 p.source =
Source(
"PoolSource",fileNames = untracked(
string(
"file:reco.root")))
2415 p.out =
OutputModule(
"PoolOutputModule",fileName=untracked(
string(
"file:foos.root")))
2416 p.bars.foos =
'Foosball' 2417 self.assertEqual(p.bars.foos,
InputTag(
'Foosball'))
2418 p.p =
Path(p.foos*p.bars)
2420 p.add_(
Service(
"MessageLogger"))
2426 p.prefer(
"ForceSource")
2428 self.assertEqual(p.dumpConfig(),
2430 es_module juicer = JuicerProducer { 2432 es_source = ForceSource { 2434 es_prefer = ForceSource { 2436 es_prefer juicer = JuicerProducer { 2440 p.prefer(
"juicer",fooRcd=
vstring(
"Foo"))
2441 self.assertEqual(p.dumpConfig(),
2443 es_module juicer = JuicerProducer { 2445 es_source = ForceSource { 2447 es_prefer = ForceSource { 2449 es_prefer juicer = JuicerProducer { 2457 self.assertEqual(p.dumpPython(),
2458 """import FWCore.ParameterSet.Config as cms 2460 process = cms.Process("Test") 2462 process.juicer = cms.ESProducer("JuicerProducer") 2465 process.ForceSource = cms.ESSource("ForceSource") 2468 process.prefer("ForceSource") 2470 process.prefer("juicer", 2471 fooRcd = cms.vstring('Foo') 2488 self.assertEqual(process.m.p.i.value(), 4)
2498 subProcess.p =
Path(subProcess.a)
2499 subProcess.add_(
Service(
"Foo"))
2500 process.addSubProcess(
SubProcess(subProcess))
2501 d = process.dumpPython()
2502 equalD =
"""import FWCore.ParameterSet.Config as cms 2504 process = cms.Process("Parent") 2506 parentProcess = process 2507 import FWCore.ParameterSet.Config as cms 2509 process = cms.Process("Child") 2511 process.a = cms.EDProducer("A") 2514 process.Foo = cms.Service("Foo") 2517 process.p = cms.Path(process.a) 2520 childProcess = process 2521 process = parentProcess 2522 process.addSubProcess(cms.SubProcess(process = childProcess, SelectEvents = cms.untracked.PSet( 2524 ), outputCommands = cms.untracked.vstring())) 2527 equalD = equalD.replace(
"parentProcess",
"parentProcess"+
str(
hash(process.subProcesses_()[0])))
2528 self.assertEqual(d,equalD)
2530 process.fillProcessDesc(p)
2531 self.assertEqual((
True,[
'a']),p.values[
"subProcesses"][1][0].values[
"process"][1].values[
'@all_modules'])
2532 self.assertEqual((
True,[
'p']),p.values[
"subProcesses"][1][0].values[
"process"][1].values[
'@paths'])
2533 self.assertEqual({
'@service_type':(
True,
'Foo')}, p.values[
"subProcesses"][1][0].values[
"process"][1].values[
"services"][1][0].values)
2543 proc.fillProcessDesc(p)
2544 self.assertEqual((
True,1),p.values[
"ref"][1].values[
"a"])
2545 self.assertEqual((
True,1),p.values[
"ref3"][1].values[
"a"])
2546 self.assertEqual((
True,1),p.values[
"ref2"][1].values[
"a"])
2547 self.assertEqual((
True,1),p.values[
"ref2"][1].values[
"b"][1].values[
"a"])
2548 self.assertEqual((
True,1),p.values[
"ref4"][1][0].values[
"a"])
2549 self.assertEqual((
True,1),p.values[
"ref4"][1][1].values[
"a"])
2559 self.assert_(p.schedule
is None)
2562 self.assertEqual(pths[keys[0]],p.path1)
2563 self.assertEqual(pths[keys[1]],p.path2)
2565 p.pset2 = untracked.PSet(parA =
string(
"pset2"))
2567 p.vpset2 = untracked.VPSet()
2569 self.assert_(hasattr(p,
'a'))
2570 self.assert_(hasattr(p,
'b'))
2571 self.assert_(
not hasattr(p,
'c'))
2572 self.assert_(
not hasattr(p,
'd'))
2573 self.assert_(
not hasattr(p,
's'))
2574 self.assert_(hasattr(p,
'path1'))
2575 self.assert_(hasattr(p,
'path2'))
2592 p.path3 =
Path(p.b+p.s2)
2593 p.path4 =
Path(p.b+p.s3)
2594 p.schedule =
Schedule(p.path1,p.path2,p.path3)
2597 self.assertEqual(pths[keys[0]],p.path1)
2598 self.assertEqual(pths[keys[1]],p.path2)
2600 self.assert_(hasattr(p,
'a'))
2601 self.assert_(hasattr(p,
'b'))
2602 self.assert_(
not hasattr(p,
'c'))
2603 self.assert_(
not hasattr(p,
'd'))
2604 self.assert_(
not hasattr(p,
'e'))
2605 self.assert_(
not hasattr(p,
's'))
2606 self.assert_(hasattr(p,
's2'))
2607 self.assert_(
not hasattr(p,
's3'))
2608 self.assert_(hasattr(p,
'path1'))
2609 self.assert_(hasattr(p,
'path2'))
2610 self.assert_(hasattr(p,
'path3'))
2611 self.assert_(
not hasattr(p,
'path4'))
2619 self.assert_(hasattr(p,
'a'))
2620 self.assert_(hasattr(p,
'b'))
2621 self.assert_(hasattr(p,
's'))
2622 self.assert_(hasattr(p,
'pth'))
2628 p.prune(keepUnresolvedSequencePlaceholders=
True)
2629 self.assert_(hasattr(p,
'b'))
2630 self.assert_(hasattr(p,
's'))
2631 self.assert_(hasattr(p,
'pth'))
2632 self.assertEqual(p.s.dumpPython(
''),
'cms.Sequence(cms.SequencePlaceholder("a")+process.b)\n')
2643 p.t1 =
Task(p.g, p.h)
2647 p.path1 =
Path(p.a+p.f+p.s,t2)
2650 self.assertTrue(hasattr(p,
'f'))
2651 self.assertTrue(hasattr(p,
'g'))
2655 self.assertFalse(hasattr(p,
'f'))
2656 self.assertFalse(hasattr(p,
'g'))
2657 self.assertTrue(p.t1.dumpPython(
None) ==
'cms.Task(process.h)\n')
2658 self.assertTrue(p.s.dumpPython(
None) ==
'cms.Sequence(process.d)\n')
2659 self.assertTrue(p.path1.dumpPython(
None) ==
'cms.Path(process.a+process.s, cms.Task(process.h))\n')
2660 self.assertTrue(p.endpath1.dumpPython(
None) ==
'cms.EndPath(process.b)\n')
2662 self.assertTrue(p.path1.dumpPython(
None) ==
'cms.Path(process.a+(process.d), cms.Task(process.h))\n')
2663 self.assertTrue(p.schedule_().
dumpPython(
None) ==
'cms.Schedule(tasks=[cms.Task(process.h)])\n')
2670 m1.toModify(p.a,_mod_fred)
2671 self.assertEqual(p.a.fred.value(),2)
2673 m1.toModify(p.b, wilma = 2)
2674 self.assertEqual(p.b.wilma.value(),2)
2675 self.assert_(p.isUsingModifier(m1))
2680 m1.toModify(p.a,_mod_fred)
2682 m1.toModify(p.b, wilma = 2)
2683 self.assertEqual(p.a.fred.value(),1)
2684 self.assertEqual(p.b.wilma.value(),1)
2685 self.assertEqual(p.isUsingModifier(m1),
False)
2690 m1.toModify(p.a, fred =
int32(2))
2691 p.b = p.a.clone(wilma =
int32(3))
2692 self.assertEqual(p.a.fred.value(),2)
2693 self.assertEqual(p.a.wilma.value(),1)
2694 self.assertEqual(p.b.fred.value(),2)
2695 self.assertEqual(p.b.wilma.value(),3)
2700 m1.toModify(p.a, fred =
None)
2701 self.assertEqual(hasattr(p.a,
"fred"),
False)
2702 self.assertEqual(p.a.wilma.value(),1)
2707 m1.toModify(p.a, wilma =
int32(2))
2708 self.assertEqual(p.a.fred.value(), 1)
2709 self.assertEqual(p.a.wilma.value(),2)
2714 m1.toModify(p.a, flintstones =
dict(fred =
int32(2)))
2715 self.assertEqual(p.a.flintstones.fred.value(),2)
2716 self.assertEqual(p.a.flintstones.wilma.value(),1)
2721 self.assertRaises(KeyError,
lambda: m1.toModify(p.a, flintstones =
dict(imnothere =
dict(wilma=2))))
2722 self.assertRaises(KeyError,
lambda: m1.toModify(p.a, foo = 1))
2727 m1.toModify(p.a, flintstones = {1:
dict(wilma =
int32(2))})
2728 self.assertEqual(p.a.flintstones[0].fred.value(),1)
2729 self.assertEqual(p.a.flintstones[1].wilma.value(),2)
2734 m1.toModify(p.a, fred = {1:7})
2735 self.assertEqual(p.a.fred[0],1)
2736 self.assertEqual(p.a.fred[1],7)
2737 self.assertEqual(p.a.fred[2],3)
2743 try: m1.toModify(p.a, fred = {5:7})
2744 except IndexError
as e: raised =
True 2745 self.assertEqual(raised,
True)
2751 try: m1.toModify(p.a, flintstones =
dict(bogus =
int32(37)))
2752 except TypeError
as e: raised =
True 2753 self.assertEqual(raised,
True)
2757 class ProcModifierMod(
object):
2758 def __init__(self,modifier,func):
2763 testMod = DummyMod()
2765 self.assert_(hasattr(p,
"a"))
2768 testProcMod = ProcModifierMod(m1,_rem_a)
2770 p.extend(testProcMod)
2771 self.assert_(
not hasattr(p,
"a"))
2776 self.assert_(p.isUsingModifier(m1))
2777 self.assert_(p.isUsingModifier(mc))
2778 testMod = DummyMod()
2780 m1.toModify(p.b, fred =
int32(3))
2782 testProcMod = ProcModifierMod(m1,_rem_a)
2783 p.extend(testProcMod)
2784 self.assert_(
not hasattr(p,
"a"))
2785 self.assertEqual(p.b.fred.value(),3)
2790 mclone = mc.copyAndExclude([m2])
2791 self.assert_(
not mclone._isOrContains(m2))
2792 self.assert_(mclone._isOrContains(m1))
2795 mclone = mc2.copyAndExclude([m2])
2796 self.assert_(
not mclone._isOrContains(m2))
2797 self.assert_(mclone._isOrContains(m1))
2798 self.assert_(mclone._isOrContains(m3))
2804 (m1 & m2).toModify(p.a, fred =
int32(2))
2805 self.assertEqual(p.a.fred, 1)
2810 (m1 & m2).toModify(p.a, fred =
int32(2))
2811 self.assertEqual(p.a.fred, 2)
2817 (m1 & m2 & m3).toModify(p.a, fred =
int32(2))
2818 self.assertEqual(p.a.fred, 2)
2830 m1.toReplaceWith(p.s,
Sequence(p.a+p.b, p.td))
2831 self.assertEqual(p.a.wilma.value(),3)
2832 self.assertEqual(p.a.type_(),
"YourAnalyzer")
2833 self.assertEqual(hasattr(p,
"fred"),
False)
2834 self.assertTrue(p.s.dumpPython(
"") ==
"cms.Sequence(process.a+process.b, process.td)\n")
2836 m1.toReplaceWith(p.td,
Task(p.e))
2837 self.assertTrue(p.td._collection ==
OrderedSet([p.e]))
2843 self.assertEqual(p.a.type_(),
"MyAnalyzer")
def __setstate__(self, pkldict)
def addVString(self, tracked, label, value)
def _dumpConfigOptionallyNamedList(self, items, typeName, options)
def addEventRange(self, tracked, label, value)
def __getattribute__(self, name)
def _place(self, label, process)
def testServiceInProcess(self)
def _dumpConfigUnnamedList(self, items, typeName, options)
def _placeAnalyzer(self, name, mod)
def addString(self, tracked, label, value)
def __findFirstUsingModule(self, seqsOrTasks, mod)
def makeProcessModifier(self, func)
def _pruneModules(self, d, scheduledNames)
def _modifyParametersFromDict(params, newParams, errorRaiser, keyDepth="")
def _placeESPrefer(self, name, mod)
def _insertPaths(self, processPSet, nodeVisitor)
def _placeESProducer(self, name, mod)
def addVESInputTag(self, tracked, label, value)
def _placeSequence(self, name, mod)
def _validateSequence(self, sequence, label)
def __getattr__(self, attr)
def setStrict(self, value)
def addDouble(self, tracked, label, value)
def _findPreferred(self, esname, d, args, kargs)
def replace(string, replacements)
def _insertOneInto(self, parameterSet, label, item, tracked)
def __delattr__(self, name)
def _placePath(self, name, mod)
def addVUInt64(self, tracked, label, value)
def _placeEndPath(self, name, mod)
def __init__(self, name, Mods)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
def testTypedParameterizable(self)
def addUInt64(self, tracked, label, value)
def _itemsInDependencyOrder(self, processDictionaryOfItems)
def addVPSet(self, tracked, label, value)
def nameInProcessDesc_(self, label)
def format_outerframe(number)
def __init__(self, args, kw)
def load(self, moduleName)
def _raiseUnknownKey(key)
def _insertSubProcessesInto(self, parameterSet, label, itemList, tracked)
def addUInt32(self, tracked, label, value)
def _dumpConfigESPrefers(self, options)
def __setattr__(self, name, value)
def setLooper_(self, lpr)
def setSource_(self, src)
def __init__(self, process)
def extend(self, other, items=())
def _okToPlace(self, name, mod, d)
def visit(visitdir)
Retrieve data from a perf suite output (sub) directory, only examines TimeSize at the moment...
def _replaceInTasks(self, label, new)
def addVInt32(self, tracked, label, value)
def _placeFilter(self, name, mod)
def addVInputTag(self, tracked, label, value)
def _applyNewProcessModifiers(self, process)
def addLuminosityBlockID(self, tracked, label, value)
def addESInputTag(self, tracked, label, value)
def __new__(cls, args, kw)
def __setattr__(self, name, value)
def _placeESSource(self, name, mod)
def addVInt64(self, tracked, label, value)
def addVEventID(self, tracked, label, value)
def toModify(self, obj, func=None, kw)
def testGlobalReplace(self)
def _placeOutputModule(self, name, mod)
def addFileInPath(self, tracked, label, value)
def _placeSource(self, name, mod)
def _dumpPythonSubProcesses(self, l, options)
def checkImportPermission(minLevel=2, allowedPatterns=[])
def __init__(self, modifier, func)
def isUsingModifier(self, mod)
def dumpPython(self, options=PrintOptions())
def __copyIfExclude(self, toExclude)
def _validateTask(self, task, label)
def testParameterizable(self)
def _placeSubProcess(self, name, mod)
def setPartialSchedule_(self, sch, label)
def addPSet(self, tracked, label, value)
def testProcessDumpPython(self)
def _placeService(self, typeName, mod)
def resolve(self, keepUnresolvedSequencePlaceholders=False)
static std::string join(char **cmd)
def _isOrContains(self, other)
def getSubProcessPSet(self, parameterSet)
def copyAndExclude(self, toExclude)
def addVUInt32(self, tracked, label, value)
def addVEventRange(self, tracked, label, value)
def __init__(self, lhs, rhs)
def dumpPython(process, name)
def __setObjectLabel(self, object, newLabel)
def _delHelper(self, name)
def _placeAlias(self, name, mod)
def dumpPython(self, options=PrintOptions())
def _replaceInSequences(self, label, new)
def setSchedule_(self, sch)
def toReplaceWith(self, toObj, fromObj)
def _placeProducer(self, name, mod)
def prefer(self, esmodule, args, kargs)
def __delattr__(self, name)
def _dumpConfigNamedList(self, items, typeName, options)
def addInputTag(self, tracked, label, value)
def _insertManyInto(self, parameterSet, label, itemDict, tracked)
def dumpConfig(self, options=PrintOptions())
def testCloneSequence(self)
def _placeTask(self, name, task)
def addSubProcess(self, mod)
def _placePSet(self, name, mod)
def _isOrContains(self, other)
def addInt64(self, tracked, label, value)
def _place(self, name, mod, d)
def testProcessExtend(self)
def _dumpPythonList(self, d, options)
def __insertValue(self, tracked, label, value)
def _placeVPSet(self, name, mod)
def globalReplace(self, label, new)
def toModify(self, obj, func=None, kw)
def addBool(self, tracked, label, value)
def addEventID(self, tracked, label, value)
def _placeLooper(self, name, mod)
def testImplicitSchedule(self)
def prune(self, verbose=False, keepUnresolvedSequencePlaceholders=False)
def addVDouble(self, tracked, label, value)
def _insertInto(self, parameterSet, itemDict)
def _delattrFromSetattr(self, name)
def makeProcessModifier(self, func)
def __init__(self, process, SelectEvents=untracked.PSet(), outputCommands=untracked.vstring())
def __init__(self, chainedModifiers)
def _replaceInSchedule(self, label, new)
def _dumpPython(self, d, options)
def addInt32(self, tracked, label, value)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run
def fillProcessDesc(self, processPSet)
def testProcessInsertion(self)