4 from __future__
import print_function
5 from __future__
import absolute_import
7 from .Options
import Options
13 from .Mixins
import PrintOptions,_ParameterTypeBase,_SimpleParameterTypeBase, _Parameterizable, _ConfigureComponent, _TypedParameterizable, _Labelable, _Unlabelable, _ValidatingListBase, _modifyParametersFromDict
16 from .Modules
import *
17 from .Modules
import _Module
18 from .SequenceTypes
import *
19 from .SequenceTypes
import _ModuleSequenceType, _Sequenceable
20 from .SequenceVisitors
import PathValidator, EndPathValidator, ScheduleTaskValidator, NodeVisitor, CompositeVisitor, ModuleNamesFromGlobalsVisitor
21 from .
import DictTypes
23 from .ExceptionHandling
import *
26 if sys.getrecursionlimit()<5000:
27 sys.setrecursionlimit(5000)
31 Raise an exception if called by special config files. This checks 32 the call or import stack for the importing file. An exception is raised if 33 the importing module is not in allowedPatterns and if it is called too deeply: 34 minLevel = 2: inclusion by top lvel cfg only 35 minLevel = 1: No inclusion allowed 36 allowedPatterns = ['Module1','Module2/SubModule1'] allows import 37 by any module in Module1 or Submodule1 43 ignorePatterns = [
'FWCore/ParameterSet/Config.py',
'<string>',
'<frozen ']
44 CMSSWPath = [os.environ[
'CMSSW_BASE'],os.environ[
'CMSSW_RELEASE_BASE']]
48 for item
in inspect.stack():
52 for pattern
in CMSSWPath:
53 if item[1].
find(pattern) != -1:
56 if item[1].
find(
'/') == -1:
59 for pattern
in ignorePatterns:
60 if item[1].
find(pattern) != -1:
64 if inPath
and not ignore:
65 trueStack.append(item[1])
67 importedFile = trueStack[0]
69 if len(trueStack) > 1:
70 importedBy = trueStack[1]
72 for pattern
in allowedPatterns:
73 if importedBy.find(pattern) > -1:
76 if len(trueStack) <= minLevel:
79 raise ImportError(
"Inclusion of %s is allowed only by cfg or specified cfi files." 83 """Look inside the module and find the Processes it contains""" 87 if isinstance(module,dict):
88 if 'process' in module:
92 if hasattr(module,
'process'):
93 if isinstance(module.process,Process):
94 process = module.process
96 raise RuntimeError(
"The attribute named 'process' does not inherit from the Process class")
98 raise RuntimeError(
"no 'process' attribute found in the module, please add one")
102 """Root class for a CMS configuration process""" 104 """The argument 'name' will be the name applied to this Process 105 Can optionally pass as additional arguments cms.Modifier instances 106 that will be used to modify the Process as it is built 108 self.__dict__[
'_Process__name'] = name
109 if not name.isalnum():
110 raise RuntimeError(
"Error: The process name is an empty string or contains non-alphanumeric characters")
111 self.__dict__[
'_Process__filters'] = {}
112 self.__dict__[
'_Process__producers'] = {}
113 self.__dict__[
'_Process__switchproducers'] = {}
114 self.__dict__[
'_Process__source'] =
None 115 self.__dict__[
'_Process__looper'] =
None 116 self.__dict__[
'_Process__subProcesses'] = []
117 self.__dict__[
'_Process__schedule'] =
None 118 self.__dict__[
'_Process__analyzers'] = {}
119 self.__dict__[
'_Process__outputmodules'] = {}
122 self.__dict__[
'_Process__sequences'] = {}
123 self.__dict__[
'_Process__tasks'] = {}
124 self.__dict__[
'_Process__services'] = {}
125 self.__dict__[
'_Process__essources'] = {}
126 self.__dict__[
'_Process__esproducers'] = {}
127 self.__dict__[
'_Process__esprefers'] = {}
128 self.__dict__[
'_Process__aliases'] = {}
129 self.__dict__[
'_Process__psets']={}
130 self.__dict__[
'_Process__vpsets']={}
131 self.__dict__[
'_cloneToObjectDict'] = {}
133 self.__dict__[
'_Process__InExtendCall'] =
False 134 self.__dict__[
'_Process__partialschedules'] = {}
136 self.__dict__[
'_Process__modifiers'] = Mods
137 for m
in self.__modifiers:
142 _Module.__isStrict__ =
True 146 """Returns a string containing all the EDProducer labels separated by a blank""" 149 """Returns a string containing all the SwitchProducer labels separated by a blank""" 152 """Returns a string containing all the EDAnalyzer labels separated by a blank""" 155 """Returns a string containing all the EDFilter labels separated by a blank""" 158 """Returns a string containing all the Path names separated by a blank""" 165 Since cloneToObjectDict stores a hash of objects by their 166 id() it needs to be updated when unpickling to use the 167 new object id values instantiated during the unpickle. 170 self.__dict__.update(pkldict)
172 for value
in self._cloneToObjectDict.values():
173 tmpDict[
id(value)] = value
174 self.__dict__[
'_cloneToObjectDict'] = tmpDict
179 """returns a dict of the filters that have been added to the Process""" 181 filters = property(filters_, doc=
"dictionary containing the filters for the process")
185 if not name.isalnum():
186 raise RuntimeError(
"Error: The process name is an empty string or contains non-alphanumeric characters")
187 self.__dict__[
'_Process__name'] = name
188 process = property(name_,setName_, doc=
"name of the process")
190 """returns a dict of the producers that have been added to the Process""" 192 producers = property(producers_,doc=
"dictionary containing the producers for the process")
194 """returns a dict of the SwitchProducers that have been added to the Process""" 196 switchProducers = property(switchProducers_,doc=
"dictionary containing the SwitchProducers for the process")
198 """returns the source that has been added to the Process or None if none have been added""" 202 source = property(source_,setSource_,doc=
'the main source or None if not set')
204 """returns the looper that has been added to the Process or None if none have been added""" 208 looper = property(looper_,setLooper_,doc=
'the main looper or None if not set')
210 """returns a list of the subProcesses that have been added to the Process""" 211 return self.__subProcesses
212 subProcesses = property(subProcesses_,doc=
'the SubProcesses that have been added to the Process')
214 """returns a dict of the analyzers that have been added to the Process""" 216 analyzers = property(analyzers_,doc=
"dictionary containing the analyzers for the process")
218 """returns a dict of the output modules that have been added to the Process""" 220 outputModules = property(outputModules_,doc=
"dictionary containing the output_modules for the process")
222 """returns a dict of the paths that have been added to the Process""" 224 paths = property(paths_,doc=
"dictionary containing the paths for the process")
226 """returns a dict of the endpaths that have been added to the Process""" 228 endpaths = property(endpaths_,doc=
"dictionary containing the endpaths for the process")
230 """returns a dict of the sequences that have been added to the Process""" 232 sequences = property(sequences_,doc=
"dictionary containing the sequences for the process")
234 """returns a dict of the tasks that have been added to the Process""" 236 tasks = property(tasks_,doc=
"dictionary containing the tasks for the process")
238 """returns the schedule that has been added to the Process or None if none have been added""" 239 return self.__schedule
241 if label ==
"schedule":
244 self.
_place(label, sch, self.__partialschedules)
253 raise RuntimeError(
"The path at index "+
str(index)+
" in the Schedule was not attached to the process.")
254 self.__dict__[
'_Process__schedule'] = sch
255 schedule = property(schedule_,setSchedule_,doc=
'the schedule or None if not set')
257 """returns a dict of the services that have been added to the Process""" 259 services = property(services_,doc=
"dictionary containing the services for the process")
261 """returns a dict of the esproducers that have been added to the Process""" 263 es_producers = property(es_producers_,doc=
"dictionary containing the es_producers for the process")
265 """returns a the es_sources that have been added to the Process""" 267 es_sources = property(es_sources_,doc=
"dictionary containing the es_sources for the process")
269 """returns a dict of the es_prefers that have been added to the Process""" 271 es_prefers = property(es_prefers_,doc=
"dictionary containing the es_prefers for the process")
273 """returns a dict of the aliases that have been added to the Process""" 275 aliases = property(aliases_,doc=
"dictionary containing the aliases for the process")
277 """returns a dict of the PSets that have been added to the Process""" 279 psets = property(psets_,doc=
"dictionary containing the PSets for the process")
281 """returns a dict of the VPSets that have been added to the Process""" 283 vpsets = property(vpsets_,doc=
"dictionary containing the PSets for the process")
286 """returns True if the Modifier is in used by this Process""" 288 for m
in self.__modifiers:
289 if m._isOrContains(mod):
294 if not object.hasLabel_() :
295 object.setLabel(newLabel)
297 if newLabel == object.label_() :
299 if newLabel
is None :
300 object.setLabel(
None)
302 if (hasattr(self, object.label_())
and id(getattr(self, object.label_())) ==
id(object)) :
303 msg100 =
"Attempting to change the label of an attribute of the Process\n" 304 msg101 =
"Old label = "+object.label_()+
" New label = "+newLabel+
"\n" 305 msg102 =
"Type = "+
str(type(object))+
"\n" 306 msg103 =
"Some possible solutions:\n" 307 msg104 =
" 1. Clone modules instead of using simple assignment. Cloning is\n" 308 msg105 =
" also preferred for other types when possible.\n" 309 msg106 =
" 2. Declare new names starting with an underscore if they are\n" 310 msg107 =
" for temporaries you do not want propagated into the Process. The\n" 311 msg108 =
" underscore tells \"from x import *\" and process.load not to import\n" 312 msg109 =
" the name.\n" 313 msg110 =
" 3. Reorganize so the assigment is not necessary. Giving a second\n" 314 msg111 =
" name to the same object usually causes confusion and problems.\n" 315 msg112 =
" 4. Compose Sequences: newName = cms.Sequence(oldName)\n" 316 raise ValueError(msg100+msg101+msg102+msg103+msg104+msg105+msg106+msg107+msg108+msg109+msg110+msg111+msg112)
317 object.setLabel(
None)
318 object.setLabel(newLabel)
322 if not name.replace(
'_',
'').isalnum():
323 raise ValueError(
'The label '+name+
' contains forbiden characters')
326 if name.startswith(
'_Process__'):
327 self.__dict__[name]=value
329 if not isinstance(value,_ConfigureComponent):
330 raise TypeError(
"can only assign labels to an object that inherits from '_ConfigureComponent'\n" 331 +
"an instance of "+
str(type(value))+
" will not work - requested label is "+name)
332 if not isinstance(value,_Labelable)
and not isinstance(value,Source)
and not isinstance(value,Looper)
and not isinstance(value,Schedule):
333 if name == value.type_():
338 raise TypeError(
"an instance of "+
str(type(value))+
" can not be assigned the label '"+name+
"'.\n"+
339 "Please either use the label '"+value.type_()+
" or use the 'add_' method instead.")
342 newValue =value.copy()
344 newValue._filename = value._filename
350 if not self.
_okToPlace(name, value, self.__dict__):
351 newFile=
'top level config' 352 if hasattr(value,
'_filename'):
353 newFile = value._filename
354 oldFile=
'top level config' 355 oldValue = getattr(self,name)
356 if hasattr(oldValue,
'_filename'):
357 oldFile = oldValue._filename
358 msg =
"Trying to override definition of process."+name
359 msg +=
"\n new object defined in: "+newFile
360 msg +=
"\n existing object defined in: "+oldFile
361 raise ValueError(msg)
363 if hasattr(self,name)
and not (getattr(self,name)==newValue):
367 if newValue._isTaskComponent():
368 if not self.__InExtendCall:
372 if not isinstance(newValue, Task):
374 newFile=
'top level config' 375 if hasattr(value,
'_filename'):
376 newFile = value._filename
377 oldFile=
'top level config' 378 oldValue = getattr(self,name)
379 if hasattr(oldValue,
'_filename'):
380 oldFile = oldValue._filename
381 msg1 =
"Trying to override definition of "+name+
" while it is used by the task " 382 msg2 =
"\n new object defined in: "+newFile
383 msg2 +=
"\n existing object defined in: "+oldFile
386 raise ValueError(msg1+s.label_()+msg2)
388 if isinstance(newValue, _Sequenceable)
or newValue._isTaskComponent():
389 if not self.__InExtendCall:
393 newFile=
'top level config' 394 if hasattr(value,
'_filename'):
395 newFile = value._filename
396 oldFile=
'top level config' 397 oldValue = getattr(self,name)
398 if hasattr(oldValue,
'_filename'):
399 oldFile = oldValue._filename
400 msg1 =
"Trying to override definition of "+name+
" while it is used by the " 401 msg2 =
"\n new object defined in: "+newFile
402 msg2 +=
"\n existing object defined in: "+oldFile
405 raise ValueError(msg1+
"sequence "+s.label_()+msg2)
408 raise ValueError(msg1+
"path "+s.label_()+msg2)
411 raise ValueError(msg1+
"endpath "+s.label_()+msg2)
413 self.__dict__[name]=newValue
414 if isinstance(newValue,_Labelable):
416 self._cloneToObjectDict[
id(value)] = newValue
417 self._cloneToObjectDict[
id(newValue)] = newValue
419 newValue._place(name,self)
421 """Given a container of sequences or tasks, find the first sequence or task 422 containing mod and return it. If none is found, return None""" 425 for seqOrTask
in six.itervalues(seqsOrTasks):
434 if not hasattr(self,name):
435 raise KeyError(
'process does not know about '+name)
436 elif name.startswith(
'_Process__'):
437 raise ValueError(
'this attribute cannot be deleted')
440 dicts = [item
for item
in self.__dict__.values()
if (isinstance(item, dict)
or isinstance(item,
DictTypes.SortedKeysDict))]
442 if name
in reg: del reg[name]
444 obj = getattr(self,name)
445 if isinstance(obj,_Labelable):
447 if isinstance(obj,Service):
448 obj._inProcess =
False 452 obj = getattr(self,name)
454 if not isinstance(obj, Sequence)
and not isinstance(obj, Task):
464 if obj._isTaskComponent():
467 if isinstance(obj, _Sequenceable)
or obj._isTaskComponent():
471 del self.__dict__[name]
476 """Similar to __delattr__ but we need different behavior when called from __setattr__""" 480 del self.__dict__[name]
485 """Allows addition of components that do not have to have a label, e.g. Services""" 486 if not isinstance(value,_ConfigureComponent):
488 if not isinstance(value,_Unlabelable):
493 newValue =value.copy()
497 newValue._place(
'',self)
500 if not self.__InExtendCall:
511 if d[name]._isModified:
522 if self.
__isStrict and isinstance(mod, _ModuleSequenceType):
523 d[name] = mod._postProcessFixup(self._cloneToObjectDict)
526 if isinstance(mod,_Labelable):
529 self.
_place(name, mod, self.__outputmodules)
531 self.
_place(name, mod, self.__producers)
533 self.
_place(name, mod, self.__switchproducers)
535 self.
_place(name, mod, self.__filters)
537 self.
_place(name, mod, self.__analyzers)
541 self.
_place(name, mod, self.__paths)
542 except ModuleCloneError
as msg:
544 raise Exception(
"%sThe module %s in path %s is unknown to the process %s." %(context, msg, name, self._Process__name))
548 self.
_place(name, mod, self.__endpaths)
549 except ModuleCloneError
as msg:
551 raise Exception(
"%sThe module %s in endpath %s is unknown to the process %s." %(context, msg, name, self._Process__name))
554 self.
_place(name, mod, self.__sequences)
556 self.
_place(name, mod, self.__esproducers)
558 self.
_place(name, mod, self.__esprefers)
560 self.
_place(name, mod, self.__essources)
563 self.
_place(name, task, self.__tasks)
565 self.
_place(name, mod, self.__aliases)
567 self.
_place(name, mod, self.__psets)
569 self.
_place(name, mod, self.__vpsets)
571 """Allow the source to be referenced by 'source' or by type name""" 573 raise ValueError(
"The label '"+name+
"' can not be used for a Source. Only 'source' is allowed.")
574 if self.__dict__[
'_Process__source']
is not None :
575 del self.__dict__[self.__dict__[
'_Process__source'].type_()]
576 self.__dict__[
'_Process__source'] = mod
577 self.__dict__[mod.type_()] = mod
580 raise ValueError(
"The label '"+name+
"' can not be used for a Looper. Only 'looper' is allowed.")
581 self.__dict__[
'_Process__looper'] = mod
582 self.__dict__[mod.type_()] = mod
584 self.__dict__[
'_Process__subProcess'] = mod
585 self.__dict__[mod.type_()] = mod
587 self.__subProcesses.append(mod)
589 self.
_place(typeName, mod, self.__services)
590 if typeName
in self.__dict__:
591 self.__dict__[typeName]._inProcess =
False 592 self.__dict__[typeName]=mod
594 moduleName = moduleName.replace(
"/",
".")
595 module = __import__(moduleName)
596 self.
extend(sys.modules[moduleName])
598 """Look in other and find types that we can use""" 600 self.__dict__[
'_Process__InExtendCall'] =
True 603 tasksToAttach =
dict()
605 for name
in dir(other):
607 if name.startswith(
'_'):
609 item = getattr(other,name)
610 if name ==
"source" or name ==
"looper":
614 elif isinstance(item,_ModuleSequenceType):
616 elif isinstance(item,Task):
617 tasksToAttach[name] = item
618 elif isinstance(item,_Labelable):
620 if not item.hasLabel_() :
622 elif isinstance(item,Schedule):
624 elif isinstance(item,_Unlabelable):
626 elif isinstance(item,ProcessModifier):
628 elif isinstance(item,ProcessFragment):
632 for name,seq
in six.iteritems(seqs):
633 if id(seq)
not in self._cloneToObjectDict:
636 newSeq = self._cloneToObjectDict[
id(seq)]
637 self.__dict__[name]=newSeq
640 newSeq._place(name,self)
642 for name, task
in six.iteritems(tasksToAttach):
649 self.__dict__[
'_Process__InExtendCall'] =
False 653 for name,item
in items:
654 returnValue +=options.indentation()+typeName+
' '+name+
' = '+item.dumpConfig(options)
658 for name,item
in items:
659 returnValue +=options.indentation()+typeName+
' = '+item.dumpConfig(options)
663 for name,item
in items:
664 if name == item.type_():
666 returnValue +=options.indentation()+typeName+
' '+name+
' = '+item.dumpConfig(options)
669 """return a string containing the equivalent process defined using the old configuration language""" 670 config =
"process "+self.__name+
" = {\n" 719 for name,item
in six.iteritems(self.
psets):
720 config +=options.indentation()+item.configTypeName()+
' '+name+
' = '+item.configValue(options)
721 for name,item
in six.iteritems(self.
vpsets):
722 config +=options.indentation()+
'VPSet '+name+
' = '+item.configValue(options)
724 pathNames = [p.label_()
for p
in self.
schedule]
725 config +=options.indentation()+
'schedule = {'+
','.
join(pathNames)+
'}\n' 736 result +=options.indentation()+
'es_prefer '+item.targetLabel_()+
' = '+item.dumpConfig(options)
741 returnValue += item.dumpPython(options)+
'\n\n' 746 for name,item
in d.items():
747 returnValue +=
'process.'+name+
' = '+item.dumpPython(options)+
'\n\n' 749 for name,item
in sorted(d.items()):
750 returnValue +=
'process.'+name+
' = '+item.dumpPython(options)+
'\n\n' 757 sequence.visit(visitor)
759 raise RuntimeError(
"An entry in sequence "+label +
' has no label')
767 raise RuntimeError(
"An entry in task " + label +
' has not been attached to the process')
778 for label,item
in six.iteritems(processDictionaryOfItems):
780 if isinstance(item, Task):
787 if isinstance(item, Task):
788 raise RuntimeError(
"Failed in a Task visitor. Probably " \
789 "a circular dependency discovered in Task with label " + label)
791 raise RuntimeError(
"Failed in a Sequence visitor. Probably a " \
792 "circular dependency discovered in Sequence with label " + label)
793 for containedItem
in containedItems:
799 if containedItem.hasLabel_():
800 testItem = processDictionaryOfItems.get(containedItem.label_())
801 if testItem
is None or containedItem != testItem:
802 if isinstance(item, Task):
803 raise RuntimeError(
"Task has a label, but using its label to get an attribute" \
804 " from the process yields a different object or None\n"+
805 "label = " + containedItem.label_())
807 raise RuntimeError(
"Sequence has a label, but using its label to get an attribute" \
808 " from the process yields a different object or None\n"+
809 "label = " + containedItem.label_())
810 dependencies[label]=[dep.label_()
for dep
in containedItems
if dep.hasLabel_()]
814 oldDeps =
dict(dependencies)
815 for label,deps
in six.iteritems(oldDeps):
817 returnValue[label]=processDictionaryOfItems[label]
819 del dependencies[label]
820 for lb2,deps2
in six.iteritems(dependencies):
821 while deps2.count(label):
826 for name, value
in sorted(six.iteritems(d)):
827 result += value.dumpPythonAs(name,options)+
'\n' 830 """return a string containing the equivalent process defined using python""" 831 specialImportRegistry._reset()
832 header =
"import FWCore.ParameterSet.Config as cms" 833 result =
"process = cms.Process(\""+self.__name+
"\")\n\n" 856 result +=
'process.schedule = ' + self.schedule.dumpPython(options)
857 imports = specialImportRegistry.getSpecialImports()
859 header +=
"\n" +
"\n".
join(imports)
863 old = getattr(self,label)
865 for sequenceable
in six.itervalues(self.
sequences):
866 sequenceable.replace(old,new)
867 for sequenceable
in six.itervalues(self.
paths):
868 sequenceable.replace(old,new)
869 for sequenceable
in six.itervalues(self.
endpaths):
870 sequenceable.replace(old,new)
872 old = getattr(self,label)
873 for task
in six.itervalues(self.
tasks):
874 task.replace(old, new)
878 old = getattr(self,label)
880 task.replace(old, new)
882 """ Replace the item with label 'label' by object 'new' in the process and all sequences/paths/tasks""" 883 if not hasattr(self,label):
884 raise LookupError(
"process has no item of label "+label)
885 setattr(self,label,new)
887 for name,value
in six.iteritems(itemDict):
888 value.insertInto(parameterSet, name)
892 newlabel = item.nameInProcessDesc_(label)
894 item.insertInto(parameterSet, newlabel)
895 parameterSet.addVString(tracked, label, vitems)
898 for name,value
in six.iteritems(itemDict):
899 value.appendToProcessDescList_(l, name)
900 value.insertInto(parameterSet, name)
903 parameterSet.addVString(tracked, label, l)
905 modules = parameterSet.getVString(tracked, labelModules)
906 aliases = parameterSet.getVString(tracked, labelAliases)
907 for name,value
in six.iteritems(itemDict):
908 value.appendToProcessDescLists_(modules, aliases, name)
909 value.insertInto(parameterSet, name)
912 parameterSet.addVString(tracked, labelModules, modules)
913 parameterSet.addVString(tracked, labelAliases, aliases)
917 for value
in itemList:
918 name = value.getProcessName()
919 newLabel = value.nameInProcessDesc_(name)
921 pset = value.getSubProcessPSet(parameterSet)
922 subprocs.append(pset)
925 parameterSet.addVString(tracked, label, l)
926 parameterSet.addVPSet(
False,
"subProcesses",subprocs)
933 for name
in self.
paths_():
934 scheduledPaths.append(name)
935 triggerPaths.append(name)
937 scheduledPaths.append(name)
938 endpaths.append(name)
941 pathname = path.label_()
942 scheduledPaths.append(pathname)
944 endpaths.append(pathname)
946 triggerPaths.append(pathname)
948 task.resolve(self.__dict__)
950 task.visit(scheduleTaskValidator)
951 task.visit(nodeVisitor)
952 processPSet.addVString(
True,
"@end_paths", endpaths)
953 processPSet.addVString(
True,
"@paths", scheduledPaths)
955 p = processPSet.newPSet()
956 p.addVString(
True,
"@trigger_paths", triggerPaths)
957 processPSet.addPSet(
True,
"@trigger_paths", p)
964 endpathCompositeVisitor =
CompositeVisitor(endpathValidator, nodeVisitor, lister)
965 for triggername
in triggerPaths:
966 iPath = self.
paths_()[triggername]
967 iPath.resolve(self.__dict__)
968 pathValidator.setLabel(triggername)
970 iPath.visit(pathCompositeVisitor)
971 iPath.insertInto(processPSet, triggername, decoratedList)
972 for endpathname
in endpaths:
974 iEndPath.resolve(self.__dict__)
975 endpathValidator.setLabel(endpathname)
977 iEndPath.visit(endpathCompositeVisitor)
978 iEndPath.insertInto(processPSet, endpathname, decoratedList)
979 processPSet.addVString(
False,
"@filters_on_endpaths", endpathValidator.filtersOnEndpaths)
981 def resolve(self,keepUnresolvedSequencePlaceholders=False):
982 for x
in six.itervalues(self.
paths):
983 x.resolve(self.__dict__,keepUnresolvedSequencePlaceholders)
984 for x
in six.itervalues(self.
endpaths):
985 x.resolve(self.__dict__,keepUnresolvedSequencePlaceholders)
988 task.resolve(self.__dict__,keepUnresolvedSequencePlaceholders)
990 def prune(self,verbose=False,keepUnresolvedSequencePlaceholders=False):
991 """ Remove clutter from the process that we think is unnecessary: 992 tracked PSets, VPSets and unused modules and sequences. If a Schedule has been set, then Paths and EndPaths 993 not in the schedule will also be removed, along with an modules and sequences used only by 994 those removed Paths and EndPaths.""" 1003 self.
resolve(keepUnresolvedSequencePlaceholders)
1005 unneededPaths = set()
1007 usedModules=set(self.
schedule_().moduleNames())
1009 schedNames = set(( x.label_()
for x
in self.
schedule_()))
1010 names = set(self.
paths)
1012 unneededPaths = names - schedNames
1013 for n
in unneededPaths:
1017 pths.extend(six.itervalues(self.
endpaths))
1019 usedModules=set(temp.moduleNames())
1027 for p
in six.itervalues(self.
paths):
1029 for p
in six.itervalues(self.
endpaths):
1031 keepSeqSet = set(( s
for s
in seqs
if s.hasLabel_()))
1032 availableSeqs = set(six.itervalues(self.
sequences))
1033 unneededSeqs = availableSeqs-keepSeqSet
1034 unneededSeqLabels = []
1035 for s
in unneededSeqs:
1036 unneededSeqLabels.append(s.label_())
1037 delattr(self,s.label_())
1039 print(
"prune removed the following:")
1040 print(
" modules:"+
",".
join(unneededModules))
1041 print(
" sequences:"+
",".
join(unneededSeqLabels))
1042 print(
" paths/endpaths:"+
",".
join(unneededPaths))
1044 moduleNames = set(d.keys())
1045 junk = moduleNames - scheduledNames
1051 """Used by the framework to convert python to C++ objects""" 1052 class ServiceInjectorAdaptor(
object):
1056 def addService(self,pset):
1057 self.__thelist.append(pset)
1059 return self.__processPSet.newPSet()
1063 class TopLevelPSetAcessorAdaptor(
object):
1067 def __getattr__(self,attr):
1068 return getattr(self.
__ppset,attr)
1069 def getTopPSet_(self,label):
1072 return TopLevelPSetAcessorAdaptor(self.__ppset.newPSet(),self.
__process)
1073 def addPSet(self,tracked,name,ppset):
1074 return self.__ppset.addPSet(tracked,name,self.__extractPSet(ppset))
1075 def addVPSet(self,tracked,name,vpset):
1076 return self.__ppset.addVPSet(tracked,name,[self.__extractPSet(x)
for x
in vpset])
1077 def __extractPSet(self,pset):
1078 if isinstance(pset,TopLevelPSetAcessorAdaptor):
1083 processPSet.addString(
True,
"@process_name", self.
name_())
1085 all_modules.update(self.
filters_())
1088 adaptor = TopLevelPSetAcessorAdaptor(processPSet,self)
1101 all_modules_onTasksOrScheduled = { key:value
for key, value
in six.iteritems(all_modules)
if value
in nodeVisitor.modules }
1102 self.
_insertManyInto(adaptor,
"@all_modules", all_modules_onTasksOrScheduled,
True)
1104 all_switches_onTasksOrScheduled = {key:value
for key, value
in six.iteritems(all_switches)
if value
in nodeVisitor.modules }
1109 for pTask
in six.itervalues(self.
tasks):
1110 pTask.visit(processNodeVisitor)
1111 esProducersToEnable = {}
1112 for esProducerName, esProducer
in six.iteritems(self.
es_producers_()):
1113 if esProducer
in nodeVisitor.esProducers
or not (esProducer
in processNodeVisitor.esProducers):
1114 esProducersToEnable[esProducerName] = esProducer
1115 self.
_insertManyInto(adaptor,
"@all_esmodules", esProducersToEnable,
True)
1116 esSourcesToEnable = {}
1117 for esSourceName, esSource
in six.iteritems(self.
es_sources_()):
1118 if esSource
in nodeVisitor.esSources
or not (esSource
in processNodeVisitor.esSources):
1119 esSourcesToEnable[esSourceName] = esSource
1120 self.
_insertManyInto(adaptor,
"@all_essources", esSourcesToEnable,
True)
1123 for serviceName, serviceObject
in six.iteritems(self.
services_()):
1124 if serviceObject
in nodeVisitor.services
or not (serviceObject
in processNodeVisitor.services):
1125 serviceObject.insertInto(ServiceInjectorAdaptor(adaptor,services))
1126 adaptor.addVPSet(
False,
"services",services)
1137 """Prefer this ES source or producer. The argument can 1138 either be an object label, e.g., 1139 process.prefer(process.juicerProducer) (not supported yet) 1140 or a name of an ESSource or ESProducer 1141 process.prefer("juicer") 1142 or a type of unnamed ESSource or ESProducer 1143 process.prefer("JuicerProducer") 1144 In addition, you can pass as a labelled arguments the name of the Record you wish to 1145 prefer where the type passed is a cms.vstring and that vstring can contain the 1146 name of the C++ types in the Record that are being preferred, e.g., 1147 #prefer all data in record 'OrangeRecord' from 'juicer' 1148 process.prefer("juicer", OrangeRecord=cms.vstring()) 1150 #prefer only "Orange" data in "OrangeRecord" from "juicer" 1151 process.prefer("juicer", OrangeRecord=cms.vstring("Orange")) 1153 #prefer only "Orange" data with label "ExtraPulp" in "OrangeRecord" from "juicer" 1154 ESPrefer("ESJuicerProd", OrangeRecord=cms.vstring("Orange/ExtraPulp")) 1157 if isinstance(esmodule, ESSource)
or isinstance(esmodule, ESProducer):
1158 raise RuntimeError(
"Syntax of process.prefer(process.esmodule) not supported yet")
1159 elif self._findPreferred(esmodule, self.es_producers_(),*args,**kargs)
or \
1160 self._findPreferred(esmodule, self.es_sources_(),*args,**kargs):
1163 raise RuntimeError(
"Cannot resolve prefer for "+repr(esmodule))
1168 typ = d[esname].type_()
1177 for name, value
in six.iteritems(d):
1178 if value.type_() == esname:
1180 raise RuntimeError(
"More than one ES module for "+esname)
1188 if isinstance(process, Process):
1190 elif isinstance(process, str):
1193 raise TypeError(
'a ProcessFragment can only be constructed from an existig Process or from process name')
1195 return [ x
for x
in dir(self.
__process)
if isinstance(getattr(self.
__process, x), _ConfigureComponent) ]
1197 if name ==
'_ProcessFragment__process':
1198 return object.__getattribute__(self,
'_ProcessFragment__process')
1202 if name ==
'_ProcessFragment__process':
1203 object.__setattr__(self, name, value)
1207 if name ==
'_ProcessFragment__process':
1214 """a dictionary with fixed keys""" 1216 raise AttributeError(
"An FilteredStream defintion cannot be modified after creation.")
1217 _blocked_attribute = property(_blocked_attribute)
1218 __setattr__ = __delitem__ = __setitem__ = clear = _blocked_attribute
1219 pop = popitem = setdefault = update = _blocked_attribute
1221 new = dict.__new__(cls)
1222 dict.__init__(new, *args, **kw)
1223 keys = sorted(kw.keys())
1224 if keys != [
'content',
'dataTier',
'name',
'paths',
'responsible',
'selectEvents']:
1225 raise ValueError(
"The needed parameters are: content, dataTier, name, paths, responsible, selectEvents")
1226 if not isinstance(kw[
'name'],str):
1227 raise ValueError(
"name must be of type string")
1228 if not isinstance(kw[
'content'], vstring)
and not isinstance(kw[
'content'],str):
1229 raise ValueError(
"content must be of type vstring or string")
1230 if not isinstance(kw[
'dataTier'], string):
1231 raise ValueError(
"dataTier must be of type string")
1232 if not isinstance(kw[
'selectEvents'], PSet):
1233 raise ValueError(
"selectEvents must be of type PSet")
1234 if not isinstance(kw[
'paths'],(tuple, Path)):
1235 raise ValueError(
"'paths' must be a tuple of paths")
1240 return "FilteredStream object: %s" %self[
"name"]
1245 """Allows embedding another process within a parent process. This allows one to 1246 chain processes together directly in one cmsRun job rather than having to run 1247 separate jobs that are connected via a temporary file. 1249 def __init__(self,process, SelectEvents = untracked.PSet(), outputCommands = untracked.vstring()):
1252 if not isinstance(process, Process):
1253 raise ValueError(
"the 'process' argument must be of type cms.Process")
1254 if not isinstance(SelectEvents,PSet):
1255 raise ValueError(
"the 'SelectEvents' argument must be of type cms.untracked.PSet")
1256 if not isinstance(outputCommands,vstring):
1257 raise ValueError(
"the 'outputCommands' argument must be of type cms.untracked.vstring")
1262 out =
"parentProcess"+
str(
hash(self))+
" = process\n" 1263 out += self.__process.dumpPython()
1264 out +=
"childProcess = process\n" 1265 out +=
"process = parentProcess"+
str(
hash(self))+
"\n" 1266 out +=
"process.addSubProcess(cms.SubProcess(process = childProcess, SelectEvents = "+self.__SelectEvents.dumpPython(options) +
", outputCommands = "+self.__outputCommands.dumpPython(options) +
"))" 1269 return self.__process.name_()
1281 process._placeSubProcess(
'subProcess',self)
1283 topPSet = parameterSet.newPSet()
1284 self.__process.fillProcessDesc(topPSet)
1285 subProcessPSet = parameterSet.newPSet()
1286 self.__SelectEvents.insertInto(subProcessPSet,
"SelectEvents")
1287 self.__outputCommands.insertInto(subProcessPSet,
"outputCommands")
1288 subProcessPSet.addPSet(
False,
"process",topPSet)
1289 return subProcessPSet
1292 """Helper class for Modifier that takes key/value pairs and uses them to reset parameters of the object""" 1297 for k
in six.iterkeys(self.
__args):
1299 params[k] = getattr(obj,k)
1301 for k
in six.iterkeys(self.
__args):
1303 setattr(obj,k,params[k])
1309 raise KeyError(
"Unknown parameter name "+key+
" specified while calling Modifier")
1312 """A helper base class for _AndModifier, _InvertModifier, and _OrModifier to contain the common code""" 1318 Modifier._toModifyCheck(obj,func,**kw)
1319 if not self._isChosen():
1321 Modifier._toModify(obj,func,**kw)
1323 Modifier._toReplaceWithCheck(toObj,fromObj)
1324 if not self._isChosen():
1326 Modifier._toReplaceWith(toObj,fromObj)
1328 """This is used to create a ProcessModifer that can perform actions on the process as a whole. 1329 This takes as argument a callable object (e.g. function) that takes as its sole argument an instance of Process. 1330 In order to work, the value returned from this function must be assigned to a uniquely named variable.""" 1340 """A modifier which only applies if multiple Modifiers are chosen""" 1342 super(_AndModifier,self).
__init__(lhs, rhs)
1344 return self._lhs._isChosen()
and self._rhs._isChosen()
1347 """A modifier which only applies if a Modifier is not chosen""" 1349 super(_InvertModifier,self).
__init__(lhs)
1351 return not self._lhs._isChosen()
1354 """A modifier which only applies if at least one of multiple Modifiers is chosen""" 1356 super(_OrModifier,self).
__init__(lhs, rhs)
1358 return self._lhs._isChosen()
or self._rhs._isChosen()
1362 """This class is used to define standard modifications to a Process. 1363 An instance of this class is declared to denote a specific modification,e.g. era2017 could 1364 reconfigure items in a process to match our expectation of running in 2017. Once declared, 1365 these Modifier instances are imported into a configuration and items that need to be modified 1366 are then associated with the Modifier and with the action to do the modification. 1367 The registered modifications will only occur if the Modifier was passed to 1368 the cms.Process' constructor. 1374 """This is used to create a ProcessModifer that can perform actions on the process as a whole. 1375 This takes as argument a callable object (e.g. function) that takes as its sole argument an instance of Process. 1376 In order to work, the value returned from this function must be assigned to a uniquely named variable. 1381 if func
is not None and len(kw) != 0:
1382 raise TypeError(
"toModify takes either two arguments or one argument and key/value pairs")
1384 """This is used to register an action to be performed on the specific object. Two different forms are allowed 1385 Form 1: A callable object (e.g. function) can be passed as the second. This callable object is expected to take one argument 1386 that will be the object passed in as the first argument. 1387 Form 2: A list of parameter name, value pairs can be passed 1388 mod.toModify(foo, fred=cms.int32(7), barney = cms.double(3.14)) 1389 This form can also be used to remove a parameter by passing the value of None 1390 #remove the parameter foo.fred 1391 mod.toModify(foo, fred = None) 1392 Additionally, parameters embedded within PSets can also be modified using a dictionary 1393 #change foo.fred.pebbles to 3 and foo.fred.friend to "barney" 1394 mod.toModify(foo, fred = dict(pebbles = 3, friend = "barney)) ) 1396 Modifier._toModifyCheck(obj,func,**kw)
1399 Modifier._toModify(obj,func,**kw)
1402 if func
is not None:
1409 if not isinstance(fromObj, type(toObj)):
1410 raise TypeError(
"toReplaceWith requires both arguments to be the same class type")
1412 """If the Modifier is chosen the internals of toObj will be associated with the internals of fromObj 1414 Modifier._toReplaceWithCheck(toObj,fromObj)
1417 Modifier._toReplaceWith(toObj,fromObj)
1420 if isinstance(fromObj,_ModuleSequenceType):
1421 toObj._seq = fromObj._seq
1422 toObj._tasks = fromObj._tasks
1423 elif isinstance(fromObj,Task):
1424 toObj._collection = fromObj._collection
1425 elif isinstance(fromObj,_Parameterizable):
1427 for p
in toObj.parameterNames_():
1429 for p
in fromObj.parameterNames_():
1430 setattr(toObj,p,getattr(fromObj,p))
1431 if isinstance(fromObj,_TypedParameterizable):
1432 toObj._TypedParameterizable__type = fromObj._TypedParameterizable__type
1435 raise TypeError(
"toReplaceWith does not work with type "+
str(type(toObj)))
1438 """Should only be called by cms.Process instances""" 1449 return self == other
1453 """A Modifier made up of a list of Modifiers 1459 """Should only be called by cms.Process instances 1460 applies list of accumulated changes to the process""" 1462 m._applyNewProcessModifiers(process)
1464 """Should only be called by cms.Process instances""" 1471 """Creates a new ModifierChain which is a copy of 1472 this ModifierChain but excludes any Modifier or 1473 ModifierChain in the list toExclude. 1474 The exclusion is done recursively down the chain. 1478 if m
not in toExclude:
1480 if isinstance(m,ModifierChain):
1481 s = m.__copyIfExclude(toExclude)
1497 if m._isOrContains(other):
1502 """A class used by a Modifier to affect an entire Process instance. 1503 When a Process 'loads' a module containing a ProcessModifier, that 1504 ProcessModifier will be applied to the Process if and only if the 1505 Modifier passed to the constructor has been chosen. 1512 if self.__modifier._isChosen():
1515 self.__seenProcesses.add(process)
1517 if __name__==
"__main__":
1522 """Has same interface as the C++ object that creates PSets 1527 self.
values[label]=(tracked,value)
1529 pair = self.
values[label]
1530 if pair[0] != tracked:
1531 raise Exception(
"Asked for %s parameter '%s', but it is %s" % (
"tracked" if tracked
else "untracked",
1533 "tracked" if pair[0]
else "untracked"))
1594 super(SwitchProducerTest,self).
__init__(
1596 test1 =
lambda: (
True, -10),
1597 test2 =
lambda: (
True, -9),
1598 test3 =
lambda: (
True, -8),
1599 test4 =
lambda: (
True, -7)
1601 specialImportRegistry.registerSpecialImportForType(SwitchProducerTest,
"from test import SwitchProducerTest")
1605 """Nothing to do """ 1609 self.assertEqual(len(p.parameterNames_()),0)
1611 self.assert_(
'a' in p.parameterNames_())
1612 self.assertEqual(p.a.value(), 1)
1614 self.assertEqual(p.a.value(), 10)
1615 p.a = untracked(
int32(1))
1616 self.assertEqual(p.a.value(), 1)
1617 self.failIf(p.a.isTracked())
1618 p.a = untracked.int32(1)
1619 self.assertEqual(p.a.value(), 1)
1620 self.failIf(p.a.isTracked())
1622 self.assertEqual(p.foo.value(), 10)
1623 self.assertEqual(p.bar.value(),1.0)
1624 self.failIf(p.bar.isTracked())
1625 self.assertRaises(TypeError,setattr,(p,
'c',1))
1627 self.assertEqual(p.a.foo.value(),10)
1628 self.assertEqual(p.a.bar.value(),1.0)
1630 self.assertEqual(p.b.fii.value(),1)
1631 self.failIf(p.b.isTracked())
1636 self.assertEqual(p.a.value(),11)
1638 self.assertEqual(p.a.value(),12)
1639 self.assertEqual(v.value(),12)
1645 self.assertNotEqual(p.b,other.b)
1650 self.assert_(
'a' in p.analyzers_() )
1651 self.assert_(
'a' in p.analyzers)
1652 p.add_(
Service(
"MessageLogger"))
1653 self.assert_(
'MessageLogger' in p.services_())
1654 self.assertEqual(p.MessageLogger.type_(),
"MessageLogger")
1656 self.assert_(
'Tracer' in p.services_())
1657 self.assertRaises(TypeError, setattr, *(p,
'b',
"this should fail"))
1658 self.assertRaises(TypeError, setattr, *(p,
'bad',
Service(
"MessageLogger")))
1659 self.assertRaises(ValueError, setattr, *(p,
'bad',
Source(
"PoolSource")))
1661 self.assertEqual(p.out.type_(),
'Outer')
1662 self.assert_(
'out' in p.outputModules_() )
1665 self.assert_(
'geom' in p.es_sources_())
1667 self.assert_(
'ConfigDB' in p.es_sources_())
1670 self.assert_(
'aliasfoo1' in p.aliases_())
1674 def __init__(self,*arg,**args):
1675 for name
in six.iterkeys(args):
1676 self.__dict__[name]=args[name]
1695 self.assertEqual(p.a.type_(),
"MyAnalyzer")
1696 self.assertEqual(p.a.label_(),
"a")
1697 self.assertRaises(AttributeError,getattr,p,
'b')
1698 self.assertEqual(p.Full.type_(),
"Full")
1699 self.assertEqual(
str(p.c),
'a')
1700 self.assertEqual(
str(p.d),
'a')
1715 self.assertRaises(ValueError, p1.extend, z1)
1724 aaa=copy.deepcopy(a),
1725 s4=copy.deepcopy(s3),
1732 self.assertEqual(p2.s4.label_(),
"s4")
1734 self.assertRaises(ValueError, p2.s4.setLabel,
"foo")
1735 p2.s4.setLabel(
"s4")
1736 p2.s4.setLabel(
None)
1737 p2.s4.setLabel(
"foo")
1738 p2._Process__setObjectLabel(p2.s4,
"foo")
1739 p2._Process__setObjectLabel(p2.s4,
None)
1740 p2._Process__setObjectLabel(p2.s4,
"bar")
1752 """import FWCore.ParameterSet.Config as cms 1754 process = cms.Process("test") 1756 process.a = cms.EDAnalyzer("MyAnalyzer") 1759 process.s = cms.Sequence(process.a) 1762 process.r = cms.Sequence(process.s) 1765 process.p = cms.Path(process.a) 1768 process.p2 = cms.Path(process.s) 1771 process.schedule = cms.Schedule(*[ process.p2, process.p ]) 1784 """import FWCore.ParameterSet.Config as cms 1786 process = cms.Process("test") 1788 process.a = cms.EDAnalyzer("MyAnalyzer") 1791 process.b = cms.EDAnalyzer("YourAnalyzer") 1794 process.r = cms.Sequence(process.a) 1797 process.s = cms.Sequence(process.r) 1800 process.p = cms.Path(process.a) 1803 process.p2 = cms.Path(process.r) 1806 process.schedule = cms.Schedule(*[ process.p2, process.p ]) 1818 """import FWCore.ParameterSet.Config as cms 1820 process = cms.Process("test") 1822 process.a = cms.EDAnalyzer("MyAnalyzer") 1825 process.r = cms.Sequence((process.a)) 1828 process.p = cms.Path(process.a) 1831 process.p2 = cms.Path(process.r) 1834 process.schedule = cms.Schedule(*[ process.p2, process.p ]) 1848 p.task2 =
Task(p.c, p.task3)
1849 p.task4 =
Task(p.f, p.task2)
1850 p.task1 =
Task(p.task5)
1851 p.task3.add(p.task1)
1855 p.p2 =
Path(p.r, p.task1, p.task2)
1856 p.schedule =
Schedule(p.p2,p.p,tasks=[p.task3,p.task4, p.task5])
1859 """import FWCore.ParameterSet.Config as cms 1861 process = cms.Process("test") 1863 process.b = cms.EDProducer("bProducer") 1866 process.c = cms.EDProducer("cProducer") 1869 process.d = cms.EDProducer("dProducer") 1872 process.e = cms.EDProducer("eProducer") 1875 process.f = cms.EDProducer("fProducer") 1878 process.g = cms.EDProducer("gProducer") 1881 process.a = cms.EDAnalyzer("MyAnalyzer") 1884 process.task5 = cms.Task() 1887 process.task1 = cms.Task(process.task5) 1890 process.task3 = cms.Task(process.task1) 1893 process.task2 = cms.Task(process.c, process.task3) 1896 process.task4 = cms.Task(process.f, process.task2) 1899 process.r = cms.Sequence((process.a)) 1902 process.p = cms.Path(process.a) 1905 process.p2 = cms.Path(process.r, process.task1, process.task2) 1908 process.schedule = cms.Schedule(*[ process.p2, process.p ], tasks=[process.task3, process.task4, process.task5]) 1916 p.task1 =
Task(p.d, p.e)
1917 task2 =
Task(p.f, p.g)
1918 p.schedule =
Schedule(tasks=[p.task1,task2])
1921 """import FWCore.ParameterSet.Config as cms 1923 process = cms.Process("test") 1925 process.d = cms.EDProducer("dProducer") 1928 process.e = cms.EDProducer("eProducer") 1931 process.f = cms.EDProducer("fProducer") 1934 process.g = cms.EDProducer("gProducer") 1937 process.task1 = cms.Task(process.d, process.e) 1940 process.schedule = cms.Schedule(tasks=[cms.Task(process.f, process.g), process.task1]) 1947 """import FWCore.ParameterSet.Config as cms 1949 process = cms.Process("test") 1951 process.schedule = cms.Schedule() 1961 d=process.dumpPython()
1963 """import FWCore.ParameterSet.Config as cms 1965 process = cms.Process("DUMP") 1967 process.a = cms.EDProducer("A") 1970 process.s2 = cms.Sequence(process.a) 1983 d=process.dumpPython()
1985 """import FWCore.ParameterSet.Config as cms 1987 process = cms.Process("DUMP") 1989 process.a = cms.EDProducer("A") 1992 process.s2 = cms.Sequence(process.a+(process.a+process.a)) 2000 self.assertEqual(p.dumpPython().
replace(
'\n',
''),
'import FWCore.ParameterSet.Config as cmsprocess = cms.Process("test")process.a = cms.SecSource("MySecSource")')
2020 p.p =
Path(p.c+s+p.a)
2026 self.assertTrue(visitor1.modules == set([old,old2,p.b,p.c]))
2028 p.globalReplace(
"a",new)
2029 p.globalReplace(
"d",new2)
2032 self.assertTrue(visitor2.modules == set([new,new2,p.b,p.c]))
2034 p.e3.visit(visitor3)
2035 self.assertTrue(visitor3.modules == set([new,new2,p.b,p.c]))
2037 p.s4.visit(visitor4)
2038 self.assertTrue(visitor4.modules == set([new,new2,p.b]))
2040 p.t1.visit(visitor5)
2041 self.assertTrue(visitor5.modules == set([new2]))
2043 listOfTasks =
list(p.schedule._tasks)
2044 listOfTasks[0].
visit(visitor6)
2045 self.assertTrue(visitor6.modules == set([new2]))
2053 self.assertEqual(
str(p.s),
'a+b')
2054 self.assertEqual(p.s.label_(),
's')
2055 path =
Path(p.c+p.s)
2056 self.assertEqual(
str(path),
'c+a+b')
2057 p._validateSequence(path,
'p1')
2059 p2 =
Path(p.c+p.s*notInProcess)
2060 self.assertRaises(RuntimeError, p._validateSequence, p2,
'p2')
2070 self.assertRaises(ValueError, p.__setattr__,
"y", testseq)
2074 self.assertFalse(service._inProcess)
2077 self.assertTrue(service._inProcess)
2079 process.d = service2
2080 self.assertFalse(service._inProcess)
2081 self.assertTrue(service2._inProcess)
2083 self.assertFalse(service2._inProcess)
2103 testTask1 =
Task(edproducer, edfilter)
2104 self.assertRaises(RuntimeError, testTask1.add, edanalyzer)
2105 testTask1.add(essource, service)
2106 testTask1.add(essource, esproducer)
2107 testTask1.add(testTask2)
2108 coll = testTask1._collection
2109 self.assertTrue(edproducer
in coll)
2110 self.assertTrue(edfilter
in coll)
2111 self.assertTrue(service
in coll)
2112 self.assertTrue(essource
in coll)
2113 self.assertTrue(esproducer
in coll)
2114 self.assertTrue(testTask2
in coll)
2115 self.assertTrue(len(coll) == 6)
2116 self.assertTrue(len(testTask2._collection) == 0)
2120 taskContents.append(i)
2121 self.assertTrue(taskContents == [edproducer, edfilter, essource, service, esproducer, testTask2])
2126 process.mproducer = edproducer
2127 process.mproducer2 = edproducer2
2128 process.mfilter = edfilter
2129 process.messource = essource
2130 process.mesproducer = esproducer
2133 testTask3 =
Task(edproducer, edproducer2)
2134 testTask1.add(testTask3)
2135 process.myTask1 = testTask1
2142 testTask1.visit(visitor)
2143 self.assertTrue(l == set([
'mesproducer',
'mproducer',
'mproducer2',
'mfilter',
'd',
'messource']))
2144 l2 = testTask1.moduleNames
2145 self.assertTrue(l == set([
'mesproducer',
'mproducer',
'mproducer2',
'mfilter',
'd',
'messource']))
2147 testTask4 =
Task(edproducer3)
2149 self.assertRaises(RuntimeError, testTask4.visit, visitor)
2151 process.myTask4 = testTask4
2152 self.assertTrue(
False)
2153 except RuntimeError:
2156 testTask5 =
Task(service3)
2158 self.assertRaises(RuntimeError, testTask5.visit, visitor)
2160 process.myTask5 = testTask5
2161 self.assertTrue(
False)
2162 except RuntimeError:
2165 process.d = service3
2166 process.myTask5 = testTask5
2169 expectedDict = {
'myTask1' : testTask1,
'myTask5' : testTask5 }
2171 self.assertTrue(process.tasks == expectedFixedDict)
2172 self.assertTrue(process.tasks[
'myTask1'] == testTask1)
2173 self.assertTrue(process.myTask1 == testTask1)
2177 process.mproducer2 = edproducer4
2181 testTask1.visit(visitor1)
2183 expectedList = sorted([edproducer,essource,esproducer,service,edfilter,edproducer,edproducer4])
2184 self.assertTrue(expectedList == l)
2186 process.myTask6 =
Task()
2187 process.myTask7 =
Task()
2188 process.mproducer8 = edproducer8
2189 process.myTask8 =
Task(process.mproducer8)
2190 process.myTask6.add(process.myTask7)
2191 process.myTask7.add(process.myTask8)
2192 process.myTask1.add(process.myTask6)
2193 process.myTask8.add(process.myTask5)
2195 testDict = process._itemsInDependencyOrder(process.tasks)
2196 expectedLabels = [
"myTask5",
"myTask8",
"myTask7",
"myTask6",
"myTask1"]
2197 expectedTasks = [process.myTask5, process.myTask8, process.myTask7, process.myTask6, process.myTask1]
2199 for testLabel, testTask
in testDict.items():
2200 self.assertTrue(testLabel == expectedLabels[index])
2201 self.assertTrue(testTask == expectedTasks[index])
2207 expectedPythonDump =
'cms.Task(process.d, process.mesproducer, process.messource, process.mfilter, process.mproducer, process.mproducer2, process.myTask6)\n' 2208 self.assertTrue(pythonDump == expectedPythonDump)
2210 process.myTask5 =
Task()
2211 process.myTask100 =
Task()
2212 process.mproducer9 = edproducer9
2213 sequence1 =
Sequence(process.mproducer8, process.myTask1, process.myTask5, testTask2, testTask3)
2214 sequence2 =
Sequence(process.mproducer8 + process.mproducer9)
2215 process.sequence3 =
Sequence((process.mproducer8 + process.mfilter))
2217 process.path1 =
Path(process.mproducer+process.mproducer8+sequence1+sequence2+process.sequence3+sequence4)
2218 process.path1.associate(process.myTask1, process.myTask5, testTask2, testTask3)
2219 process.path11 =
Path(process.mproducer+process.mproducer8+sequence1+sequence2+process.sequence3+ sequence4,process.myTask1, process.myTask5, testTask2, testTask3, process.myTask100)
2220 process.path2 =
Path(process.mproducer)
2221 process.path3 =
Path(process.mproducer9+process.mproducer8,testTask2)
2223 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')
2225 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')
2230 process.path1.visit(nameVisitor)
2231 self.assertTrue(l == set([
'mproducer',
'd',
'mesproducer',
None,
'mproducer9',
'mproducer8',
'messource',
'mproducer2',
'mfilter']))
2232 self.assertTrue(process.path1.moduleNames() == set([
'mproducer',
'd',
'mesproducer',
None,
'mproducer9',
'mproducer8',
'messource',
'mproducer2',
'mfilter']))
2236 process.path21 = process.path11.copy()
2237 process.path21.replace(process.mproducer, process.mproducer10)
2239 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')
2248 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')
2250 process.path22 = process.path21.copyAndExclude([process.d, process.mesproducer, process.mfilter])
2251 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')
2253 process.path23 = process.path22.copyAndExclude([process.messource, process.mproducer10])
2254 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')
2263 process.path24 =
Path(process.a+process.b+process.c+process.d)
2264 process.path25 = process.path24.copyAndExclude([process.a,process.b,process.c])
2265 self.assertTrue(process.path25.dumpPython(
None) ==
'cms.Path(process.d)\n')
2270 process.path200.replace(process.c,process.b)
2271 process.path200.replace(process.e,process.f)
2272 self.assertEqual(process.path200.dumpPython(
None),
"cms.EndPath(process.b, cms.Task(process.f))\n")
2273 process.path200.replace(process.b,process.c)
2274 process.path200.replace(process.f,process.e)
2275 self.assertEqual(process.path200.dumpPython(
None),
"cms.EndPath(process.c, cms.Task(process.e))\n")
2276 process.path200.replace(process.c,process.a)
2277 process.path200.replace(process.e,process.g)
2278 self.assertEqual(process.path200.dumpPython(
None),
"cms.EndPath(process.a, cms.Task(process.g))\n")
2279 process.path200.replace(process.a,process.c)
2280 process.path200.replace(process.g,process.e)
2281 self.assertEqual(process.path200.dumpPython(
None),
"cms.EndPath(process.c, cms.Task(process.e))\n")
2292 self.assertEqual(
str(path),
'a+b+c')
2293 path =
Path(p.a*p.b+p.c)
2294 self.assertEqual(
str(path),
'a+b+c')
2297 path =
Path(p.a+ p.b*p.c)
2298 self.assertEqual(
str(path),
'a+b+c')
2299 path =
Path(p.a*(p.b+p.c))
2300 self.assertEqual(
str(path),
'a+b+c')
2301 path =
Path(p.a*(p.b+~p.c))
2303 self.assertEqual(
str(path),
'a+b+~c')
2305 self.assertRaises(TypeError,Path,p.es)
2308 self.assertTrue(t.dumpPython(
PrintOptions()) ==
'cms.Path()\n')
2311 self.assertTrue(t.dumpPython(
PrintOptions()) ==
'cms.Path(process.a)\n')
2314 self.assertTrue(t.dumpPython(
PrintOptions()) ==
'cms.Path(cms.Task())\n')
2317 self.assertTrue(t.dumpPython(
PrintOptions()) ==
'cms.Path(process.a, cms.Task())\n')
2322 self.assertTrue(t.dumpPython(
PrintOptions()) ==
'cms.Path(process.a, cms.Task(), process.t1)\n')
2333 p.path =
Path(p.a*p.b)
2334 lookuptable = {
id(a): p.a,
id(b): p.b}
2338 self.assertEqual(
str(path),
str(p.path))
2359 path =
Path(a * c * seq1, task1)
2361 self.assertTrue(path.contains(a))
2362 self.assertFalse(path.contains(b))
2363 self.assertTrue(path.contains(c))
2364 self.assertFalse(path.contains(d))
2365 self.assertTrue(path.contains(e))
2366 self.assertFalse(path.contains(f))
2367 self.assertTrue(path.contains(g))
2370 self.assertFalse(endpath.contains(b))
2371 self.assertTrue(endpath.contains(i))
2374 self.assertFalse(seq.contains(b))
2375 self.assertTrue(seq.contains(c))
2378 task =
Task(j, k, task2)
2379 self.assertFalse(task.contains(b))
2380 self.assertTrue(task.contains(j))
2381 self.assertTrue(task.contains(k))
2382 self.assertTrue(task.contains(l))
2386 sch =
Schedule(path, path2, tasks=[task,task3])
2387 self.assertFalse(sch.contains(b))
2388 self.assertTrue(sch.contains(a))
2389 self.assertTrue(sch.contains(c))
2390 self.assertTrue(sch.contains(e))
2391 self.assertTrue(sch.contains(g))
2392 self.assertTrue(sch.contains(n))
2393 self.assertTrue(sch.contains(j))
2394 self.assertTrue(sch.contains(k))
2395 self.assertTrue(sch.contains(l))
2396 self.assertTrue(sch.contains(m))
2409 self.assertEqual(s[0],p.path1)
2410 self.assertEqual(s[1],p.path2)
2412 self.assert_(
'b' in p.schedule.moduleNames())
2413 self.assert_(hasattr(p,
'b'))
2414 self.assert_(hasattr(p,
'c'))
2415 self.assert_(hasattr(p,
'd'))
2416 self.assert_(hasattr(p,
'path1'))
2417 self.assert_(hasattr(p,
'path2'))
2418 self.assert_(hasattr(p,
'path3'))
2420 self.assert_(
'b' in p.schedule.moduleNames())
2421 self.assert_(hasattr(p,
'b'))
2422 self.assert_(
not hasattr(p,
'c'))
2423 self.assert_(
not hasattr(p,
'd'))
2424 self.assert_(hasattr(p,
'path1'))
2425 self.assert_(hasattr(p,
'path2'))
2426 self.assert_(
not hasattr(p,
'path3'))
2428 self.assertTrue(len(p.schedule._tasks) == 0)
2442 p.task2 =
Task(p.f, p.Tracer)
2443 s =
Schedule(p.path1,p.path2,tasks=[p.task1,p.task2,p.task1])
2444 self.assertEqual(s[0],p.path1)
2445 self.assertEqual(s[1],p.path2)
2446 self.assertTrue(len(s._tasks) == 2)
2447 self.assertTrue(p.task1
in s._tasks)
2448 self.assertTrue(p.task2
in s._tasks)
2449 listOfTasks =
list(s._tasks)
2450 self.assertTrue(len(listOfTasks) == 2)
2451 self.assertTrue(p.task1 == listOfTasks[0])
2452 self.assertTrue(p.task2 == listOfTasks[1])
2454 self.assert_(
'b' in p.schedule.moduleNames())
2459 process2.path1 =
Path(process2.a)
2460 process2.task1 =
Task(process2.e)
2461 process2.schedule =
Schedule(process2.path1,tasks=process2.task1)
2462 listOfTasks =
list(process2.schedule._tasks)
2463 self.assertTrue(listOfTasks[0] == process2.task1)
2467 self.assertEqual(s2[0],p.path1)
2468 self.assertEqual(s2[1],p.path2)
2469 self.assertTrue(len(s2._tasks) == 2)
2470 self.assertTrue(p.task1
in s2._tasks)
2471 self.assertTrue(p.task2
in s2._tasks)
2472 listOfTasks =
list(s2._tasks)
2473 self.assertTrue(len(listOfTasks) == 2)
2474 self.assertTrue(p.task1 == listOfTasks[0])
2475 self.assertTrue(p.task2 == listOfTasks[1])
2477 names = s.moduleNames()
2478 self.assertTrue(names == set([
'a',
'b',
'e',
'Tracer',
'f']))
2484 self.assertRaises(RuntimeError,
lambda : p.setSchedule_(s) )
2493 self.assert_(
'a' in s.moduleNames())
2494 self.assert_(
'b' in s.moduleNames())
2495 self.assert_(
'c' in s.moduleNames())
2499 self.assert_(
'a' in s.moduleNames())
2500 self.assert_(
'b' in s.moduleNames())
2501 self.assert_(
'c' in s.moduleNames())
2510 self.assert_(p.schedule
is None)
2513 self.assertEqual(pths[keys[0]],p.path1)
2514 self.assertEqual(pths[keys[1]],p.path2)
2516 self.assert_(hasattr(p,
'a'))
2517 self.assert_(hasattr(p,
'b'))
2518 self.assert_(
not hasattr(p,
'c'))
2519 self.assert_(hasattr(p,
'path1'))
2520 self.assert_(hasattr(p,
'path2'))
2529 self.assert_(p.schedule
is None)
2532 self.assertEqual(pths[keys[1]],p.path1)
2533 self.assertEqual(pths[keys[0]],p.path2)
2540 self.assertEqual(p.modu.a.value(),1)
2541 self.assertEqual(p.modu.b.value(),2)
2546 self.assert_(
not a.isModified())
2548 self.assert_(a.isModified())
2550 self.assertEqual(p.a.a1.value(), 1)
2554 self.assertEqual(p.a.a1.value(), 2)
2563 self.assertRaises(ValueError, EDProducer,
'C', ps1, ps2)
2564 self.assertRaises(ValueError, EDProducer,
'C', ps1, a=
int32(3))
2568 p.source =
Source(
"PoolSource",fileNames = untracked(
string(
"file:reco.root")))
2571 p.out =
OutputModule(
"PoolOutputModule",fileName=untracked(
string(
"file:foos.root")))
2572 p.bars.foos =
'Foosball' 2573 self.assertEqual(p.bars.foos,
InputTag(
'Foosball'))
2574 p.p =
Path(p.foos*p.bars)
2576 p.add_(
Service(
"MessageLogger"))
2582 p.prefer(
"ForceSource")
2584 self.assertEqual(p.dumpConfig(),
2586 es_module juicer = JuicerProducer { 2588 es_source = ForceSource { 2590 es_prefer = ForceSource { 2592 es_prefer juicer = JuicerProducer { 2596 p.prefer(
"juicer",fooRcd=
vstring(
"Foo"))
2597 self.assertEqual(p.dumpConfig(),
2599 es_module juicer = JuicerProducer { 2601 es_source = ForceSource { 2603 es_prefer = ForceSource { 2605 es_prefer juicer = JuicerProducer { 2613 self.assertEqual(p.dumpPython(),
2614 """import FWCore.ParameterSet.Config as cms 2616 process = cms.Process("Test") 2618 process.juicer = cms.ESProducer("JuicerProducer") 2621 process.ForceSource = cms.ESSource("ForceSource") 2624 process.prefer("ForceSource") 2626 process.prefer("juicer", 2627 fooRcd = cms.vstring('Foo') 2644 self.assertEqual(process.m.p.i.value(), 4)
2654 subProcess.p =
Path(subProcess.a)
2655 subProcess.add_(
Service(
"Foo"))
2656 process.addSubProcess(
SubProcess(subProcess))
2657 d = process.dumpPython()
2658 equalD =
"""import FWCore.ParameterSet.Config as cms 2660 process = cms.Process("Parent") 2662 parentProcess = process 2663 import FWCore.ParameterSet.Config as cms 2665 process = cms.Process("Child") 2667 process.a = cms.EDProducer("A") 2670 process.Foo = cms.Service("Foo") 2673 process.p = cms.Path(process.a) 2676 childProcess = process 2677 process = parentProcess 2678 process.addSubProcess(cms.SubProcess(process = childProcess, SelectEvents = cms.untracked.PSet( 2680 ), outputCommands = cms.untracked.vstring())) 2683 equalD = equalD.replace(
"parentProcess",
"parentProcess"+
str(
hash(process.subProcesses_()[0])))
2684 self.assertEqual(d,equalD)
2686 process.fillProcessDesc(p)
2687 self.assertEqual((
True,[
'a']),p.values[
"subProcesses"][1][0].values[
"process"][1].values[
'@all_modules'])
2688 self.assertEqual((
True,[
'p']),p.values[
"subProcesses"][1][0].values[
"process"][1].values[
'@paths'])
2689 self.assertEqual({
'@service_type':(
True,
'Foo')}, p.values[
"subProcesses"][1][0].values[
"process"][1].values[
"services"][1][0].values)
2699 proc.fillProcessDesc(p)
2700 self.assertEqual((
True,1),p.values[
"ref"][1].values[
"a"])
2701 self.assertEqual((
True,1),p.values[
"ref3"][1].values[
"a"])
2702 self.assertEqual((
True,1),p.values[
"ref2"][1].values[
"a"])
2703 self.assertEqual((
True,1),p.values[
"ref2"][1].values[
"b"][1].values[
"a"])
2704 self.assertEqual((
True,1),p.values[
"ref4"][1][0].values[
"a"])
2705 self.assertEqual((
True,1),p.values[
"ref4"][1][1].values[
"a"])
2715 proc.s =
Sequence(proc.a + proc.sp)
2716 proc.t =
Task(proc.a, proc.sp)
2718 proc.p.associate(proc.t)
2720 proc.fillProcessDesc(p)
2721 self.assertEqual((
True,
"EDProducer"), p.values[
"sp"][1].values[
"@module_edm_type"])
2722 self.assertEqual((
True,
"SwitchProducer"), p.values[
"sp"][1].values[
"@module_type"])
2723 self.assertEqual((
True,
"sp"), p.values[
"sp"][1].values[
"@module_label"])
2724 self.assertEqual((
True, [
"sp@test1",
"sp@test2"]), p.values[
"sp"][1].values[
"@all_cases"])
2725 self.assertEqual((
False,
"sp@test2"), p.values[
"sp"][1].values[
"@chosen_case"])
2726 self.assertEqual([
"a",
"sp",
"sp@test1",
"sp@test2"], p.values[
"@all_modules"][1])
2727 self.assertEqual((
True,
"EDProducer"), p.values[
"sp@test1"][1].values[
"@module_edm_type"])
2728 self.assertEqual((
True,
"Bar"), p.values[
"sp@test1"][1].values[
"@module_type"])
2729 self.assertEqual((
True,
"EDProducer"), p.values[
"sp@test2"][1].values[
"@module_edm_type"])
2730 self.assertEqual((
True,
"Foo"), p.values[
"sp@test2"][1].values[
"@module_type"])
2731 dump = proc.dumpPython()
2732 self.assertEqual(dump.find(
'@'), -1)
2733 self.assertEqual(specialImportRegistry.getSpecialImports(), [
"from test import SwitchProducerTest"])
2734 self.assertTrue(dump.find(
"\nfrom test import SwitchProducerTest\n") != -1)
2743 proc.s =
Sequence(proc.a + proc.sp)
2744 proc.t =
Task(proc.a, proc.sp)
2746 proc.p.associate(proc.t)
2748 proc.fillProcessDesc(p)
2749 self.assertEqual((
True,
"EDProducer"), p.values[
"sp"][1].values[
"@module_edm_type"])
2750 self.assertEqual((
True,
"SwitchProducer"), p.values[
"sp"][1].values[
"@module_type"])
2751 self.assertEqual((
True,
"sp"), p.values[
"sp"][1].values[
"@module_label"])
2752 self.assertEqual((
True, [
"sp@test1",
"sp@test2"]), p.values[
"sp"][1].values[
"@all_cases"])
2753 self.assertEqual((
False,
"sp@test2"), p.values[
"sp"][1].values[
"@chosen_case"])
2754 self.assertEqual([
"a",
"sp",
"sp@test2"], p.values[
"@all_modules"][1])
2755 self.assertEqual([
"sp@test1"], p.values[
"@all_aliases"][1])
2756 self.assertEqual((
True,
"EDProducer"), p.values[
"sp@test2"][1].values[
"@module_edm_type"])
2757 self.assertEqual((
True,
"Foo"), p.values[
"sp@test2"][1].values[
"@module_type"])
2758 self.assertEqual((
True,
"EDAlias"), p.values[
"sp@test1"][1].values[
"@module_edm_type"])
2759 self.assertEqual((
True,
"Bar"), p.values[
"sp@test1"][1].values[
"a"][1][0].values[
"type"])
2768 proc.s =
Sequence(proc.a + proc.sp)
2769 proc.t =
Task(proc.a, proc.sp)
2771 proc.p.associate(proc.t)
2773 proc.fillProcessDesc(p)
2774 self.assertEqual((
True,
"EDProducer"), p.values[
"sp"][1].values[
"@module_edm_type"])
2775 self.assertEqual((
True,
"SwitchProducer"), p.values[
"sp"][1].values[
"@module_type"])
2776 self.assertEqual((
True,
"sp"), p.values[
"sp"][1].values[
"@module_label"])
2777 self.assertEqual((
True, [
"sp@test1",
"sp@test2"]), p.values[
"sp"][1].values[
"@all_cases"])
2778 self.assertEqual((
False,
"sp@test2"), p.values[
"sp"][1].values[
"@chosen_case"])
2779 self.assertEqual([
"a",
"sp",
"sp@test1"], p.values[
"@all_modules"][1])
2780 self.assertEqual([
"sp@test2"], p.values[
"@all_aliases"][1])
2781 self.assertEqual((
True,
"EDProducer"), p.values[
"sp@test1"][1].values[
"@module_edm_type"])
2782 self.assertEqual((
True,
"Foo"), p.values[
"sp@test1"][1].values[
"@module_type"])
2783 self.assertEqual((
True,
"EDAlias"), p.values[
"sp@test2"][1].values[
"@module_edm_type"])
2784 self.assertEqual((
True,
"Bar"), p.values[
"sp@test2"][1].values[
"a"][1][0].values[
"type"])
2795 self.assert_(p.schedule
is None)
2798 self.assertEqual(pths[keys[0]],p.path1)
2799 self.assertEqual(pths[keys[1]],p.path2)
2801 p.pset2 = untracked.PSet(parA =
string(
"pset2"))
2803 p.vpset2 = untracked.VPSet()
2805 self.assert_(hasattr(p,
'a'))
2806 self.assert_(hasattr(p,
'b'))
2807 self.assert_(
not hasattr(p,
'c'))
2808 self.assert_(
not hasattr(p,
'd'))
2809 self.assert_(
not hasattr(p,
's'))
2810 self.assert_(hasattr(p,
'path1'))
2811 self.assert_(hasattr(p,
'path2'))
2828 p.path3 =
Path(p.b+p.s2)
2829 p.path4 =
Path(p.b+p.s3)
2830 p.schedule =
Schedule(p.path1,p.path2,p.path3)
2833 self.assertEqual(pths[keys[0]],p.path1)
2834 self.assertEqual(pths[keys[1]],p.path2)
2836 self.assert_(hasattr(p,
'a'))
2837 self.assert_(hasattr(p,
'b'))
2838 self.assert_(
not hasattr(p,
'c'))
2839 self.assert_(
not hasattr(p,
'd'))
2840 self.assert_(
not hasattr(p,
'e'))
2841 self.assert_(
not hasattr(p,
's'))
2842 self.assert_(hasattr(p,
's2'))
2843 self.assert_(
not hasattr(p,
's3'))
2844 self.assert_(hasattr(p,
'path1'))
2845 self.assert_(hasattr(p,
'path2'))
2846 self.assert_(hasattr(p,
'path3'))
2847 self.assert_(
not hasattr(p,
'path4'))
2855 self.assert_(hasattr(p,
'a'))
2856 self.assert_(hasattr(p,
'b'))
2857 self.assert_(hasattr(p,
's'))
2858 self.assert_(hasattr(p,
'pth'))
2864 p.prune(keepUnresolvedSequencePlaceholders=
True)
2865 self.assert_(hasattr(p,
'b'))
2866 self.assert_(hasattr(p,
's'))
2867 self.assert_(hasattr(p,
'pth'))
2868 self.assertEqual(p.s.dumpPython(
''),
'cms.Sequence(cms.SequencePlaceholder("a")+process.b)\n')
2876 p.path1 =
Path(p.b, p.t2, p.t3)
2879 p.endpath1 =
EndPath(p.b, p.t5)
2883 p.schedule =
Schedule(p.path1, p.endpath1,tasks=[p.t7,p.t8])
2892 self.assertEqual(p.dumpPython(),
2893 """import FWCore.ParameterSet.Config as cms 2895 process = cms.Process("test") 2897 process.a = cms.EDProducer("ma") 2900 process.c = cms.EDProducer("mc") 2903 process.d = cms.EDProducer("md") 2906 process.e = cms.EDProducer("me") 2909 process.f = cms.EDProducer("mf") 2912 process.g = cms.EDProducer("mg") 2915 process.h = cms.EDProducer("mh") 2918 process.i = cms.EDProducer("mi") 2921 process.j = cms.EDProducer("mj") 2924 process.b = cms.EDAnalyzer("mb") 2927 process.t8 = cms.Task(cms.TaskPlaceholder("j")) 2930 process.t6 = cms.Task(cms.TaskPlaceholder("h")) 2933 process.t7 = cms.Task(cms.TaskPlaceholder("i"), process.a, process.t6) 2936 process.t4 = cms.Task(cms.TaskPlaceholder("f")) 2939 process.t5 = cms.Task(cms.TaskPlaceholder("g"), cms.TaskPlaceholder("t4"), process.a) 2942 process.t3 = cms.Task(cms.TaskPlaceholder("e")) 2945 process.t1 = cms.Task(cms.TaskPlaceholder("c")) 2948 process.t2 = cms.Task(cms.TaskPlaceholder("d"), process.a, process.t1) 2951 process.path1 = cms.Path(process.b, process.t2, process.t3) 2954 process.endpath1 = cms.EndPath(process.b, process.t5) 2957 process.schedule = cms.Schedule(*[ process.path1, process.endpath1 ], tasks=[process.t7, process.t8]) 2960 self.assertEqual(p.dumpPython(),
2961 """import FWCore.ParameterSet.Config as cms 2963 process = cms.Process("test") 2965 process.a = cms.EDProducer("ma") 2968 process.c = cms.EDProducer("mc") 2971 process.d = cms.EDProducer("md") 2974 process.e = cms.EDProducer("me") 2977 process.f = cms.EDProducer("mf") 2980 process.g = cms.EDProducer("mg") 2983 process.h = cms.EDProducer("mh") 2986 process.i = cms.EDProducer("mi") 2989 process.j = cms.EDProducer("mj") 2992 process.b = cms.EDAnalyzer("mb") 2995 process.t8 = cms.Task(process.j) 2998 process.t6 = cms.Task(process.h) 3001 process.t7 = cms.Task(process.a, process.i, process.t6) 3004 process.t4 = cms.Task(process.f) 3007 process.t5 = cms.Task(process.a, process.g, process.t4) 3010 process.t3 = cms.Task(process.e) 3013 process.t1 = cms.Task(process.c) 3016 process.t2 = cms.Task(process.a, process.d, process.t1) 3019 process.path1 = cms.Path(process.b, process.t2, process.t3) 3022 process.endpath1 = cms.EndPath(process.b, process.t5) 3025 process.schedule = cms.Schedule(*[ process.path1, process.endpath1 ], tasks=[process.t7, process.t8]) 3038 p.t1 =
Task(p.g, p.h)
3042 p.path1 =
Path(p.a+p.f+p.s,t2)
3045 self.assertTrue(hasattr(p,
'f'))
3046 self.assertTrue(hasattr(p,
'g'))
3050 self.assertFalse(hasattr(p,
'f'))
3051 self.assertFalse(hasattr(p,
'g'))
3052 self.assertTrue(p.t1.dumpPython(
None) ==
'cms.Task(process.h)\n')
3053 self.assertTrue(p.s.dumpPython(
None) ==
'cms.Sequence(process.d)\n')
3054 self.assertTrue(p.path1.dumpPython(
None) ==
'cms.Path(process.a+process.s, cms.Task(process.h))\n')
3055 self.assertTrue(p.endpath1.dumpPython(
None) ==
'cms.EndPath(process.b)\n')
3057 self.assertTrue(p.path1.dumpPython(
None) ==
'cms.Path(process.a+(process.d), cms.Task(process.h))\n')
3058 self.assertTrue(p.schedule_().
dumpPython(
None) ==
'cms.Schedule(tasks=[cms.Task(process.h)])\n')
3065 m1.toModify(p.a,_mod_fred)
3066 self.assertEqual(p.a.fred.value(),2)
3068 m1.toModify(p.b, wilma = 2)
3069 self.assertEqual(p.b.wilma.value(),2)
3070 self.assert_(p.isUsingModifier(m1))
3075 m1.toModify(p.a,_mod_fred)
3077 m1.toModify(p.b, wilma = 2)
3078 self.assertEqual(p.a.fred.value(),1)
3079 self.assertEqual(p.b.wilma.value(),1)
3080 self.assertEqual(p.isUsingModifier(m1),
False)
3085 m1.toModify(p.a, fred =
int32(2))
3086 p.b = p.a.clone(wilma =
int32(3))
3087 self.assertEqual(p.a.fred.value(),2)
3088 self.assertEqual(p.a.wilma.value(),1)
3089 self.assertEqual(p.b.fred.value(),2)
3090 self.assertEqual(p.b.wilma.value(),3)
3095 m1.toModify(p.a, fred =
None, fintstones =
dict(fred =
None))
3096 self.assertEqual(hasattr(p.a,
"fred"),
False)
3097 self.assertEqual(hasattr(p.a.fintstones,
"fred"),
False)
3098 self.assertEqual(p.a.wilma.value(),1)
3103 m1.toModify(p.a, wilma =
int32(2))
3104 self.assertEqual(p.a.fred.value(), 1)
3105 self.assertEqual(p.a.wilma.value(),2)
3110 m1.toModify(p.a, flintstones =
dict(fred =
int32(2)))
3111 self.assertEqual(p.a.flintstones.fred.value(),2)
3112 self.assertEqual(p.a.flintstones.wilma.value(),1)
3117 self.assertRaises(KeyError,
lambda: m1.toModify(p.a, flintstones =
dict(imnothere =
dict(wilma=2))))
3118 self.assertRaises(KeyError,
lambda: m1.toModify(p.a, foo = 1))
3123 m1.toModify(p.a, flintstones = {1:
dict(wilma =
int32(2))})
3124 self.assertEqual(p.a.flintstones[0].fred.value(),1)
3125 self.assertEqual(p.a.flintstones[1].wilma.value(),2)
3130 m1.toModify(p.a, fred = {1:7})
3131 self.assertEqual(p.a.fred[0],1)
3132 self.assertEqual(p.a.fred[1],7)
3133 self.assertEqual(p.a.fred[2],3)
3139 try: m1.toModify(p.a, fred = {5:7})
3140 except IndexError
as e: raised =
True 3141 self.assertEqual(raised,
True)
3147 try: m1.toModify(p.a, flintstones =
dict(bogus =
int32(37)))
3148 except TypeError
as e: raised =
True 3149 self.assertEqual(raised,
True)
3153 class ProcModifierMod(
object):
3154 def __init__(self,modifier,func):
3159 testMod = DummyMod()
3161 self.assert_(hasattr(p,
"a"))
3164 testProcMod = ProcModifierMod(m1,_rem_a)
3166 p.extend(testProcMod)
3167 self.assert_(
not hasattr(p,
"a"))
3172 self.assert_(p.isUsingModifier(m1))
3173 self.assert_(p.isUsingModifier(mc))
3174 testMod = DummyMod()
3176 m1.toModify(p.b, fred =
int32(3))
3178 testProcMod = ProcModifierMod(m1,_rem_a)
3179 p.extend(testProcMod)
3180 self.assert_(
not hasattr(p,
"a"))
3181 self.assertEqual(p.b.fred.value(),3)
3186 mclone = mc.copyAndExclude([m2])
3187 self.assert_(
not mclone._isOrContains(m2))
3188 self.assert_(mclone._isOrContains(m1))
3191 mclone = mc2.copyAndExclude([m2])
3192 self.assert_(
not mclone._isOrContains(m2))
3193 self.assert_(mclone._isOrContains(m1))
3194 self.assert_(mclone._isOrContains(m3))
3200 (m1 & m2).toModify(p.a, fred =
int32(2))
3201 self.assertRaises(TypeError,
lambda: (m1 & m2).toModify(p.a, 1, wilma=2))
3202 self.assertEqual(p.a.fred, 1)
3207 (m1 & m2).toModify(p.a, fred =
int32(2))
3208 self.assertEqual(p.a.fred, 2)
3214 (m1 & m2 & m3).toModify(p.a, fred =
int32(2))
3215 self.assertEqual(p.a.fred, 2)
3216 (m1 & (m2 & m3)).toModify(p.a, fred =
int32(3))
3217 self.assertEqual(p.a.fred, 3)
3218 ((m1 & m2) & m3).toModify(p.a, fred =
int32(4))
3219 self.assertEqual(p.a.fred, 4)
3225 (~m1).toModify(p.a, fred=2)
3226 self.assertEqual(p.a.fred, 1)
3227 (~m2).toModify(p.a, wilma=2)
3228 self.assertEqual(p.a.wilma, 2)
3229 self.assertRaises(TypeError,
lambda: (~m1).toModify(p.a, 1, wilma=2))
3230 self.assertRaises(TypeError,
lambda: (~m2).toModify(p.a, 1, wilma=2))
3237 (m1 | m2).toModify(p.a, fred=2)
3238 self.assertEqual(p.a.fred, 2)
3239 (m1 | m2 | m3).toModify(p.a, fred=3)
3240 self.assertEqual(p.a.fred, 3)
3241 (m3 | m2 | m1).toModify(p.a, fred=4)
3242 self.assertEqual(p.a.fred, 4)
3243 ((m1 | m2) | m3).toModify(p.a, fred=5)
3244 self.assertEqual(p.a.fred, 5)
3245 (m1 | (m2 | m3)).toModify(p.a, fred=6)
3246 self.assertEqual(p.a.fred, 6)
3247 (m2 | m3).toModify(p.a, fred=7)
3248 self.assertEqual(p.a.fred, 6)
3249 self.assertRaises(TypeError,
lambda: (m1 | m2).toModify(p.a, 1, wilma=2))
3250 self.assertRaises(TypeError,
lambda: (m2 | m3).toModify(p.a, 1, wilma=2))
3258 (m1 & ~m2).toModify(p.a, fred=2)
3259 self.assertEqual(p.a.fred, 1)
3260 (m1 & ~m3).toModify(p.a, fred=2)
3261 self.assertEqual(p.a.fred, 2)
3262 (m1 | ~m2).toModify(p.a, fred=3)
3263 self.assertEqual(p.a.fred, 3)
3264 (~m1 | ~m2).toModify(p.a, fred=4)
3265 self.assertEqual(p.a.fred, 3)
3266 (~m3 & ~m4).toModify(p.a, fred=4)
3267 self.assertEqual(p.a.fred, 4)
3268 ((m1 & m3) | ~m4).toModify(p.a, fred=5)
3269 self.assertEqual(p.a.fred, 5)
3275 self.assertRaises(TypeError,
lambda: m1.toReplaceWith(p.a,
EDProducer(
"YourProducer")))
3282 m1.toReplaceWith(p.s,
Sequence(p.a+p.b, p.td))
3283 self.assertEqual(p.a.wilma.value(),3)
3284 self.assertEqual(p.a.type_(),
"YourAnalyzer")
3285 self.assertEqual(hasattr(p,
"fred"),
False)
3286 self.assertTrue(p.s.dumpPython(
"") ==
"cms.Sequence(process.a+process.b, process.td)\n")
3288 m1.toReplaceWith(p.td,
Task(p.e))
3289 self.assertTrue(p.td._collection ==
OrderedSet([p.e]))
3295 self.assertEqual(p.a.type_(),
"MyAnalyzer")
3303 self.assertRaises(TypeError,
lambda: (m1 & m2).toReplaceWith(p.a,
EDProducer(
"YourProducer")))
3304 self.assertRaises(TypeError,
lambda: (m3 & m4).toReplaceWith(p.a,
EDProducer(
"YourProducer")))
3305 self.assertRaises(TypeError,
lambda: (~m3).toReplaceWith(p.a,
EDProducer(
"YourProducer")))
3306 self.assertRaises(TypeError,
lambda: (~m1).toReplaceWith(p.a,
EDProducer(
"YourProducer")))
3307 self.assertRaises(TypeError,
lambda: (m1 | m3).toReplaceWith(p.a,
EDProducer(
"YourProducer")))
3308 self.assertRaises(TypeError,
lambda: (m3 | m4).toReplaceWith(p.a,
EDProducer(
"YourProducer")))
3309 (m1 & m2).toReplaceWith(p.a,
EDAnalyzer(
"YourAnalyzer1"))
3310 self.assertEqual(p.a.type_(),
"YourAnalyzer1")
3311 (m1 & m3).toReplaceWith(p.a,
EDAnalyzer(
"YourAnalyzer2"))
3312 self.assertEqual(p.a.type_(),
"YourAnalyzer1")
3313 (~m1).toReplaceWith(p.a,
EDAnalyzer(
"YourAnalyzer2"))
3314 self.assertEqual(p.a.type_(),
"YourAnalyzer1")
3315 (~m3).toReplaceWith(p.a,
EDAnalyzer(
"YourAnalyzer2"))
3316 self.assertEqual(p.a.type_(),
"YourAnalyzer2")
3317 (m1 | m3).toReplaceWith(p.a,
EDAnalyzer(
"YourAnalyzer3"))
3318 self.assertEqual(p.a.type_(),
"YourAnalyzer3")
3319 (m3 | m4).toReplaceWith(p.a,
EDAnalyzer(
"YourAnalyzer4"))
3320 self.assertEqual(p.a.type_(),
"YourAnalyzer3")
3327 m.toModify(a, foo2 = {0:
dict(type =
"Foo3")})
3328 self.assertEqual(a.foo2[0].type,
"Foo3")
3331 self.assertEqual(a.foo2[0].type,
"Foo3")
3332 self.assertEqual(a.foo4[0].type,
"Foo4")
3334 m.toModify(a, foo2 =
None)
3335 self.assertFalse(hasattr(a,
"foo2"))
3336 self.assertEqual(a.foo4[0].type,
"Foo4")
3339 self.assertFalse(hasattr(a,
"foo2"))
3340 self.assertFalse(hasattr(a,
"foo4"))
3341 self.assertTrue(hasattr(a,
"bar"))
3342 self.assertEqual(a.bar[0].type,
"Bar")
3355 test1 =
dict(a = 4, b =
dict(c =
None)),
3357 self.assertEqual(sp.test1.a.value(), 4)
3358 self.assertEqual(sp.test1.b.hasParameter(
"c"),
False)
3359 self.assertEqual(sp.test2.aa.value(), 15)
3360 self.assertEqual(sp.test2.bb.cc.value(), 45)
3361 self.assertEqual(sp.test2.bb.dd.value(),
"foo")
3364 self.assertEqual(sp.test1.type_(),
"Fred")
3365 self.assertEqual(sp.test1.x.value(), 42)
3366 self.assertRaises(TypeError,
lambda: m.toReplaceWith(sp.test1,
EDAnalyzer(
"Foo")))
3369 self.assertEqual(sp.test2.type_(),
"Xyzzy")
3370 self.assertEqual(sp.test2.x.value(), 24)
3371 self.assertRaises(TypeError,
lambda: m.toModify(sp, test2 =
EDAnalyzer(
"Foo")))
3374 self.assertEqual(sp.test3.type_(),
"Wilma")
3375 self.assertEqual(sp.test3.y.value(), 24)
3376 self.assertRaises(TypeError,
lambda: m.toModify(sp, test4 =
EDAnalyzer(
"Foo")))
3378 m.toModify(sp, test2 =
None)
3379 self.assertEqual(hasattr(sp,
"test2"),
False)
3382 self.assertTrue(hasattr(sp.test2,
"foo"))
3385 self.assertTrue(hasattr(sp.test2,
"bar"))
3388 self.assertTrue(hasattr(sp.test2,
"xyzzy"))
3390 self.assertRaises(TypeError,
lambda: m.toReplaceWith(sp.test2,
EDProducer(
"Foo")))
def __setstate__(self, pkldict)
def addVString(self, tracked, label, value)
def _dumpConfigOptionallyNamedList(self, items, typeName, options)
def addEventRange(self, tracked, label, value)
def __init__(self, lhs, rhs)
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 _pruneModules(self, d, scheduledNames)
def _modifyParametersFromDict(params, newParams, errorRaiser, keyDepth="")
def _placeESPrefer(self, name, mod)
def _placeSwitchProducer(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)
S & print(S &os, JobReport::InputFile const &f)
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 toModify(self, obj, func=None, 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 testSwitchProducer(self)
def getVString(self, tracked, label)
def toReplaceWith(self, toObj, fromObj)
def _placeOutputModule(self, name, mod)
def addFileInPath(self, tracked, label, value)
def _placeSource(self, name, mod)
def __init__(self, lhs, rhs=None)
def _dumpPythonSubProcesses(self, l, options)
def _insertSwitchProducersInto(self, parameterSet, labelModules, labelAliases, itemDict, tracked)
def checkImportPermission(minLevel=2, allowedPatterns=[])
def _toModify(obj, func, kw)
def __init__(self, modifier, func)
def _toReplaceWith(toObj, fromObj)
def _toModifyCheck(obj, func, kw)
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 _toReplaceWithCheck(toObj, fromObj)
def switchProducerNames(self)
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 makeProcessModifier(self, func)
def addSubProcess(self, mod)
def switchProducers_(self)
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 __init__(self, kargs)
def __getValue(self, tracked, label)
def _placeVPSet(self, name, mod)
def globalReplace(self, label, new)
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 testTaskPlaceholder(self)
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)