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, FinalPathValidator, ScheduleTaskValidator, NodeVisitor, CompositeVisitor, ModuleNamesFromGlobalsVisitor
21 from .MessageLogger
import MessageLogger
22 from .
import DictTypes
24 from .ExceptionHandling
import *
27 if sys.getrecursionlimit()<5000:
28 sys.setrecursionlimit(5000)
32 Raise an exception if called by special config files. This checks 33 the call or import stack for the importing file. An exception is raised if 34 the importing module is not in allowedPatterns and if it is called too deeply: 35 minLevel = 2: inclusion by top lvel cfg only 36 minLevel = 1: No inclusion allowed 37 allowedPatterns = ['Module1','Module2/SubModule1'] allows import 38 by any module in Module1 or Submodule1 44 ignorePatterns = [
'FWCore/ParameterSet/Config.py',
'FWCore/ParameterSet/python/Config.py',
'<string>',
'<frozen ']
45 CMSSWPath = [os.environ[
'CMSSW_BASE'],os.environ[
'CMSSW_RELEASE_BASE']]
49 for item
in inspect.stack():
53 for pattern
in CMSSWPath:
54 if item[1].
find(pattern) != -1:
57 if item[1].
find(
'/') == -1:
60 for pattern
in ignorePatterns:
61 if item[1].
find(pattern) != -1:
65 if inPath
and not ignore:
66 trueStack.append(item[1])
68 importedFile = trueStack[0]
70 if len(trueStack) > 1:
71 importedBy = trueStack[1]
73 for pattern
in allowedPatterns:
74 if importedBy.find(pattern) > -1:
77 if len(trueStack) <= minLevel:
80 raise ImportError(
"Inclusion of %s is allowed only by cfg or specified cfi files." 84 """Look inside the module and find the Processes it contains""" 88 if isinstance(module,dict):
89 if 'process' in module:
93 if hasattr(module,
'process'):
94 if isinstance(module.process,Process):
95 process = module.process
97 raise RuntimeError(
"The attribute named 'process' does not inherit from the Process class")
99 raise RuntimeError(
"no 'process' attribute found in the module, please add one")
103 """Root class for a CMS configuration process""" 106 """The argument 'name' will be the name applied to this Process 107 Can optionally pass as additional arguments cms.Modifier instances 108 that will be used to modify the Process as it is built 110 self.__dict__[
'_Process__name'] = name
111 if not name.isalnum():
112 raise RuntimeError(
"Error: The process name is an empty string or contains non-alphanumeric characters")
113 self.__dict__[
'_Process__filters'] = {}
114 self.__dict__[
'_Process__producers'] = {}
115 self.__dict__[
'_Process__switchproducers'] = {}
116 self.__dict__[
'_Process__source'] =
None 117 self.__dict__[
'_Process__looper'] =
None 118 self.__dict__[
'_Process__subProcesses'] = []
119 self.__dict__[
'_Process__schedule'] =
None 120 self.__dict__[
'_Process__analyzers'] = {}
121 self.__dict__[
'_Process__outputmodules'] = {}
125 self.__dict__[
'_Process__sequences'] = {}
126 self.__dict__[
'_Process__tasks'] = {}
127 self.__dict__[
'_Process__conditionaltasks'] = {}
128 self.__dict__[
'_Process__services'] = {}
129 self.__dict__[
'_Process__essources'] = {}
130 self.__dict__[
'_Process__esproducers'] = {}
131 self.__dict__[
'_Process__esprefers'] = {}
132 self.__dict__[
'_Process__aliases'] = {}
133 self.__dict__[
'_Process__psets']={}
134 self.__dict__[
'_Process__vpsets']={}
135 self.__dict__[
'_cloneToObjectDict'] = {}
137 self.__dict__[
'_Process__InExtendCall'] =
False 138 self.__dict__[
'_Process__partialschedules'] = {}
140 self.__dict__[
'_Process__modifiers'] = Mods
141 self.__dict__[
'_Process__accelerators'] = {}
150 if Process._firstProcess:
151 Process._firstProcess =
False 154 for m
in self.__modifiers:
155 if not m._isChosen():
156 raise RuntimeError(
"The Process {} tried to redefine which Modifiers to use after another Process was already started".
format(name))
157 for m
in self.__modifiers:
162 _Module.__isStrict__ =
True 166 """Returns a string containing all the EDProducer labels separated by a blank""" 169 """Returns a string containing all the SwitchProducer labels separated by a blank""" 172 """Returns a string containing all the EDAnalyzer labels separated by a blank""" 175 """Returns a string containing all the EDFilter labels separated by a blank""" 178 """Returns a string containing all the Path names separated by a blank""" 185 Since cloneToObjectDict stores a hash of objects by their 186 id() it needs to be updated when unpickling to use the 187 new object id values instantiated during the unpickle. 190 self.__dict__.
update(pkldict)
192 for value
in self._cloneToObjectDict.
values():
193 tmpDict[
id(value)] = value
194 self.__dict__[
'_cloneToObjectDict'] = tmpDict
199 """returns a dict of the filters that have been added to the Process""" 201 filters = property(filters_, doc=
"dictionary containing the filters for the process")
205 if not name.isalnum():
206 raise RuntimeError(
"Error: The process name is an empty string or contains non-alphanumeric characters")
207 self.__dict__[
'_Process__name'] = name
208 process = property(name_,setName_, doc=
"name of the process")
210 """returns a dict of the producers that have been added to the Process""" 212 producers = property(producers_,doc=
"dictionary containing the producers for the process")
214 """returns a dict of the SwitchProducers that have been added to the Process""" 216 switchProducers = property(switchProducers_,doc=
"dictionary containing the SwitchProducers for the process")
218 """returns the source that has been added to the Process or None if none have been added""" 222 source = property(source_,setSource_,doc=
'the main source or None if not set')
224 """returns the looper that has been added to the Process or None if none have been added""" 228 looper = property(looper_,setLooper_,doc=
'the main looper or None if not set')
231 return untracked.PSet(numberOfThreads = untracked.uint32(1),
232 numberOfStreams = untracked.uint32(0),
233 numberOfConcurrentRuns = untracked.uint32(1),
234 numberOfConcurrentLuminosityBlocks = untracked.uint32(0),
235 eventSetup = untracked.PSet(
236 numberOfConcurrentIOVs = untracked.uint32(0),
237 forceNumberOfConcurrentIOVs = untracked.PSet(
238 allowAnyLabel_ = required.untracked.uint32
241 accelerators = untracked.vstring(
'*'),
242 wantSummary = untracked.bool(
False),
243 fileMode = untracked.string(
'FULLMERGE'),
244 forceEventSetupCacheClearOnNewRun = untracked.bool(
False),
245 throwIfIllegalParameter = untracked.bool(
True),
246 printDependencies = untracked.bool(
False),
247 deleteNonConsumedUnscheduledModules = untracked.bool(
True),
248 sizeOfStackForThreadsInKB = optional.untracked.uint32,
249 Rethrow = untracked.vstring(),
250 SkipEvent = untracked.vstring(),
251 FailPath = untracked.vstring(),
252 IgnoreCompletely = untracked.vstring(),
253 canDeleteEarly = untracked.vstring(),
254 dumpOptions = untracked.bool(
False),
255 allowUnscheduled = obsolete.untracked.bool,
256 emptyRunLumiMode = obsolete.untracked.string,
257 makeTriggerResults = obsolete.untracked.bool
261 if isinstance(opt,dict):
262 for k,v
in opt.items():
265 for p
in opt.parameters_():
266 setattr(newOpts, p, getattr(opt,p))
270 return untracked.PSet(input=optional.untracked.int32,
271 output=optional.untracked.allowed(int32,PSet))
274 if isinstance(ps,dict):
275 for k,v
in ps.items():
278 for p
in ps.parameters_():
279 setattr(newMax, p, getattr(ps,p))
283 return untracked.PSet(input=untracked.int32(-1))
285 """returns a list of the subProcesses that have been added to the Process""" 286 return self.__subProcesses
287 subProcesses = property(subProcesses_,doc=
'the SubProcesses that have been added to the Process')
289 """returns a dict of the analyzers that have been added to the Process""" 291 analyzers = property(analyzers_,doc=
"dictionary containing the analyzers for the process")
293 """returns a dict of the output modules that have been added to the Process""" 295 outputModules = property(outputModules_,doc=
"dictionary containing the output_modules for the process")
297 """returns a dict of the paths that have been added to the Process""" 299 paths = property(paths_,doc=
"dictionary containing the paths for the process")
301 """returns a dict of the endpaths that have been added to the Process""" 303 endpaths = property(endpaths_,doc=
"dictionary containing the endpaths for the process")
305 """returns a dict of the finalpaths that have been added to the Process""" 307 finalpaths = property(finalpaths_,doc=
"dictionary containing the finalpaths for the process")
309 """returns a dict of the sequences that have been added to the Process""" 311 sequences = property(sequences_,doc=
"dictionary containing the sequences for the process")
313 """returns a dict of the tasks that have been added to the Process""" 315 tasks = property(tasks_,doc=
"dictionary containing the tasks for the process")
317 """returns a dict of the conditionaltasks that have been added to the Process""" 319 conditionaltasks = property(conditionaltasks_,doc=
"dictionary containing the conditionatasks for the process")
321 """returns the schedule that has been added to the Process or None if none have been added""" 322 return self.__schedule
324 if label ==
"schedule":
327 self.
_place(label, sch, self.__partialschedules)
336 raise RuntimeError(
"The path at index "+
str(index)+
" in the Schedule was not attached to the process.")
337 self.__dict__[
'_Process__schedule'] = sch
338 schedule = property(schedule_,setSchedule_,doc=
'the schedule or None if not set')
340 """returns a dict of the services that have been added to the Process""" 342 services = property(services_,doc=
"dictionary containing the services for the process")
344 """returns a dict of the ProcessAccelerators that have been added to the Process""" 346 processAccelerators = property(processAccelerators_,doc=
"dictionary containing the ProcessAccelerators for the process")
348 """returns a dict of the esproducers that have been added to the Process""" 350 es_producers = property(es_producers_,doc=
"dictionary containing the es_producers for the process")
352 """returns a the es_sources that have been added to the Process""" 354 es_sources = property(es_sources_,doc=
"dictionary containing the es_sources for the process")
356 """returns a dict of the es_prefers that have been added to the Process""" 358 es_prefers = property(es_prefers_,doc=
"dictionary containing the es_prefers for the process")
360 """returns a dict of the aliases that have been added to the Process""" 362 aliases = property(aliases_,doc=
"dictionary containing the aliases for the process")
364 """returns a dict of the PSets that have been added to the Process""" 366 psets = property(psets_,doc=
"dictionary containing the PSets for the process")
368 """returns a dict of the VPSets that have been added to the Process""" 370 vpsets = property(vpsets_,doc=
"dictionary containing the PSets for the process")
373 """returns True if the Modifier is in used by this Process""" 375 for m
in self.__modifiers:
376 if m._isOrContains(mod):
381 if not object.hasLabel_() :
382 object.setLabel(newLabel)
384 if newLabel == object.label_() :
386 if newLabel
is None :
387 object.setLabel(
None)
389 if (hasattr(self, object.label_())
and id(getattr(self, object.label_())) ==
id(object)) :
390 msg100 =
"Attempting to change the label of an attribute of the Process\n" 391 msg101 =
"Old label = "+object.label_()+
" New label = "+newLabel+
"\n" 392 msg102 =
"Type = "+
str(type(object))+
"\n" 393 msg103 =
"Some possible solutions:\n" 394 msg104 =
" 1. Clone modules instead of using simple assignment. Cloning is\n" 395 msg105 =
" also preferred for other types when possible.\n" 396 msg106 =
" 2. Declare new names starting with an underscore if they are\n" 397 msg107 =
" for temporaries you do not want propagated into the Process. The\n" 398 msg108 =
" underscore tells \"from x import *\" and process.load not to import\n" 399 msg109 =
" the name.\n" 400 msg110 =
" 3. Reorganize so the assigment is not necessary. Giving a second\n" 401 msg111 =
" name to the same object usually causes confusion and problems.\n" 402 msg112 =
" 4. Compose Sequences: newName = cms.Sequence(oldName)\n" 403 raise ValueError(msg100+msg101+msg102+msg103+msg104+msg105+msg106+msg107+msg108+msg109+msg110+msg111+msg112)
404 object.setLabel(
None)
405 object.setLabel(newLabel)
409 if not name.replace(
'_',
'').isalnum():
410 raise ValueError(
'The label '+name+
' contains forbiden characters')
412 if name ==
'options':
414 if name ==
'maxEvents':
418 if name.startswith(
'_Process__'):
419 self.__dict__[name]=value
421 if not isinstance(value,_ConfigureComponent):
422 raise TypeError(
"can only assign labels to an object that inherits from '_ConfigureComponent'\n" 423 +
"an instance of "+
str(type(value))+
" will not work - requested label is "+name)
424 if not isinstance(value,_Labelable)
and not isinstance(value,Source)
and not isinstance(value,Looper)
and not isinstance(value,Schedule):
425 if name == value.type_():
426 if hasattr(self,name)
and (getattr(self,name)!=value):
433 raise TypeError(
"an instance of "+
str(type(value))+
" can not be assigned the label '"+name+
"'.\n"+
434 "Please either use the label '"+value.type_()+
" or use the 'add_' method instead.")
437 newValue =value.copy()
439 newValue._filename = value._filename
445 if not self.
_okToPlace(name, value, self.__dict__):
446 newFile=
'top level config' 447 if hasattr(value,
'_filename'):
448 newFile = value._filename
449 oldFile=
'top level config' 450 oldValue = getattr(self,name)
451 if hasattr(oldValue,
'_filename'):
452 oldFile = oldValue._filename
453 msg =
"Trying to override definition of process."+name
454 msg +=
"\n new object defined in: "+newFile
455 msg +=
"\n existing object defined in: "+oldFile
456 raise ValueError(msg)
458 if hasattr(self,name)
and not (getattr(self,name)==newValue):
462 if newValue._isTaskComponent():
463 if not self.__InExtendCall:
468 if not isinstance(newValue, Task):
470 newFile=
'top level config' 471 if hasattr(value,
'_filename'):
472 newFile = value._filename
473 oldFile=
'top level config' 474 oldValue = getattr(self,name)
475 if hasattr(oldValue,
'_filename'):
476 oldFile = oldValue._filename
477 msg1 =
"Trying to override definition of "+name+
" while it is used by the task " 478 msg2 =
"\n new object defined in: "+newFile
479 msg2 +=
"\n existing object defined in: "+oldFile
482 raise ValueError(msg1+s.label_()+msg2)
484 if isinstance(newValue, _Sequenceable)
or newValue._isTaskComponent()
or isinstance(newValue, ConditionalTask):
485 if not self.__InExtendCall:
486 if isinstance(newValue, ConditionalTask):
491 newFile=
'top level config' 492 if hasattr(value,
'_filename'):
493 newFile = value._filename
494 oldFile=
'top level config' 495 oldValue = getattr(self,name)
496 if hasattr(oldValue,
'_filename'):
497 oldFile = oldValue._filename
498 msg1 =
"Trying to override definition of "+name+
" while it is used by the " 499 msg2 =
"\n new object defined in: "+newFile
500 msg2 +=
"\n existing object defined in: "+oldFile
503 raise ValueError(msg1+
"sequence "+s.label_()+msg2)
506 raise ValueError(msg1+
"path "+s.label_()+msg2)
509 raise ValueError(msg1+
"endpath "+s.label_()+msg2)
512 raise ValueError(msg1+
"finalpath "+s.label_()+msg2)
515 if isinstance(newValue, EDAlias):
516 oldValue = getattr(self, name)
518 newFile=
'top level config' 519 if hasattr(value,
'_filename'):
520 newFile = value._filename
521 oldFile=
'top level config' 522 if hasattr(oldValue,
'_filename'):
523 oldFile = oldValue._filename
524 msg1 =
"Trying to override definition of "+name+
" with an EDAlias while it is used by the " 525 msg2 =
"\n new object defined in: "+newFile
526 msg2 +=
"\n existing object defined in: "+oldFile
529 raise ValueError(msg1+
"task "+s.label_()+msg2)
532 raise ValueError(msg1+
"sequence "+s.label_()+msg2)
535 raise ValueError(msg1+
"path "+s.label_()+msg2)
538 raise ValueError(msg1+
"endpath "+s.label_()+msg2)
541 raise ValueError(msg1+
"finalpath "+s.label_()+msg2)
543 if not self.__InExtendCall
and (Schedule._itemIsValid(newValue)
or isinstance(newValue, Task)):
547 self.__dict__[name]=newValue
548 if isinstance(newValue,_Labelable):
550 self._cloneToObjectDict[
id(value)] = newValue
551 self._cloneToObjectDict[
id(newValue)] = newValue
553 newValue._place(name,self)
555 """Given a container of sequences or tasks, find the first sequence or task 556 containing mod and return it. If none is found, return None""" 559 for seqOrTask
in seqsOrTasks.values():
568 if not hasattr(self,name):
569 raise KeyError(
'process does not know about '+name)
570 elif name.startswith(
'_Process__'):
571 raise ValueError(
'this attribute cannot be deleted')
576 if name
in reg: del reg[name]
578 obj = getattr(self,name)
579 if isinstance(obj,_Labelable):
581 if isinstance(obj,Service):
582 obj._inProcess =
False 586 obj = getattr(self,name)
588 if not isinstance(obj, Sequence)
and not isinstance(obj, Task)
and not isinstance(obj,ConditionalTask):
598 if obj._isTaskComponent():
602 if isinstance(obj, _Sequenceable)
or obj._isTaskComponent():
604 if Schedule._itemIsValid(obj)
or isinstance(obj, Task):
608 del self.__dict__[name]
613 """Similar to __delattr__ but we need different behavior when called from __setattr__""" 617 del self.__dict__[name]
622 """Allows addition of components that do not have to have a label, e.g. Services""" 623 if not isinstance(value,_ConfigureComponent):
625 if not isinstance(value,_Unlabelable):
629 newValue =value.copy()
633 newValue._place(
'',self)
636 if not self.__InExtendCall:
647 if d[name]._isModified:
658 if self.
__isStrict and isinstance(mod, _ModuleSequenceType):
659 d[name] = mod._postProcessFixup(self._cloneToObjectDict)
662 if isinstance(mod,_Labelable):
665 self.
_place(name, mod, self.__outputmodules)
667 self.
_place(name, mod, self.__producers)
669 self.
_place(name, mod, self.__switchproducers)
671 self.
_place(name, mod, self.__filters)
673 self.
_place(name, mod, self.__analyzers)
677 self.
_place(name, mod, self.__paths)
678 except ModuleCloneError
as msg:
680 raise Exception(
"%sThe module %s in path %s is unknown to the process %s." %(context, msg, name, self._Process__name))
684 self.
_place(name, mod, self.__endpaths)
685 except ModuleCloneError
as msg:
687 raise Exception(
"%sThe module %s in endpath %s is unknown to the process %s." %(context, msg, name, self._Process__name))
691 self.
_place(name, mod, self.__finalpaths)
692 except ModuleCloneError
as msg:
694 raise Exception(
"%sThe module %s in finalpath %s is unknown to the process %s." %(context, msg, name, self._Process__name))
697 self.
_place(name, mod, self.__sequences)
699 self.
_place(name, mod, self.__esproducers)
701 self.
_place(name, mod, self.__esprefers)
703 self.
_place(name, mod, self.__essources)
706 self.
_place(name, task, self.__tasks)
709 self.
_place(name, task, self.__conditionaltasks)
711 self.
_place(name, mod, self.__aliases)
713 self.
_place(name, mod, self.__psets)
715 self.
_place(name, mod, self.__vpsets)
717 """Allow the source to be referenced by 'source' or by type name""" 719 raise ValueError(
"The label '"+name+
"' can not be used for a Source. Only 'source' is allowed.")
720 if self.__dict__[
'_Process__source']
is not None :
721 del self.__dict__[self.__dict__[
'_Process__source'].type_()]
722 self.__dict__[
'_Process__source'] = mod
723 self.__dict__[mod.type_()] = mod
726 raise ValueError(
"The label '"+name+
"' can not be used for a Looper. Only 'looper' is allowed.")
727 self.__dict__[
'_Process__looper'] = mod
728 self.__dict__[mod.type_()] = mod
730 self.__dict__[
'_Process__subProcess'] = mod
731 self.__dict__[mod.type_()] = mod
733 self.__subProcesses.
append(mod)
735 self.
_place(typeName, mod, self.__services)
736 if typeName
in self.__dict__:
737 self.__dict__[typeName]._inProcess =
False 738 self.__dict__[typeName]=mod
740 self.
_place(typeName, mod, self.__accelerators)
741 self.__dict__[typeName]=mod
743 moduleName = moduleName.replace(
"/",
".")
744 module = __import__(moduleName)
745 self.
extend(sys.modules[moduleName])
747 """Look in other and find types that we can use""" 749 self.__dict__[
'_Process__InExtendCall'] =
True 752 tasksToAttach = dict()
754 for name
in dir(other):
756 if name.startswith(
'_'):
758 item = getattr(other,name)
759 if name ==
"source" or name ==
"looper":
763 elif isinstance(item,_ModuleSequenceType):
765 elif isinstance(item,Task)
or isinstance(item, ConditionalTask):
766 tasksToAttach[name] = item
767 elif isinstance(item,_Labelable):
769 if not item.hasLabel_() :
771 elif isinstance(item,Schedule):
773 elif isinstance(item,_Unlabelable):
775 elif isinstance(item,ProcessModifier):
777 elif isinstance(item,ProcessFragment):
781 for name,seq
in seqs.items():
782 if id(seq)
not in self._cloneToObjectDict:
785 newSeq = self._cloneToObjectDict[
id(seq)]
786 self.__dict__[name]=newSeq
789 newSeq._place(name,self)
791 for name, task
in tasksToAttach.items():
798 self.__dict__[
'_Process__InExtendCall'] =
False 802 for name,item
in items:
803 returnValue +=options.indentation()+typeName+
' '+name+
' = '+item.dumpConfig(options)
808 for name,item
in items:
809 returnValue +=options.indentation()+typeName+
' = '+item.dumpConfig(options)
814 for name,item
in items:
815 if name == item.type_():
817 returnValue +=options.indentation()+typeName+
' '+name+
' = '+item.dumpConfig(options)
821 """return a string containing the equivalent process defined using the old configuration language""" 822 config =
"process "+self.__name+
" = {\n" 875 config +=options.indentation()+item.configTypeName()+
' '+name+
' = '+item.configValue(options)
877 config +=options.indentation()+
'VPSet '+name+
' = '+item.configValue(options)
879 pathNames = [p.label_()
for p
in self.
schedule]
880 config +=options.indentation()+
'schedule = {'+
','.
join(pathNames)+
'}\n' 892 result +=options.indentation()+
'es_prefer '+item.targetLabel_()+
' = '+item.dumpConfig(options)
898 returnValue += item.dumpPython(options)+
'\n\n' 904 for name,item
in d.items():
905 returnValue +=
'process.'+name+
' = '+item.dumpPython(options)+
'\n\n' 907 for name,item
in sorted(d.items()):
908 returnValue +=
'process.'+name+
' = '+item.dumpPython(options)+
'\n\n' 915 dependencies = item.directDependencies()
916 for module_subfolder, module
in dependencies:
917 module = module +
'_cfi' 918 if options.useSubdirectories
and module_subfolder:
919 module = module_subfolder +
'.' + module
920 if options.targetDirectory
is not None:
921 if options.useSubdirectories
and subfolder:
922 module =
'..' + module
924 module =
'.' + module
925 code +=
'from ' + module +
' import *\n' 928 code += name +
' = ' + item.dumpPython(options)
929 parts[name] = subfolder, code
937 sequence.visit(visitor)
938 except Exception
as e:
939 raise RuntimeError(
"An entry in sequence {} has no label\n Seen entries: {}\n Error: {}".
format(label, l, e))
948 raise RuntimeError(
"An entry in task " + label +
' has not been attached to the process')
956 raise RuntimeError(
"An entry in task " + label +
' has not been attached to the process')
968 for label,item
in processDictionaryOfItems.items():
970 if isinstance(item, Task):
972 elif isinstance(item, ConditionalTask):
979 if isinstance(item, Task):
980 raise RuntimeError(
"Failed in a Task visitor. Probably " \
981 "a circular dependency discovered in Task with label " + label)
982 elif isinstance(item, ConditionalTask):
983 raise RuntimeError(
"Failed in a ConditionalTask visitor. Probably " \
984 "a circular dependency discovered in ConditionalTask with label " + label)
986 raise RuntimeError(
"Failed in a Sequence visitor. Probably a " \
987 "circular dependency discovered in Sequence with label " + label)
988 for containedItem
in containedItems:
994 if containedItem.hasLabel_():
995 testItem = processDictionaryOfItems.get(containedItem.label_())
996 if testItem
is None or containedItem != testItem:
997 if isinstance(item, Task):
998 raise RuntimeError(
"Task has a label, but using its label to get an attribute" \
999 " from the process yields a different object or None\n"+
1000 "label = " + containedItem.label_())
1001 if isinstance(item, ConditionalTask):
1002 raise RuntimeError(
"ConditionalTask has a label, but using its label to get an attribute" \
1003 " from the process yields a different object or None\n"+
1004 "label = " + containedItem.label_())
1006 raise RuntimeError(
"Sequence has a label, but using its label to get an attribute" \
1007 " from the process yields a different object or None\n"+
1008 "label = " + containedItem.label_())
1009 dependencies[label]=[dep.label_()
for dep
in containedItems
if dep.hasLabel_()]
1013 oldDeps = dict(dependencies)
1014 for label,deps
in oldDeps.items():
1016 returnValue[label]=processDictionaryOfItems[label]
1018 del dependencies[label]
1019 for lb2,deps2
in dependencies.items():
1020 while deps2.count(label):
1026 for name, value
in sorted(d.items()):
1027 result += value.dumpPythonAs(name,options)+
'\n' 1032 for name, value
in sorted(d.items()):
1033 result[name] = subfolder, value.dumpPythonAs(name, options) +
'\n' 1037 """return a string containing the equivalent process defined using python""" 1038 specialImportRegistry._reset()
1039 header =
"import FWCore.ParameterSet.Config as cms" 1040 result =
"process = cms.Process(\""+self.__name+
"\")\n\n" 1067 imports = specialImportRegistry.getSpecialImports()
1068 if len(imports) > 0:
1069 header +=
"\n" +
"\n".
join(imports)
1071 return header+result
1074 """return a map of file names to python configuration fragments""" 1075 specialImportRegistry._reset()
1077 options.isCfg =
False 1078 header =
"import FWCore.ParameterSet.Config as cms" 1083 result =
'process = cms.Process("' + self.__name +
'")\n\n' 1096 sys.stderr.write(
"error: subprocesses are not supported yet\n\n")
1113 if options.targetDirectory
is not None:
1114 files[options.targetDirectory +
'/__init__.py'] =
'' 1116 if options.useSubdirectories:
1117 for sub
in 'psets',
'modules',
'services',
'eventsetup',
'tasks',
'sequences',
'paths':
1118 if options.targetDirectory
is not None:
1119 sub = options.targetDirectory +
'/' + sub
1120 files[sub +
'/__init__.py'] =
'' 1123 parts = sorted(parts.items(), key =
lambda nsc: (nsc[1][0].lower()
if nsc[1][0]
else '', nsc[0].lower()))
1125 for (name, (subfolder, code))
in parts:
1126 filename = name +
'_cfi' 1127 if options.useSubdirectories
and subfolder:
1128 filename = subfolder +
'/' + filename
1129 if options.targetDirectory
is not None:
1130 filename = options.targetDirectory +
'/' + filename
1131 result +=
'process.load("%s")\n' % filename
1132 files[filename +
'.py'] = header +
'\n\n' + code
1135 options.isCfg =
True 1138 imports = specialImportRegistry.getSpecialImports()
1139 if len(imports) > 0:
1140 header +=
'\n' +
'\n'.
join(imports)
1141 files[
'-'] = header +
'\n\n' + result
1145 old = getattr(self,label)
1152 sequenceable._replaceIfHeldDirectly(old,new)
1154 sequenceable.replace(old,new)
1156 sequenceable.replace(old,new)
1158 sequenceable.replace(old,new)
1160 sequenceable.replace(old,new)
1162 old = getattr(self,label)
1164 task.replace(old, new)
1166 old = getattr(self,label)
1168 task.replace(old, new)
1172 old = getattr(self,label)
1174 task.replace(old, new)
1178 old = getattr(self,label)
1179 self.
schedule_()._replaceIfHeldDirectly(old, new)
1181 """ Replace the item with label 'label' by object 'new' in the process and all sequences/paths/tasks""" 1182 if not hasattr(self,label):
1183 raise LookupError(
"process has no item of label "+label)
1184 setattr(self,label,new)
1186 for name,value
in itemDict.items():
1187 value.insertInto(parameterSet, name)
1190 if not item ==
None:
1191 newlabel = item.nameInProcessDesc_(label)
1193 item.insertInto(parameterSet, newlabel)
1194 parameterSet.addVString(tracked, label, vitems)
1197 for name,value
in itemDict.items():
1198 value.appendToProcessDescList_(l, name)
1199 value.insertInto(parameterSet, name)
1202 parameterSet.addVString(tracked, label, l)
1204 modules = parameterSet.getVString(tracked, labelModules)
1205 aliases = parameterSet.getVString(tracked, labelAliases)
1206 accelerators = parameterSet.getVString(
False,
"@selected_accelerators")
1207 for name,value
in itemDict.items():
1208 value.appendToProcessDescLists_(modules, aliases, name)
1209 value.insertInto(parameterSet, name, accelerators)
1212 parameterSet.addVString(tracked, labelModules, modules)
1213 parameterSet.addVString(tracked, labelAliases, aliases)
1217 for value
in itemList:
1218 name = value.getProcessName()
1219 newLabel = value.nameInProcessDesc_(name)
1221 pset = value.getSubProcessPSet(parameterSet)
1222 subprocs.append(pset)
1225 parameterSet.addVString(tracked, label, l)
1226 parameterSet.addVPSet(
False,
"subProcesses",subprocs)
1234 for name
in self.
paths_():
1235 scheduledPaths.append(name)
1236 triggerPaths.append(name)
1238 scheduledPaths.append(name)
1239 endpaths.append(name)
1241 finalpaths.append(name)
1244 pathname = path.label_()
1246 endpaths.append(pathname)
1247 scheduledPaths.append(pathname)
1249 finalpaths.append(pathname)
1251 scheduledPaths.append(pathname)
1252 triggerPaths.append(pathname)
1254 task.resolve(self.__dict__)
1256 task.visit(scheduleTaskValidator)
1257 task.visit(nodeVisitor)
1259 endPathWithFinalPathModulesName =
"@finalPath" 1262 endpaths.append(endPathWithFinalPathModulesName)
1263 scheduledPaths.append(endPathWithFinalPathModulesName)
1265 modulesOnFinalPath = []
1266 for finalpathname
in finalpaths:
1268 iFinalPath.resolve(self.__dict__)
1269 finalpathValidator.setLabel(finalpathname)
1270 iFinalPath.visit(finalpathValidator)
1271 if finalpathValidator.filtersOnFinalpaths
or finalpathValidator.producersOnFinalpaths:
1272 names = [p.label_
for p
in finalpathValidator.filtersOnFinalpaths]
1273 names.extend( [p.label_
for p
in finalpathValidator.producersOnFinalpaths])
1274 raise RuntimeError(
"FinalPath %s has non OutputModules %s" % (finalpathname,
",".
join(names)))
1275 modulesOnFinalPath.extend(iFinalPath.moduleNames())
1276 for m
in modulesOnFinalPath:
1277 mod = getattr(self, m)
1278 setattr(mod,
"@onFinalPath", untracked.bool(
True))
1279 finalPathEndPath += mod
1281 processPSet.addVString(
True,
"@end_paths", endpaths)
1282 processPSet.addVString(
True,
"@paths", scheduledPaths)
1284 p = processPSet.newPSet()
1285 p.addVString(
True,
"@trigger_paths", triggerPaths)
1286 processPSet.addPSet(
True,
"@trigger_paths", p)
1292 condTaskModules = []
1294 pathCompositeVisitor =
CompositeVisitor(pathValidator, nodeVisitor, lister, condTaskVistor)
1295 endpathCompositeVisitor =
CompositeVisitor(endpathValidator, nodeVisitor, lister)
1296 for triggername
in triggerPaths:
1297 iPath = self.
paths_()[triggername]
1298 iPath.resolve(self.__dict__)
1299 pathValidator.setLabel(triggername)
1301 condTaskModules[:] = []
1302 iPath.visit(pathCompositeVisitor)
1304 decoratedList.append(
"#")
1305 l = list({x.label_()
for x
in condTaskModules})
1307 decoratedList.extend(l)
1308 decoratedList.append(
"@")
1309 iPath.insertInto(processPSet, triggername, decoratedList[:])
1310 for endpathname
in endpaths:
1311 if endpathname
is not endPathWithFinalPathModulesName:
1312 iEndPath = self.
endpaths_()[endpathname]
1314 iEndPath = finalPathEndPath
1315 iEndPath.resolve(self.__dict__)
1316 endpathValidator.setLabel(endpathname)
1318 iEndPath.visit(endpathCompositeVisitor)
1319 iEndPath.insertInto(processPSet, endpathname, decoratedList[:])
1320 processPSet.addVString(
False,
"@filters_on_endpaths", endpathValidator.filtersOnEndpaths)
1323 def resolve(self,keepUnresolvedSequencePlaceholders=False):
1325 x.resolve(self.__dict__,keepUnresolvedSequencePlaceholders)
1327 x.resolve(self.__dict__,keepUnresolvedSequencePlaceholders)
1329 x.resolve(self.__dict__,keepUnresolvedSequencePlaceholders)
1332 task.resolve(self.__dict__,keepUnresolvedSequencePlaceholders)
1334 def prune(self,verbose=False,keepUnresolvedSequencePlaceholders=False):
1335 """ Remove clutter from the process that we think is unnecessary: 1336 tracked PSets, VPSets and unused modules and sequences. If a Schedule has been set, then Paths and EndPaths 1337 not in the schedule will also be removed, along with an modules and sequences used only by 1338 those removed Paths and EndPaths. The keepUnresolvedSequencePlaceholders keeps also unresolved TaskPlaceholders.""" 1347 self.
resolve(keepUnresolvedSequencePlaceholders)
1349 unneededPaths = set()
1353 usedModules=set(self.
schedule_().moduleNames())
1355 schedNames = set(( x.label_()
for x
in self.
schedule_()))
1356 names = set(self.
paths)
1359 unneededPaths = names - schedNames
1360 for n
in unneededPaths:
1371 usedModules=set(temp.moduleNames())
1388 def removeUnneeded(seqOrTasks, allSequencesOrTasks):
1389 _keepSet = set(( s
for s
in seqOrTasks
if s.hasLabel_()))
1390 _availableSet = set(allSequencesOrTasks.values())
1391 _unneededSet = _availableSet-_keepSet
1392 _unneededLabels = []
1393 for s
in _unneededSet:
1394 _unneededLabels.append(s.label_())
1395 delattr(self,s.label_())
1396 return _unneededLabels
1397 unneededSeqLabels = removeUnneeded(seqs, self.
sequences)
1398 unneededTaskLabels = removeUnneeded(tasks, self.
tasks)
1400 print(
"prune removed the following:")
1401 print(
" modules:"+
",".
join(unneededModules))
1402 print(
" tasks:"+
",".
join(unneededTaskLabels))
1403 print(
" sequences:"+
",".
join(unneededSeqLabels))
1404 print(
" paths/endpaths/finalpaths:"+
",".
join(unneededPaths))
1406 moduleNames = set(d.keys())
1407 junk = moduleNames - scheduledNames
1413 """Used by the framework to convert python to C++ objects""" 1414 class ServiceInjectorAdaptor(
object):
1425 class TopLevelPSetAcessorAdaptor(
object):
1429 def __getattr__(self,attr):
1430 return getattr(self.
__ppset,attr)
1431 def getTopPSet_(self,label):
1435 def addPSet(self,tracked,name,ppset):
1436 return self.
__ppset.addPSet(tracked,name,self.__extractPSet(ppset))
1437 def addVPSet(self,tracked,name,vpset):
1438 return self.
__ppset.addVPSet(tracked,name,[self.__extractPSet(x)
for x
in vpset])
1439 def __extractPSet(self,pset):
1440 if isinstance(pset,TopLevelPSetAcessorAdaptor):
1445 processPSet.addString(
True,
"@process_name", self.
name_())
1448 all_modules.update(self.
filters_())
1451 adaptor = TopLevelPSetAcessorAdaptor(processPSet,self)
1464 all_modules_onTasksOrScheduled = { key:value
for key, value
in all_modules.items()
if value
in nodeVisitor.modules }
1465 self.
_insertManyInto(adaptor,
"@all_modules", all_modules_onTasksOrScheduled,
True)
1467 all_switches_onTasksOrScheduled = {key:value
for key, value
in all_switches.items()
if value
in nodeVisitor.modules }
1473 pTask.visit(processNodeVisitor)
1474 esProducersToEnable = {}
1476 if esProducer
in nodeVisitor.esProducers
or not (esProducer
in processNodeVisitor.esProducers):
1477 esProducersToEnable[esProducerName] = esProducer
1478 self.
_insertManyInto(adaptor,
"@all_esmodules", esProducersToEnable,
True)
1479 esSourcesToEnable = {}
1481 if esSource
in nodeVisitor.esSources
or not (esSource
in processNodeVisitor.esSources):
1482 esSourcesToEnable[esSourceName] = esSource
1483 self.
_insertManyInto(adaptor,
"@all_essources", esSourcesToEnable,
True)
1487 if serviceObject
in nodeVisitor.services
or not (serviceObject
in processNodeVisitor.services):
1488 serviceObject.insertInto(ServiceInjectorAdaptor(adaptor,services))
1489 adaptor.addVPSet(
False,
"services",services)
1501 allAccelerators = set([
"cpu"])
1502 availableAccelerators = set([
"cpu"])
1503 for acc
in self.__dict__[
'_Process__accelerators'].
values():
1504 allAccelerators.update(acc.labels())
1505 availableAccelerators.update(acc.enabledLabels())
1506 availableAccelerators = sorted(list(availableAccelerators))
1507 parameterSet.addVString(
False,
"@available_accelerators", availableAccelerators)
1510 selectedAccelerators = []
1511 if "*" in self.options.accelerators:
1512 if len(self.options.accelerators) >= 2:
1513 raise ValueError(
"process.options.accelerators may contain '*' only as the only element, now it has {} elements".
format(len(self.options.accelerators)))
1514 selectedAccelerators = availableAccelerators
1519 for pattern
in self.options.accelerators:
1520 acc = [a
for a
in availableAccelerators
if fnmatch.fnmatchcase(a, pattern)]
1522 if not any(fnmatch.fnmatchcase(a, pattern)
for a
in allAccelerators):
1523 invalid.append(pattern)
1525 resolved.update(acc)
1527 if len(invalid) != 0:
1528 raise ValueError(
"Invalid pattern{} of {} in process.options.accelerators, valid values are {} or a pattern matching to some of them.".
format(
1529 "s" if len(invalid) > 2
else "",
1531 ",".
join(sorted(list(allAccelerators)))))
1532 selectedAccelerators = sorted(list(resolved))
1533 parameterSet.addVString(
False,
"@selected_accelerators", selectedAccelerators)
1536 wrapped = ProcessForProcessAccelerator(self)
1537 for acc
in self.__dict__[
'_Process__accelerators'].
values():
1538 acc.apply(wrapped, selectedAccelerators)
1541 """Prefer this ES source or producer. The argument can 1542 either be an object label, e.g., 1543 process.prefer(process.juicerProducer) (not supported yet) 1544 or a name of an ESSource or ESProducer 1545 process.prefer("juicer") 1546 or a type of unnamed ESSource or ESProducer 1547 process.prefer("JuicerProducer") 1548 In addition, you can pass as a labelled arguments the name of the Record you wish to 1549 prefer where the type passed is a cms.vstring and that vstring can contain the 1550 name of the C++ types in the Record that are being preferred, e.g., 1551 #prefer all data in record 'OrangeRecord' from 'juicer' 1552 process.prefer("juicer", OrangeRecord=cms.vstring()) 1554 #prefer only "Orange" data in "OrangeRecord" from "juicer" 1555 process.prefer("juicer", OrangeRecord=cms.vstring("Orange")) 1557 #prefer only "Orange" data with label "ExtraPulp" in "OrangeRecord" from "juicer" 1558 ESPrefer("ESJuicerProd", OrangeRecord=cms.vstring("Orange/ExtraPulp")) 1561 if isinstance(esmodule, ESSource)
or isinstance(esmodule, ESProducer):
1562 raise RuntimeError(
"Syntax of process.prefer(process.esmodule) not supported yet")
1567 raise RuntimeError(
"Cannot resolve prefer for "+repr(esmodule))
1572 typ = d[esname].type_()
1581 for name, value
in d.items():
1582 if value.type_() == esname:
1584 raise RuntimeError(
"More than one ES module for "+esname)
1592 if isinstance(process, Process):
1594 elif isinstance(process, str):
1601 raise TypeError(
'a ProcessFragment can only be constructed from an existig Process or from process name')
1603 return [ x
for x
in dir(self.
__process)
if isinstance(getattr(self.
__process, x), _ConfigureComponent) ]
1605 if name ==
'_ProcessFragment__process':
1606 return object.__getattribute__(self,
'_ProcessFragment__process')
1610 if name ==
'_ProcessFragment__process':
1611 object.__setattr__(self, name, value)
1615 if name ==
'_ProcessFragment__process':
1622 """a dictionary with fixed keys""" 1624 raise AttributeError(
"An FilteredStream defintion cannot be modified after creation.")
1625 _blocked_attribute = property(_blocked_attribute)
1626 __setattr__ = __delitem__ = __setitem__ = clear = _blocked_attribute
1627 pop = popitem = setdefault = update = _blocked_attribute
1629 new = dict.__new__(cls)
1630 dict.__init__(new, *args, **kw)
1631 keys = sorted(kw.keys())
1632 if keys != [
'content',
'dataTier',
'name',
'paths',
'responsible',
'selectEvents']:
1633 raise ValueError(
"The needed parameters are: content, dataTier, name, paths, responsible, selectEvents")
1634 if not isinstance(kw[
'name'],str):
1635 raise ValueError(
"name must be of type string")
1636 if not isinstance(kw[
'content'], vstring)
and not isinstance(kw[
'content'],str):
1637 raise ValueError(
"content must be of type vstring or string")
1638 if not isinstance(kw[
'dataTier'], string):
1639 raise ValueError(
"dataTier must be of type string")
1640 if not isinstance(kw[
'selectEvents'], PSet):
1641 raise ValueError(
"selectEvents must be of type PSet")
1642 if not isinstance(kw[
'paths'],(tuple, Path)):
1643 raise ValueError(
"'paths' must be a tuple of paths")
1648 return "FilteredStream object: %s" %self[
"name"]
1653 """Allows embedding another process within a parent process. This allows one to 1654 chain processes together directly in one cmsRun job rather than having to run 1655 separate jobs that are connected via a temporary file. 1657 def __init__(self,process, SelectEvents = untracked.PSet(), outputCommands = untracked.vstring()):
1660 if not isinstance(process, Process):
1661 raise ValueError(
"the 'process' argument must be of type cms.Process")
1662 if not isinstance(SelectEvents,PSet):
1663 raise ValueError(
"the 'SelectEvents' argument must be of type cms.untracked.PSet")
1664 if not isinstance(outputCommands,vstring):
1665 raise ValueError(
"the 'outputCommands' argument must be of type cms.untracked.vstring")
1670 if self.
__process.MessageLogger
is not MessageLogger:
1671 print(
"""Warning: You have reconfigured service 1672 'edm::MessageLogger' in a subprocess. 1673 This service has already been configured. 1674 This particular service may not be reconfigured in a subprocess. 1675 The reconfiguration will be ignored.""")
1678 out =
"parentProcess"+
str(
hash(self))+
" = process\n" 1680 out +=
"childProcess = process\n" 1681 out +=
"process = parentProcess"+
str(
hash(self))+
"\n" 1697 process._placeSubProcess(
'subProcess',self)
1699 topPSet = parameterSet.newPSet()
1701 subProcessPSet = parameterSet.newPSet()
1704 subProcessPSet.addPSet(
False,
"process",topPSet)
1705 return subProcessPSet
1708 """Helper class for Modifier that takes key/value pairs and uses them to reset parameters of the object""" 1715 params[k] = getattr(obj,k)
1719 setattr(obj,k,params[k])
1725 raise KeyError(
"Unknown parameter name "+key+
" specified while calling Modifier")
1728 """A helper base class for _AndModifier, _InvertModifier, and _OrModifier to contain the common code""" 1734 Modifier._toModifyCheck(obj,func,**kw)
1735 if not self._isChosen():
1737 Modifier._toModify(obj,func,**kw)
1739 Modifier._toReplaceWithCheck(toObj,fromObj)
1740 if not self._isChosen():
1742 Modifier._toReplaceWith(toObj,fromObj)
1744 """This is used to create a ProcessModifer that can perform actions on the process as a whole. 1745 This takes as argument a callable object (e.g. function) that takes as its sole argument an instance of Process. 1746 In order to work, the value returned from this function must be assigned to a uniquely named variable.""" 1756 """A modifier which only applies if multiple Modifiers are chosen""" 1758 super(_AndModifier,self).
__init__(lhs, rhs)
1763 """A modifier which only applies if a Modifier is not chosen""" 1765 super(_InvertModifier,self).
__init__(lhs)
1770 """A modifier which only applies if at least one of multiple Modifiers is chosen""" 1772 super(_OrModifier,self).
__init__(lhs, rhs)
1778 """This class is used to define standard modifications to a Process. 1779 An instance of this class is declared to denote a specific modification,e.g. era2017 could 1780 reconfigure items in a process to match our expectation of running in 2017. Once declared, 1781 these Modifier instances are imported into a configuration and items that need to be modified 1782 are then associated with the Modifier and with the action to do the modification. 1783 The registered modifications will only occur if the Modifier was passed to 1784 the cms.Process' constructor. 1790 """This is used to create a ProcessModifer that can perform actions on the process as a whole. 1791 This takes as argument a callable object (e.g. function) that takes as its sole argument an instance of Process. 1792 In order to work, the value returned from this function must be assigned to a uniquely named variable. 1797 if func
is not None and len(kw) != 0:
1798 raise TypeError(
"toModify takes either two arguments or one argument and key/value pairs")
1800 """This is used to register an action to be performed on the specific object. Two different forms are allowed 1801 Form 1: A callable object (e.g. function) can be passed as the second. This callable object is expected to take one argument 1802 that will be the object passed in as the first argument. 1803 Form 2: A list of parameter name, value pairs can be passed 1804 mod.toModify(foo, fred=cms.int32(7), barney = cms.double(3.14)) 1805 This form can also be used to remove a parameter by passing the value of None 1806 #remove the parameter foo.fred 1807 mod.toModify(foo, fred = None) 1808 Additionally, parameters embedded within PSets can also be modified using a dictionary 1809 #change foo.fred.pebbles to 3 and foo.fred.friend to "barney" 1810 mod.toModify(foo, fred = dict(pebbles = 3, friend = "barney)) ) 1812 Modifier._toModifyCheck(obj,func,**kw)
1815 Modifier._toModify(obj,func,**kw)
1818 if func
is not None:
1825 if not isinstance(fromObj, type(toObj)):
1826 raise TypeError(
"toReplaceWith requires both arguments to be the same class type")
1828 """If the Modifier is chosen the internals of toObj will be associated with the internals of fromObj 1830 Modifier._toReplaceWithCheck(toObj,fromObj)
1833 Modifier._toReplaceWith(toObj,fromObj)
1836 if isinstance(fromObj,_ModuleSequenceType):
1837 toObj._seq = fromObj._seq
1838 toObj._tasks = fromObj._tasks
1839 elif isinstance(fromObj,Task):
1840 toObj._collection = fromObj._collection
1841 elif isinstance(fromObj,ConditionalTask):
1842 toObj._collection = fromObj._collection
1843 elif isinstance(fromObj,_Parameterizable):
1845 for p
in toObj.parameterNames_():
1847 for p
in fromObj.parameterNames_():
1848 setattr(toObj,p,getattr(fromObj,p))
1849 if isinstance(fromObj,_TypedParameterizable):
1850 toObj._TypedParameterizable__type = fromObj._TypedParameterizable__type
1853 raise TypeError(
"toReplaceWith does not work with type "+
str(type(toObj)))
1856 """Should only be called by cms.Process instances""" 1867 return self == other
1871 """A Modifier made up of a list of Modifiers 1877 """Should only be called by cms.Process instances 1878 applies list of accumulated changes to the process""" 1880 m._applyNewProcessModifiers(process)
1882 """Should only be called by cms.Process instances""" 1889 """Creates a new ModifierChain which is a copy of 1890 this ModifierChain but excludes any Modifier or 1891 ModifierChain in the list toExclude. 1892 The exclusion is done recursively down the chain. 1896 if m
not in toExclude:
1898 if isinstance(m,ModifierChain):
1899 s = m.__copyIfExclude(toExclude)
1915 if m._isOrContains(other):
1920 """A class used by a Modifier to affect an entire Process instance. 1921 When a Process 'loads' a module containing a ProcessModifier, that 1922 ProcessModifier will be applied to the Process if and only if the 1923 Modifier passed to the constructor has been chosen. 1936 """A class used to specify possible compute accelerators in a Process 1937 instance. It is intended to be derived for any 1938 accelerator/portability technology, and provides hooks such that a 1939 specific customization can be applied to the Process on a worker 1940 node at the point where the python configuration is serialized for C++. 1942 The customization must not change the configuration hash. To 1943 enforce this reuirement, the customization gets a 1944 ProcessForProcessAccelerator wrapper that gives access to only 1945 those parts of the configuration that can be changed. Nevertheless 1946 it would be good to have specific unit test for each deriving 1947 class to ensure that all combinations of the enabled accelerators 1948 give the same configuration hash. 1953 proc._placeAccelerator(self.type_(), self)
1955 return type(self).__name__
1957 specialImportRegistry.registerUse(self)
1958 result = self.__class__.__name__+
"(" 1963 result +=
"\n"+res+
"\n" 1969 """Override if need to add any 'body' content to dumpPython(). Returns a string.""" 1972 """Override to return a list of strings for the accelerator labels.""" 1975 """Override to return a list of strings for the accelerator labels 1976 that are enabled in the system the job is being run on.""" 1979 """Override if need to customize the Process at worker node. The 1980 selected available accelerator labels are given in the 1981 'accelerators' argument (the patterns, e.g. '*' have been 1982 expanded to concrete labels). 1984 This function may touch only untracked parameters. 1989 """This class is inteded to wrap the Process object to constrain the 1990 available functionality for ProcessAccelerator.apply()""" 1995 if not isinstance(value, Service):
1996 raise TypeError(
"ProcessAccelerator.apply() can get only Services. Tried to get {} with label {}".
format(
str(type(value)), label))
1999 if label ==
"_ProcessForProcessAccelerator__process":
2002 if not isinstance(value, Service):
2003 raise TypeError(
"ProcessAccelerator.apply() can only set Services. Tried to set {} with label {}".
format(
str(type(value)), label))
2006 if not isinstance(value, Service):
2007 raise TypeError(
"ProcessAccelerator.apply() can only add Services. Tried to set {} with label {}".
format(
str(type(value)), label))
2013 return (
"test1" in accelerators, -10)
2015 return (
"test2" in accelerators, -9)
2017 if __name__==
"__main__":
2022 newString = ( x
for x
in newString.split(
'\n')
if len(x) > 0)
2023 oldString = [ x
for x
in oldString.split(
'\n')
if len(x) > 0]
2027 if oldStringLine >= len(oldString):
2030 if l == oldString[oldStringLine]:
2034 return "\n".
join( diff )
2037 """Has same interface as the C++ object that creates PSets 2042 self.
values[label]=(tracked,value)
2044 pair = self.
values[label]
2045 if pair[0] != tracked:
2046 raise Exception(
"Asked for %s parameter '%s', but it is %s" % (
"tracked" if tracked
else "untracked",
2048 "tracked" if pair[0]
else "untracked"))
2109 super(SwitchProducerTest,self).
__init__(
2111 test1 =
lambda accelerators: (
True, -10),
2112 test2 =
lambda accelerators: (
True, -9),
2113 test3 =
lambda accelerators: (
True, -8),
2114 test4 =
lambda accelerators: (
True, -7)
2116 specialImportRegistry.registerSpecialImportForType(SwitchProducerTest,
"from test import SwitchProducerTest")
2120 super(SwitchProducerTest2,self).
__init__(
2122 test1 = _switchproducer_test2_case1,
2123 test2 = _switchproducer_test2_case2,
2125 specialImportRegistry.registerSpecialImportForType(SwitchProducerTest2,
"from test import SwitchProducerTest2")
2128 def __init__(self, enabled=["test1", "test2", "anothertest3"]):
2129 super(ProcessAcceleratorTest,self).
__init__()
2133 invalid = set(enabled).difference(set(self.
_labels))
2134 if len(invalid) > 0:
2135 raise Exception(
"Tried to enabled nonexistent test accelerators {}".
format(
",".
join(invalid)))
2138 result =
"{}enabled = [{}]".
format(options.indentation(),
2146 process.AcceleratorTestService =
Service(
"AcceleratorTestService")
2147 specialImportRegistry.registerSpecialImportForType(ProcessAcceleratorTest,
"from test import ProcessAcceleratorTest")
2150 def __init__(self, enabled=["anothertest3", "anothertest4"]):
2151 super(ProcessAcceleratorTest2,self).
__init__()
2155 invalid = set(enabled).difference(set(self.
_labels))
2156 if len(invalid) > 0:
2157 raise Exception(
"Tried to enabled nonexistent test accelerators {}".
format(
",".
join(invalid)))
2160 result =
"{}enabled = [{}]".
format(options.indentation(),
2169 specialImportRegistry.registerSpecialImportForType(ProcessAcceleratorTest2,
"from test import ProcessAcceleratorTest2")
2173 """Nothing to do """ 2177 self.assertEqual(len(p.parameterNames_()),0)
2179 self.assertTrue(
'a' in p.parameterNames_())
2180 self.assertEqual(p.a.value(), 1)
2182 self.assertEqual(p.a.value(), 10)
2184 self.assertEqual(p.a.value(), 1)
2185 self.assertFalse(p.a.isTracked())
2186 p.a = untracked.int32(1)
2187 self.assertEqual(p.a.value(), 1)
2188 self.assertFalse(p.a.isTracked())
2190 self.assertEqual(p.foo.value(), 10)
2191 self.assertEqual(p.bar.value(),1.0)
2192 self.assertFalse(p.bar.isTracked())
2193 self.assertRaises(TypeError,setattr,(p,
'c',1))
2195 self.assertEqual(p.a.foo.value(),10)
2196 self.assertEqual(p.a.bar.value(),1.0)
2198 self.assertEqual(p.b.fii.value(),1)
2199 self.assertFalse(p.b.isTracked())
2204 self.assertEqual(p.a.value(),11)
2206 self.assertEqual(p.a.value(),12)
2207 self.assertEqual(v.value(),12)
2213 self.assertNotEqual(p.b,other.b)
2218 self.assertTrue(
'a' in p.analyzers_() )
2219 self.assertTrue(
'a' in p.analyzers)
2220 p.add_(
Service(
"SomeService"))
2221 self.assertTrue(
'SomeService' in p.services_())
2222 self.assertEqual(p.SomeService.type_(),
"SomeService")
2224 self.assertTrue(
'Tracer' in p.services_())
2225 self.assertRaises(TypeError, setattr, *(p,
'b',
"this should fail"))
2226 self.assertRaises(TypeError, setattr, *(p,
'bad',
Service(
"MessageLogger")))
2227 self.assertRaises(ValueError, setattr, *(p,
'bad',
Source(
"PoolSource")))
2229 self.assertEqual(p.out.type_(),
'Outer')
2230 self.assertTrue(
'out' in p.outputModules_() )
2233 self.assertTrue(
'geom' in p.es_sources_())
2235 self.assertTrue(
'ConfigDB' in p.es_sources_())
2238 self.assertTrue(
'aliasfoo1' in p.aliases_())
2243 for name
in args.keys():
2244 self.__dict__[name]=args[name]
2263 self.assertEqual(p.a.type_(),
"MyAnalyzer")
2264 self.assertEqual(p.a.label_(),
"a")
2265 self.assertRaises(AttributeError,getattr,p,
'b')
2266 self.assertEqual(p.Full.type_(),
"Full")
2267 self.assertEqual(
str(p.c),
'a')
2268 self.assertEqual(
str(p.d),
'a')
2283 self.assertRaises(ValueError, p1.extend, z1)
2292 aaa=copy.deepcopy(a),
2293 s4=copy.deepcopy(s3),
2300 self.assertEqual(p2.s4.label_(),
"s4")
2302 self.assertRaises(ValueError, p2.s4.setLabel,
"foo")
2303 p2.s4.setLabel(
"s4")
2304 p2.s4.setLabel(
None)
2305 p2.s4.setLabel(
"foo")
2306 p2._Process__setObjectLabel(p2.s4,
"foo")
2307 p2._Process__setObjectLabel(p2.s4,
None)
2308 p2._Process__setObjectLabel(p2.s4,
"bar")
2315 self.assertRaises(ValueError, p.extend, FromArg(a =
EDProducer(
"YourProducer")))
2316 self.assertRaises(ValueError, p.extend, FromArg(a =
EDAlias()))
2317 self.assertRaises(ValueError, p.__setattr__,
"a",
EDAlias())
2323 self.assertRaises(ValueError, p.extend, FromArg(a =
EDProducer(
"YourProducer")))
2324 self.assertRaises(ValueError, p.extend, FromArg(a =
EDAlias()))
2325 self.assertRaises(ValueError, p.__setattr__,
"a",
EDAlias())
2331 self.assertRaises(ValueError, p.extend, FromArg(a =
EDProducer(
"YourProducer")))
2332 self.assertRaises(ValueError, p.extend, FromArg(a =
EDAlias()))
2333 self.assertRaises(ValueError, p.__setattr__,
"a",
EDAlias())
2337 """import FWCore.ParameterSet.Config as cms 2339 process = cms.Process("test") 2341 process.maxEvents = cms.untracked.PSet( 2342 input = cms.optional.untracked.int32, 2343 output = cms.optional.untracked.allowed(cms.int32,cms.PSet) 2346 process.maxLuminosityBlocks = cms.untracked.PSet( 2347 input = cms.untracked.int32(-1) 2350 process.options = cms.untracked.PSet( 2351 FailPath = cms.untracked.vstring(), 2352 IgnoreCompletely = cms.untracked.vstring(), 2353 Rethrow = cms.untracked.vstring(), 2354 SkipEvent = cms.untracked.vstring(), 2355 accelerators = cms.untracked.vstring('*'), 2356 allowUnscheduled = cms.obsolete.untracked.bool, 2357 canDeleteEarly = cms.untracked.vstring(), 2358 deleteNonConsumedUnscheduledModules = cms.untracked.bool(True), 2359 dumpOptions = cms.untracked.bool(False), 2360 emptyRunLumiMode = cms.obsolete.untracked.string, 2361 eventSetup = cms.untracked.PSet( 2362 forceNumberOfConcurrentIOVs = cms.untracked.PSet( 2363 allowAnyLabel_=cms.required.untracked.uint32 2365 numberOfConcurrentIOVs = cms.untracked.uint32(0) 2367 fileMode = cms.untracked.string('FULLMERGE'), 2368 forceEventSetupCacheClearOnNewRun = cms.untracked.bool(False), 2369 makeTriggerResults = cms.obsolete.untracked.bool, 2370 numberOfConcurrentLuminosityBlocks = cms.untracked.uint32(0), 2371 numberOfConcurrentRuns = cms.untracked.uint32(1), 2372 numberOfStreams = cms.untracked.uint32(0), 2373 numberOfThreads = cms.untracked.uint32(1), 2374 printDependencies = cms.untracked.bool(False), 2375 sizeOfStackForThreadsInKB = cms.optional.untracked.uint32, 2376 throwIfIllegalParameter = cms.untracked.bool(True), 2377 wantSummary = cms.untracked.bool(False) 2380 process.MessageLogger = cms.Service("MessageLogger", 2381 cerr = cms.untracked.PSet( 2382 FwkReport = cms.untracked.PSet( 2383 limit = cms.untracked.int32(10000000), 2384 reportEvery = cms.untracked.int32(1) 2386 FwkSummary = cms.untracked.PSet( 2387 limit = cms.untracked.int32(10000000), 2388 reportEvery = cms.untracked.int32(1) 2390 INFO = cms.untracked.PSet( 2391 limit = cms.untracked.int32(0) 2393 Root_NoDictionary = cms.untracked.PSet( 2394 limit = cms.untracked.int32(0) 2396 default = cms.untracked.PSet( 2397 limit = cms.untracked.int32(10000000) 2399 enable = cms.untracked.bool(True), 2400 enableStatistics = cms.untracked.bool(False), 2401 lineLength = cms.optional.untracked.int32, 2402 noLineBreaks = cms.optional.untracked.bool, 2403 noTimeStamps = cms.untracked.bool(False), 2404 resetStatistics = cms.untracked.bool(False), 2405 statisticsThreshold = cms.untracked.string('WARNING'), 2406 threshold = cms.untracked.string('INFO'), 2407 allowAnyLabel_=cms.optional.untracked.PSetTemplate( 2408 limit = cms.optional.untracked.int32, 2409 reportEvery = cms.untracked.int32(1), 2410 timespan = cms.optional.untracked.int32 2413 cout = cms.untracked.PSet( 2414 enable = cms.untracked.bool(False), 2415 enableStatistics = cms.untracked.bool(False), 2416 lineLength = cms.optional.untracked.int32, 2417 noLineBreaks = cms.optional.untracked.bool, 2418 noTimeStamps = cms.optional.untracked.bool, 2419 resetStatistics = cms.untracked.bool(False), 2420 statisticsThreshold = cms.optional.untracked.string, 2421 threshold = cms.optional.untracked.string, 2422 allowAnyLabel_=cms.optional.untracked.PSetTemplate( 2423 limit = cms.optional.untracked.int32, 2424 reportEvery = cms.untracked.int32(1), 2425 timespan = cms.optional.untracked.int32 2428 debugModules = cms.untracked.vstring(), 2429 default = cms.untracked.PSet( 2430 limit = cms.optional.untracked.int32, 2431 lineLength = cms.untracked.int32(80), 2432 noLineBreaks = cms.untracked.bool(False), 2433 noTimeStamps = cms.untracked.bool(False), 2434 reportEvery = cms.untracked.int32(1), 2435 statisticsThreshold = cms.untracked.string('INFO'), 2436 threshold = cms.untracked.string('INFO'), 2437 timespan = cms.optional.untracked.int32, 2438 allowAnyLabel_=cms.optional.untracked.PSetTemplate( 2439 limit = cms.optional.untracked.int32, 2440 reportEvery = cms.untracked.int32(1), 2441 timespan = cms.optional.untracked.int32 2444 files = cms.untracked.PSet( 2445 allowAnyLabel_=cms.optional.untracked.PSetTemplate( 2446 enableStatistics = cms.untracked.bool(False), 2447 extension = cms.optional.untracked.string, 2448 filename = cms.optional.untracked.string, 2449 lineLength = cms.optional.untracked.int32, 2450 noLineBreaks = cms.optional.untracked.bool, 2451 noTimeStamps = cms.optional.untracked.bool, 2452 output = cms.optional.untracked.string, 2453 resetStatistics = cms.untracked.bool(False), 2454 statisticsThreshold = cms.optional.untracked.string, 2455 threshold = cms.optional.untracked.string, 2456 allowAnyLabel_=cms.optional.untracked.PSetTemplate( 2457 limit = cms.optional.untracked.int32, 2458 reportEvery = cms.untracked.int32(1), 2459 timespan = cms.optional.untracked.int32 2463 suppressDebug = cms.untracked.vstring(), 2464 suppressFwkInfo = cms.untracked.vstring(), 2465 suppressInfo = cms.untracked.vstring(), 2466 suppressWarning = cms.untracked.vstring(), 2467 allowAnyLabel_=cms.optional.untracked.PSetTemplate( 2468 limit = cms.optional.untracked.int32, 2469 reportEvery = cms.untracked.int32(1), 2470 timespan = cms.optional.untracked.int32 2485 """process.a = cms.EDAnalyzer("MyAnalyzer") 2486 process.s = cms.Sequence(process.a) 2487 process.r = cms.Sequence(process.s) 2488 process.p = cms.Path(process.a) 2489 process.p2 = cms.Path(process.s) 2490 process.schedule = cms.Schedule(*[ process.p2, process.p ])""")
2502 """process.a = cms.EDAnalyzer("MyAnalyzer") 2503 process.b = cms.EDAnalyzer("YourAnalyzer") 2504 process.r = cms.Sequence(process.a) 2505 process.s = cms.Sequence(process.r) 2506 process.p = cms.Path(process.a) 2507 process.p2 = cms.Path(process.r) 2508 process.schedule = cms.Schedule(*[ process.p2, process.p ])""")
2519 """process.a = cms.EDAnalyzer("MyAnalyzer") 2520 process.r = cms.Sequence((process.a)) 2521 process.p = cms.Path(process.a) 2522 process.p2 = cms.Path(process.r) 2523 process.schedule = cms.Schedule(*[ process.p2, process.p ])""")
2539 p.task3.add(p.task1)
2543 p.p2 =
Path(p.r, p.task1, p.task2)
2544 p.schedule =
Schedule(p.p2,p.p,tasks=[p.task3,p.task4, p.task5])
2547 """process.b = cms.EDProducer("bProducer") 2548 process.c = cms.EDProducer("cProducer") 2549 process.d = cms.EDProducer("dProducer") 2550 process.e = cms.EDProducer("eProducer") 2551 process.f = cms.EDProducer("fProducer") 2552 process.g = cms.EDProducer("gProducer") 2553 process.a = cms.EDAnalyzer("MyAnalyzer") 2554 process.task5 = cms.Task() 2555 process.task1 = cms.Task(process.task5) 2556 process.task3 = cms.Task(process.task1) 2557 process.task2 = cms.Task(process.c, process.task3) 2558 process.task4 = cms.Task(process.f, process.task2) 2559 process.r = cms.Sequence((process.a)) 2560 process.p = cms.Path(process.a) 2561 process.p2 = cms.Path(process.r, process.task1, process.task2) 2562 process.schedule = cms.Schedule(*[ process.p2, process.p ], tasks=[process.task3, process.task4, process.task5])""")
2579 p.p2 =
Path(p.r, p.task1, p.task2)
2580 p.schedule =
Schedule(p.p2,p.p,tasks=[p.task5])
2583 """process.b = cms.EDProducer("bProducer") 2584 process.c = cms.EDProducer("cProducer") 2585 process.d = cms.EDProducer("dProducer") 2586 process.e = cms.EDProducer("eProducer") 2587 process.f = cms.EDProducer("fProducer") 2588 process.g = cms.EDProducer("gProducer") 2589 process.a = cms.EDAnalyzer("MyAnalyzer") 2590 process.task5 = cms.Task() 2591 process.task3 = cms.Task() 2592 process.task2 = cms.ConditionalTask(process.c, process.task3) 2593 process.task1 = cms.ConditionalTask(process.task5) 2594 process.r = cms.Sequence((process.a)) 2595 process.p = cms.Path(process.a) 2596 process.p2 = cms.Path(process.r, process.task1, process.task2) 2597 process.schedule = cms.Schedule(*[ process.p2, process.p ], tasks=[process.task5])""")
2604 p.task1 =
Task(p.d, p.e)
2605 task2 =
Task(p.f, p.g)
2606 p.schedule =
Schedule(tasks=[p.task1,task2])
2609 """process.d = cms.EDProducer("dProducer") 2610 process.e = cms.EDProducer("eProducer") 2611 process.f = cms.EDProducer("fProducer") 2612 process.g = cms.EDProducer("gProducer") 2613 process.task1 = cms.Task(process.d, process.e) 2614 process.schedule = cms.Schedule(tasks=[cms.Task(process.f, process.g), process.task1])""")
2620 """process.schedule = cms.Schedule()""")
2629 d=process.dumpPython()
2631 """process.a = cms.EDProducer("A") 2632 process.s2 = cms.Sequence(process.a)""")
2642 d=process.dumpPython()
2644 """process.a = cms.EDProducer("A") 2645 process.s2 = cms.Sequence(process.a+(process.a+process.a))""")
2671 p.p =
Path(p.c+s+p.a)
2672 p.p2 =
Path(p.c+p.s4+p.a, p.ct1)
2678 self.assertTrue(visitor1.modules == set([old,old2,p.b,p.c]))
2680 p.globalReplace(
"a",new)
2681 p.globalReplace(
"d",new2)
2684 self.assertTrue(visitor2.modules == set([new,new2,p.b,p.c]))
2685 self.assertEqual(p.p.dumpPython()[:-1],
"cms.Path(process.c+process.a+process.b+process.a, cms.Task(process.d))")
2687 p.p2.visit(visitor_p2)
2688 self.assertTrue(visitor_p2.modules == set([new,new2,p.b,p.c]))
2689 self.assertEqual(p.p2.dumpPython()[:-1],
"cms.Path(process.c+process.s4+process.a, process.ct1)")
2691 p.e3.visit(visitor3)
2692 self.assertTrue(visitor3.modules == set([new,new2,p.b,p.c]))
2694 p.s4.visit(visitor4)
2695 self.assertTrue(visitor4.modules == set([new,new2,p.b]))
2696 self.assertEqual(p.s4.dumpPython()[:-1],
"cms.Sequence(process.a+process.b, cms.Task(process.d), process.ct1)")
2698 p.t1.visit(visitor5)
2699 self.assertTrue(visitor5.modules == set([new2]))
2701 listOfTasks = list(p.schedule._tasks)
2702 listOfTasks[0].visit(visitor6)
2703 self.assertTrue(visitor6.modules == set([new2]))
2705 p.ct1.visit(visitor7)
2706 self.assertTrue(visitor7.modules == set([new2]))
2708 listOfConditionalTasks = list(p.conditionaltasks.values())
2709 listOfConditionalTasks[0].visit(visitor8)
2710 self.assertTrue(visitor8.modules == set([new2]))
2714 p.schedule =
Schedule(p.p, p.p2, p.e3, tasks=[p.t1])
2715 self.assertEqual(p.schedule.dumpPython()[:-1],
"cms.Schedule(*[ process.p, process.p2, process.e3 ], tasks=[process.t1])")
2717 self.assertEqual(p.schedule.dumpPython()[:-1],
"cms.Schedule(*[ process.p, process.p2, process.e3 ], tasks=[process.t1])")
2719 self.assertEqual(p.schedule.dumpPython()[:-1],
"cms.Schedule(*[ process.p, process.p2, process.e3 ], tasks=[process.t1])")
2721 self.assertEqual(p.schedule.dumpPython()[:-1],
"cms.Schedule(*[ process.p, process.p2, process.e3 ], tasks=[process.t1])")
2729 self.assertEqual(
str(p.s),
'a+b')
2730 self.assertEqual(p.s.label_(),
's')
2731 path =
Path(p.c+p.s)
2732 self.assertEqual(
str(path),
'c+a+b')
2733 p._validateSequence(path,
'p1')
2735 p2 =
Path(p.c+p.s*notInProcess)
2736 self.assertRaises(RuntimeError, p._validateSequence, p2,
'p2')
2746 self.assertRaises(ValueError, p.__setattr__,
"y", testseq)
2750 self.assertFalse(service._inProcess)
2753 self.assertTrue(service._inProcess)
2755 process.d = service2
2756 self.assertFalse(service._inProcess)
2757 self.assertTrue(service2._inProcess)
2759 self.assertFalse(service2._inProcess)
2773 service3 =
Service(
"d", v = untracked.uint32(3))
2779 testTask1 =
Task(edproducer, edfilter)
2780 self.assertRaises(RuntimeError, testTask1.add, edanalyzer)
2781 testTask1.add(essource, service)
2782 testTask1.add(essource, esproducer)
2783 testTask1.add(testTask2)
2784 coll = testTask1._collection
2785 self.assertTrue(edproducer
in coll)
2786 self.assertTrue(edfilter
in coll)
2787 self.assertTrue(service
in coll)
2788 self.assertTrue(essource
in coll)
2789 self.assertTrue(esproducer
in coll)
2790 self.assertTrue(testTask2
in coll)
2791 self.assertTrue(len(coll) == 6)
2792 self.assertTrue(len(testTask2._collection) == 0)
2796 taskContents.append(i)
2797 self.assertTrue(taskContents == [edproducer, edfilter, essource, service, esproducer, testTask2])
2802 process.mproducer = edproducer
2803 process.mproducer2 = edproducer2
2804 process.mfilter = edfilter
2805 process.messource = essource
2806 process.mesproducer = esproducer
2809 testTask3 =
Task(edproducer, edproducer2)
2810 testTask1.add(testTask3)
2811 process.myTask1 = testTask1
2818 testTask1.visit(visitor)
2819 self.assertTrue(l == set([
'mesproducer',
'mproducer',
'mproducer2',
'mfilter',
'd',
'messource']))
2820 l2 = testTask1.moduleNames
2821 self.assertTrue(l == set([
'mesproducer',
'mproducer',
'mproducer2',
'mfilter',
'd',
'messource']))
2823 testTask4 =
Task(edproducer3)
2825 self.assertRaises(RuntimeError, testTask4.visit, visitor)
2827 process.myTask4 = testTask4
2828 self.assertTrue(
False)
2829 except RuntimeError:
2832 testTask5 =
Task(service3)
2834 self.assertRaises(RuntimeError, testTask5.visit, visitor)
2836 process.myTask5 = testTask5
2837 self.assertTrue(
False)
2838 except RuntimeError:
2841 process.d = service3
2842 process.myTask5 = testTask5
2845 expectedDict = {
'myTask1' : testTask1,
'myTask5' : testTask5 }
2847 self.assertTrue(process.tasks == expectedFixedDict)
2848 self.assertTrue(process.tasks[
'myTask1'] == testTask1)
2849 self.assertTrue(process.myTask1 == testTask1)
2853 process.mproducer2 = edproducer4
2857 testTask1.visit(visitor1)
2858 l.sort(key=
lambda mod: mod.__str__())
2859 expectedList = sorted([edproducer,essource,esproducer,service,edfilter,edproducer,edproducer4],key=
lambda mod: mod.__str__())
2860 self.assertTrue(expectedList == l)
2861 process.myTask6 =
Task()
2862 process.myTask7 =
Task()
2863 process.mproducer8 = edproducer8
2864 process.myTask8 =
Task(process.mproducer8)
2865 process.myTask6.add(process.myTask7)
2866 process.myTask7.add(process.myTask8)
2867 process.myTask1.add(process.myTask6)
2868 process.myTask8.add(process.myTask5)
2870 testDict = process._itemsInDependencyOrder(process.tasks)
2871 expectedLabels = [
"myTask5",
"myTask8",
"myTask7",
"myTask6",
"myTask1"]
2872 expectedTasks = [process.myTask5, process.myTask8, process.myTask7, process.myTask6, process.myTask1]
2874 for testLabel, testTask
in testDict.items():
2875 self.assertTrue(testLabel == expectedLabels[index])
2876 self.assertTrue(testTask == expectedTasks[index])
2882 expectedPythonDump =
'cms.Task(process.d, process.mesproducer, process.messource, process.mfilter, process.mproducer, process.mproducer2, process.myTask6)\n' 2883 self.assertTrue(pythonDump == expectedPythonDump)
2885 process.myTask5 =
Task()
2886 process.myTask100 =
Task()
2887 process.mproducer9 = edproducer9
2888 sequence1 =
Sequence(process.mproducer8, process.myTask1, process.myTask5, testTask2, testTask3)
2889 sequence2 =
Sequence(process.mproducer8 + process.mproducer9)
2890 process.sequence3 =
Sequence((process.mproducer8 + process.mfilter))
2892 process.path1 =
Path(process.mproducer+process.mproducer8+sequence1+sequence2+process.sequence3+sequence4)
2893 process.path1.associate(process.myTask1, process.myTask5, testTask2, testTask3)
2894 process.path11 =
Path(process.mproducer+process.mproducer8+sequence1+sequence2+process.sequence3+ sequence4,process.myTask1, process.myTask5, testTask2, testTask3, process.myTask100)
2895 process.path2 =
Path(process.mproducer)
2896 process.path3 =
Path(process.mproducer9+process.mproducer8,testTask2)
2898 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')
2900 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')
2905 process.path1.visit(nameVisitor)
2906 self.assertTrue(l == set([
'mproducer',
'd',
'mesproducer',
None,
'mproducer9',
'mproducer8',
'messource',
'mproducer2',
'mfilter']))
2907 self.assertTrue(process.path1.moduleNames() == set([
'mproducer',
'd',
'mesproducer',
None,
'mproducer9',
'mproducer8',
'messource',
'mproducer2',
'mfilter']))
2911 process.path21 = process.path11.copy()
2912 process.path21.replace(process.mproducer, process.mproducer10)
2914 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')
2923 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.mproducer8, process.myTask5), process.myTask100, process.myTask5)\n')
2925 process.path22 = process.path21.copyAndExclude([process.d, process.mesproducer, process.mfilter])
2926 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.mproducer8, process.myTask5), process.myTask100, process.myTask5)\n')
2928 process.path23 = process.path22.copyAndExclude([process.messource, process.mproducer10])
2929 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.mproducer8, process.myTask5), process.myTask100, process.myTask5)\n')
2938 process.path24 =
Path(process.a+process.b+process.c+process.d)
2939 process.path25 = process.path24.copyAndExclude([process.a,process.b,process.c])
2940 self.assertTrue(process.path25.dumpPython() ==
'cms.Path(process.d)\n')
2945 process.path200.replace(process.c,process.b)
2946 process.path200.replace(process.e,process.f)
2947 self.assertEqual(process.path200.dumpPython(),
"cms.EndPath(process.b, cms.Task(process.f))\n")
2948 process.path200.replace(process.b,process.c)
2949 process.path200.replace(process.f,process.e)
2950 self.assertEqual(process.path200.dumpPython(),
"cms.EndPath(process.c, cms.Task(process.e))\n")
2951 process.path200.replace(process.c,process.a)
2952 process.path200.replace(process.e,process.g)
2953 self.assertEqual(process.path200.dumpPython(),
"cms.EndPath(process.a, cms.Task(process.g))\n")
2954 process.path200.replace(process.a,process.c)
2955 process.path200.replace(process.g,process.e)
2956 self.assertEqual(process.path200.dumpPython(),
"cms.EndPath(process.c, cms.Task(process.e))\n")
2970 service3 =
Service(
"d", v = untracked.uint32(3))
2978 self.assertRaises(RuntimeError, testTask1.add, edanalyzer)
2979 testTask1.add(essource, service)
2980 testTask1.add(essource, esproducer)
2981 testTask1.add(testTask2)
2982 testTask1.add(testCTask2)
2983 coll = testTask1._collection
2984 self.assertTrue(edproducer
in coll)
2985 self.assertTrue(edfilter
in coll)
2986 self.assertTrue(service
in coll)
2987 self.assertTrue(essource
in coll)
2988 self.assertTrue(esproducer
in coll)
2989 self.assertTrue(testTask2
in coll)
2990 self.assertTrue(testCTask2
in coll)
2991 self.assertTrue(len(coll) == 7)
2992 self.assertTrue(len(testTask2._collection) == 0)
2996 taskContents.append(i)
2997 self.assertEqual(taskContents, [edproducer, edfilter, essource, service, esproducer, testTask2, testCTask2])
3002 process.mproducer = edproducer
3003 process.mproducer2 = edproducer2
3004 process.mfilter = edfilter
3005 process.messource = essource
3006 process.mesproducer = esproducer
3010 testTask1.add(testTask3)
3011 process.myTask1 = testTask1
3018 testTask1.visit(visitor)
3019 self.assertEqual(l, set([
'mesproducer',
'mproducer',
'mproducer2',
'mfilter',
'd',
'messource']))
3020 l2 = testTask1.moduleNames()
3021 self.assertEqual(l2, set([
'mesproducer',
'mproducer',
'mproducer2',
'mfilter',
'd',
'messource']))
3025 self.assertRaises(RuntimeError, testTask4.visit, visitor)
3027 process.myTask4 = testTask4
3028 self.assertTrue(
False)
3029 except RuntimeError:
3034 self.assertRaises(RuntimeError, testTask5.visit, visitor)
3036 process.myTask5 = testTask5
3037 self.assertTrue(
False)
3038 except RuntimeError:
3041 process.d = service3
3042 process.myTask5 = testTask5
3045 expectedDict = {
'myTask1' : testTask1,
'myTask5' : testTask5 }
3047 self.assertEqual(process.conditionaltasks, expectedFixedDict)
3048 self.assertEqual(process.conditionaltasks[
'myTask1'], testTask1)
3049 self.assertEqual(process.myTask1, testTask1)
3053 process.mproducer2 = edproducer4
3057 testTask1.visit(visitor1)
3058 l.sort(key=
lambda mod: mod.__str__())
3059 expectedList = sorted([edproducer,essource,esproducer,service,edfilter,edproducer,edproducer4],key=
lambda mod: mod.__str__())
3060 self.assertEqual(expectedList, l)
3063 process.mproducer8 = edproducer8
3065 process.myTask6.add(process.myTask7)
3066 process.myTask7.add(process.myTask8)
3067 process.myTask1.add(process.myTask6)
3068 process.myTask8.add(process.myTask5)
3069 self.assertEqual(process.myTask8.dumpPython(),
"cms.ConditionalTask(process.mproducer8, process.myTask5)\n")
3071 testDict = process._itemsInDependencyOrder(process.conditionaltasks)
3072 expectedLabels = [
"myTask5",
"myTask8",
"myTask7",
"myTask6",
"myTask1"]
3073 expectedTasks = [process.myTask5, process.myTask8, process.myTask7, process.myTask6, process.myTask1]
3075 for testLabel, testTask
in testDict.items():
3076 self.assertEqual(testLabel, expectedLabels[index])
3077 self.assertEqual(testTask, expectedTasks[index])
3083 expectedPythonDump =
'cms.ConditionalTask(process.d, process.mesproducer, process.messource, process.mfilter, process.mproducer, process.mproducer2, process.myTask6)\n' 3084 self.assertEqual(pythonDump, expectedPythonDump)
3087 self.assertEqual(process.myTask8.dumpPython(),
"cms.ConditionalTask(process.mproducer8, process.myTask5)\n")
3089 process.mproducer9 = edproducer9
3090 sequence1 =
Sequence(process.mproducer8, process.myTask1, process.myTask5, testTask2, testTask3)
3091 sequence2 =
Sequence(process.mproducer8 + process.mproducer9)
3092 process.sequence3 =
Sequence((process.mproducer8 + process.mfilter))
3094 process.path1 =
Path(process.mproducer+process.mproducer8+sequence1+sequence2+process.sequence3+sequence4)
3095 process.path1.associate(process.myTask1, process.myTask5, testTask2, testTask3)
3096 process.path11 =
Path(process.mproducer+process.mproducer8+sequence1+sequence2+process.sequence3+ sequence4,process.myTask1, process.myTask5, testTask2, testTask3, process.myTask100)
3097 process.path2 =
Path(process.mproducer)
3098 process.path3 =
Path(process.mproducer9+process.mproducer8,testTask2)
3100 self.assertEqual(process.path1.dumpPython(
PrintOptions()),
'cms.Path(process.mproducer+process.mproducer8+cms.Sequence(process.mproducer8, cms.ConditionalTask(process.None, process.mproducer), cms.Task(), process.myTask1, process.myTask5)+(process.mproducer8+process.mproducer9)+process.sequence3, cms.ConditionalTask(process.None, process.mproducer), cms.Task(), process.myTask1, process.myTask5)\n')
3102 self.assertEqual(process.path11.dumpPython(
PrintOptions()),
'cms.Path(process.mproducer+process.mproducer8+cms.Sequence(process.mproducer8, cms.ConditionalTask(process.None, process.mproducer), cms.Task(), process.myTask1, process.myTask5)+(process.mproducer8+process.mproducer9)+process.sequence3, cms.ConditionalTask(process.None, process.mproducer), cms.Task(), process.myTask1, process.myTask100, process.myTask5)\n')
3107 process.path1.visit(nameVisitor)
3108 self.assertTrue(l == set([
'mproducer',
'd',
'mesproducer',
None,
'mproducer9',
'mproducer8',
'messource',
'mproducer2',
'mfilter']))
3109 self.assertTrue(process.path1.moduleNames() == set([
'mproducer',
'd',
'mesproducer',
None,
'mproducer9',
'mproducer8',
'messource',
'mproducer2',
'mfilter']))
3113 process.path21 = process.path11.copy()
3114 process.path21.replace(process.mproducer, process.mproducer10)
3116 self.assertEqual(process.path11.dumpPython(
PrintOptions()),
'cms.Path(process.mproducer+process.mproducer8+cms.Sequence(process.mproducer8, cms.ConditionalTask(process.None, process.mproducer), cms.Task(), process.myTask1, process.myTask5)+(process.mproducer8+process.mproducer9)+process.sequence3, cms.ConditionalTask(process.None, process.mproducer), cms.Task(), process.myTask1, process.myTask100, process.myTask5)\n')
3125 self.assertEqual(process.path21.dumpPython(
PrintOptions()),
'cms.Path(process.mproducer10+process.mproducer8+process.mproducer8+(process.mproducer8+process.mproducer9)+process.sequence3, cms.ConditionalTask(process.None, process.mproducer10), cms.ConditionalTask(process.d, process.mesproducer, process.messource, process.mfilter, process.mproducer10, process.mproducer2, process.mproducer8, process.myTask5), cms.Task(), process.myTask100, process.myTask5)\n')
3127 process.path22 = process.path21.copyAndExclude([process.d, process.mesproducer, process.mfilter])
3128 self.assertEqual(process.path22.dumpPython(
PrintOptions()),
'cms.Path(process.mproducer10+process.mproducer8+process.mproducer8+(process.mproducer8+process.mproducer9)+process.mproducer8, cms.ConditionalTask(process.None, process.mproducer10), cms.ConditionalTask(process.messource, process.mproducer10, process.mproducer2, process.mproducer8, process.myTask5), cms.Task(), process.myTask100, process.myTask5)\n')
3130 process.path23 = process.path22.copyAndExclude([process.messource, process.mproducer10])
3131 self.assertEqual(process.path23.dumpPython(
PrintOptions()),
'cms.Path(process.mproducer8+process.mproducer8+(process.mproducer8+process.mproducer9)+process.mproducer8, cms.ConditionalTask(process.None), cms.ConditionalTask(process.mproducer2, process.mproducer8, process.myTask5), cms.Task(), process.myTask100, process.myTask5)\n')
3140 process.fillProcessDesc(p)
3141 self.assertEqual(p.values[
"@all_modules"], (
True, [
'b',
'b2',
'b3']))
3142 self.assertEqual(p.values[
"@paths"], (
True, [
'p']))
3143 self.assertEqual(p.values[
"p"], (
True, [
'b',
'#',
'b2',
'b3',
'@']))
3154 self.assertEqual(
str(path),
'a+b+c')
3155 path =
Path(p.a*p.b+p.c)
3156 self.assertEqual(
str(path),
'a+b+c')
3159 path =
Path(p.a+ p.b*p.c)
3160 self.assertEqual(
str(path),
'a+b+c')
3161 path =
Path(p.a*(p.b+p.c))
3162 self.assertEqual(
str(path),
'a+b+c')
3163 path =
Path(p.a*(p.b+~p.c))
3165 self.assertEqual(
str(path),
'a+b+~c')
3167 self.assertRaises(TypeError,Path,p.es)
3170 self.assertEqual(t.dumpPython(
PrintOptions()),
'cms.Path()\n')
3173 self.assertEqual(t.dumpPython(
PrintOptions()),
'cms.Path(process.a)\n')
3176 self.assertEqual(t.dumpPython(
PrintOptions()),
'cms.Path(cms.Task())\n')
3179 self.assertEqual(t.dumpPython(
PrintOptions()),
'cms.Path(process.a, cms.Task())\n')
3184 self.assertEqual(t.dumpPython(
PrintOptions()),
'cms.Path(process.a, cms.Task(), process.t1)\n')
3187 self.assertEqual(t.dumpPython(
PrintOptions()),
'cms.Path(cms.ConditionalTask())\n')
3190 self.assertEqual(t.dumpPython(
PrintOptions()),
'cms.Path(process.a, cms.ConditionalTask())\n')
3195 self.assertEqual(t.dumpPython(
PrintOptions()),
'cms.Path(process.a, cms.Task(), process.t1)\n')
3205 self.assertEqual(
str(path),
'a+b+c')
3207 self.assertEqual(
str(path),
'a+b+c')
3209 self.assertEqual(
str(path),
'a+b+c')
3211 self.assertEqual(
str(path),
'a+b+c')
3213 self.assertRaises(TypeError,FinalPath,p.es)
3216 self.assertEqual(t.dumpPython(
PrintOptions()),
'cms.FinalPath()\n')
3219 self.assertEqual(t.dumpPython(
PrintOptions()),
'cms.FinalPath(process.a)\n')
3221 self.assertRaises(TypeError, FinalPath,
Task())
3222 self.assertRaises(TypeError, FinalPath, p.a,
Task())
3226 self.assertRaises(TypeError, FinalPath, p.a, p.t1,
Task(), p.t1)
3230 self.assertRaises(TypeError, FinalPath, p.a, p.t1,
ConditionalTask(), p.t1)
3234 self.assertEqual(p.t.dumpPython(
PrintOptions()),
'cms.FinalPath(process.a)\n')
3245 p.path =
Path(p.a*p.b)
3246 lookuptable = {
id(a): p.a,
id(b): p.b}
3250 self.assertEqual(
str(path),
str(p.path))
3272 path =
Path(a * c * seq1, task1, ctask1)
3274 self.assertTrue(path.contains(a))
3275 self.assertFalse(path.contains(b))
3276 self.assertTrue(path.contains(c))
3277 self.assertFalse(path.contains(d))
3278 self.assertTrue(path.contains(e))
3279 self.assertFalse(path.contains(f))
3280 self.assertTrue(path.contains(g))
3281 self.assertTrue(path.contains(h))
3284 self.assertFalse(endpath.contains(b))
3285 self.assertTrue(endpath.contains(i))
3288 self.assertFalse(seq.contains(b))
3289 self.assertTrue(seq.contains(c))
3292 task =
Task(j, k, task2)
3293 self.assertFalse(task.contains(b))
3294 self.assertTrue(task.contains(j))
3295 self.assertTrue(task.contains(k))
3296 self.assertTrue(task.contains(l))
3300 sch =
Schedule(path, path2, tasks=[task,task3])
3301 self.assertFalse(sch.contains(b))
3302 self.assertTrue(sch.contains(a))
3303 self.assertTrue(sch.contains(c))
3304 self.assertTrue(sch.contains(e))
3305 self.assertTrue(sch.contains(g))
3306 self.assertTrue(sch.contains(n))
3307 self.assertTrue(sch.contains(j))
3308 self.assertTrue(sch.contains(k))
3309 self.assertTrue(sch.contains(l))
3310 self.assertTrue(sch.contains(m))
3314 self.assertFalse(ctask.contains(b))
3315 self.assertTrue(ctask.contains(j))
3316 self.assertTrue(ctask.contains(k))
3317 self.assertTrue(ctask.contains(l))
3318 self.assertTrue(ctask.contains(g))
3331 self.assertEqual(s[0],p.path1)
3332 self.assertEqual(s[1],p.path2)
3334 self.assertTrue(
'b' in p.schedule.moduleNames())
3335 self.assertTrue(hasattr(p,
'b'))
3336 self.assertTrue(hasattr(p,
'c'))
3337 self.assertTrue(hasattr(p,
'd'))
3338 self.assertTrue(hasattr(p,
'path1'))
3339 self.assertTrue(hasattr(p,
'path2'))
3340 self.assertTrue(hasattr(p,
'path3'))
3342 self.assertTrue(
'b' in p.schedule.moduleNames())
3343 self.assertTrue(hasattr(p,
'b'))
3344 self.assertTrue(
not hasattr(p,
'c'))
3345 self.assertTrue(
not hasattr(p,
'd'))
3346 self.assertTrue(hasattr(p,
'path1'))
3347 self.assertTrue(hasattr(p,
'path2'))
3348 self.assertTrue(
not hasattr(p,
'path3'))
3350 self.assertTrue(len(p.schedule._tasks) == 0)
3364 p.task2 =
Task(p.f, p.Tracer)
3365 s =
Schedule(p.path1,p.path2,tasks=[p.task1,p.task2,p.task1])
3366 self.assertEqual(s[0],p.path1)
3367 self.assertEqual(s[1],p.path2)
3368 self.assertTrue(len(s._tasks) == 2)
3369 self.assertTrue(p.task1
in s._tasks)
3370 self.assertTrue(p.task2
in s._tasks)
3371 listOfTasks = list(s._tasks)
3372 self.assertTrue(len(listOfTasks) == 2)
3373 self.assertTrue(p.task1 == listOfTasks[0])
3374 self.assertTrue(p.task2 == listOfTasks[1])
3376 self.assertTrue(
'b' in p.schedule.moduleNames())
3381 process2.path1 =
Path(process2.a)
3382 process2.task1 =
Task(process2.e)
3383 process2.schedule =
Schedule(process2.path1,tasks=process2.task1)
3384 listOfTasks = list(process2.schedule._tasks)
3385 self.assertTrue(listOfTasks[0] == process2.task1)
3389 self.assertEqual(s2[0],p.path1)
3390 self.assertEqual(s2[1],p.path2)
3391 self.assertTrue(len(s2._tasks) == 2)
3392 self.assertTrue(p.task1
in s2._tasks)
3393 self.assertTrue(p.task2
in s2._tasks)
3394 listOfTasks = list(s2._tasks)
3395 self.assertTrue(len(listOfTasks) == 2)
3396 self.assertTrue(p.task1 == listOfTasks[0])
3397 self.assertTrue(p.task2 == listOfTasks[1])
3399 names = s.moduleNames()
3400 self.assertTrue(names == set([
'a',
'b',
'e',
'Tracer',
'f']))
3406 self.assertRaises(RuntimeError,
lambda : p.setSchedule_(s) )
3415 self.assertTrue(
'a' in s.moduleNames())
3416 self.assertTrue(
'b' in s.moduleNames())
3417 self.assertTrue(
'c' in s.moduleNames())
3421 self.assertTrue(
'a' in s.moduleNames())
3422 self.assertTrue(
'b' in s.moduleNames())
3423 self.assertTrue(
'c' in s.moduleNames())
3432 self.assertTrue(p.schedule
is None)
3435 self.assertEqual(pths[keys[0]],p.path1)
3436 self.assertEqual(pths[keys[1]],p.path2)
3438 self.assertTrue(hasattr(p,
'a'))
3439 self.assertTrue(hasattr(p,
'b'))
3440 self.assertTrue(
not hasattr(p,
'c'))
3441 self.assertTrue(hasattr(p,
'path1'))
3442 self.assertTrue(hasattr(p,
'path2'))
3451 self.assertTrue(p.schedule
is None)
3454 self.assertEqual(pths[keys[1]],p.path1)
3455 self.assertEqual(pths[keys[0]],p.path2)
3462 self.assertEqual(p.modu.a.value(),1)
3463 self.assertEqual(p.modu.b.value(),2)
3468 self.assertTrue(
not a.isModified())
3470 self.assertTrue(a.isModified())
3472 self.assertEqual(p.a.a1.value(), 1)
3476 self.assertEqual(p.a.a1.value(), 2)
3485 self.assertRaises(ValueError, EDProducer,
'C', ps1, ps2)
3486 self.assertRaises(ValueError, EDProducer,
'C', ps1, a=
int32(3))
3490 self.assertEqual(p.options.numberOfThreads.value(),1)
3491 p.options.numberOfThreads = 8
3492 self.assertEqual(p.options.numberOfThreads.value(),8)
3494 self.assertEqual(p.options.numberOfThreads.value(),1)
3495 p.options = dict(numberOfStreams =2,
3497 self.assertEqual(p.options.numberOfThreads.value(),2)
3498 self.assertEqual(p.options.numberOfStreams.value(),2)
3502 p.maxEvents.input = 10
3503 self.assertEqual(p.maxEvents.input.value(),10)
3505 p.maxEvents.output = 10
3506 self.assertEqual(p.maxEvents.output.value(),10)
3508 p.maxEvents.output =
PSet(out=untracked.int32(10))
3509 self.assertEqual(p.maxEvents.output.out.value(), 10)
3511 p.maxEvents = untracked.PSet(input = untracked.int32(5))
3512 self.assertEqual(p.maxEvents.input.value(), 5)
3521 p.bars.foos =
'Foosball' 3522 self.assertEqual(p.bars.foos,
InputTag(
'Foosball'))
3523 p.p =
Path(p.foos*p.bars)
3525 p.add_(
Service(
"MessageLogger"))
3531 p.prefer(
"ForceSource")
3534 """process.juicer = cms.ESProducer("JuicerProducer") 3535 process.ForceSource = cms.ESSource("ForceSource") 3536 process.prefer("ForceSource") 3537 process.prefer("juicer")""")
3538 p.prefer(
"juicer",fooRcd=
vstring(
"Foo"))
3540 """process.juicer = cms.ESProducer("JuicerProducer") 3541 process.ForceSource = cms.ESSource("ForceSource") 3542 process.prefer("ForceSource") 3543 process.prefer("juicer", 3544 fooRcd = cms.vstring('Foo') 3559 self.assertEqual(process.m.p.i.value(), 4)
3569 subProcess.p =
Path(subProcess.a)
3570 subProcess.add_(
Service(
"Foo"))
3571 process.addSubProcess(
SubProcess(subProcess))
3572 d = process.dumpPython()
3573 equalD =
"""parentProcess = process 3574 process.a = cms.EDProducer("A") 3575 process.Foo = cms.Service("Foo") 3576 process.p = cms.Path(process.a) 3577 childProcess = process 3578 process = parentProcess 3579 process.addSubProcess(cms.SubProcess(process = childProcess, SelectEvents = cms.untracked.PSet( 3580 ), outputCommands = cms.untracked.vstring()))""" 3581 equalD = equalD.replace(
"parentProcess",
"parentProcess"+
str(
hash(process.subProcesses_()[0])))
3589 messageLoggerSplit =
'process.MessageLogger = cms.Service' 3591 childProcess =
Process(
'Child')
3592 del childProcess.MessageLogger
3593 combinedDump = parentDumpSplit[0] + childProcess.dumpPython() + messageLoggerSplit + parentDumpSplit[1]
3594 self.assertEqual(
_lineDiff(d, combinedDump), equalD)
3596 process.fillProcessDesc(p)
3597 self.assertEqual((
True,[
'a']),p.values[
"subProcesses"][1][0].values[
"process"][1].values[
'@all_modules'])
3598 self.assertEqual((
True,[
'p']),p.values[
"subProcesses"][1][0].values[
"process"][1].values[
'@paths'])
3599 self.assertEqual({
'@service_type':(
True,
'Foo')}, p.values[
"subProcesses"][1][0].values[
"process"][1].values[
"services"][1][0].values)
3609 proc.fillProcessDesc(p)
3610 self.assertEqual((
True,1),p.values[
"ref"][1].values[
"a"])
3611 self.assertEqual((
True,1),p.values[
"ref3"][1].values[
"a"])
3612 self.assertEqual((
True,1),p.values[
"ref2"][1].values[
"a"])
3613 self.assertEqual((
True,1),p.values[
"ref2"][1].values[
"b"][1].values[
"a"])
3614 self.assertEqual((
True,1),p.values[
"ref4"][1][0].values[
"a"])
3615 self.assertEqual((
True,1),p.values[
"ref4"][1][1].values[
"a"])
3624 self.assertEqual(proc.sp.label_(),
"sp")
3625 self.assertEqual(proc.sp.test1.label_(),
"sp@test1")
3626 self.assertEqual(proc.sp.test2.label_(),
"sp@test2")
3629 proc.s =
Sequence(proc.a + proc.sp)
3630 proc.t =
Task(proc.a, proc.sp)
3632 proc.p.associate(proc.t)
3634 proc.fillProcessDesc(p)
3635 self.assertEqual((
True,
"EDProducer"), p.values[
"sp"][1].values[
"@module_edm_type"])
3636 self.assertEqual((
True,
"SwitchProducer"), p.values[
"sp"][1].values[
"@module_type"])
3637 self.assertEqual((
True,
"sp"), p.values[
"sp"][1].values[
"@module_label"])
3638 all_cases = copy.deepcopy(p.values[
"sp"][1].values[
"@all_cases"])
3640 self.assertEqual((
True, [
"sp@test1",
"sp@test2"]), all_cases)
3641 self.assertEqual((
False,
"sp@test2"), p.values[
"sp"][1].values[
"@chosen_case"])
3642 self.assertEqual([
"a",
"sp",
"sp@test1",
"sp@test2"], p.values[
"@all_modules"][1])
3643 self.assertEqual((
True,
"EDProducer"), p.values[
"sp@test1"][1].values[
"@module_edm_type"])
3644 self.assertEqual((
True,
"Bar"), p.values[
"sp@test1"][1].values[
"@module_type"])
3645 self.assertEqual((
True,
"EDProducer"), p.values[
"sp@test2"][1].values[
"@module_edm_type"])
3646 self.assertEqual((
True,
"Foo"), p.values[
"sp@test2"][1].values[
"@module_type"])
3647 dump = proc.dumpPython()
3648 self.assertEqual(dump.find(
'@'), -1)
3649 self.assertEqual(specialImportRegistry.getSpecialImports(), [
"from test import SwitchProducerTest"])
3650 self.assertTrue(dump.find(
"\nfrom test import SwitchProducerTest\n") != -1)
3659 proc.s =
Sequence(proc.a + proc.sp)
3660 proc.t =
Task(proc.a, proc.sp)
3662 proc.p.associate(proc.t)
3664 proc.fillProcessDesc(p)
3665 self.assertEqual((
True,
"EDProducer"), p.values[
"sp"][1].values[
"@module_edm_type"])
3666 self.assertEqual((
True,
"SwitchProducer"), p.values[
"sp"][1].values[
"@module_type"])
3667 self.assertEqual((
True,
"sp"), p.values[
"sp"][1].values[
"@module_label"])
3668 all_cases = copy.deepcopy(p.values[
"sp"][1].values[
"@all_cases"])
3670 self.assertEqual((
True, [
"sp@test1",
"sp@test2"]), all_cases)
3671 self.assertEqual((
False,
"sp@test2"), p.values[
"sp"][1].values[
"@chosen_case"])
3672 self.assertEqual([
"a",
"sp",
"sp@test2"], p.values[
"@all_modules"][1])
3673 self.assertEqual([
"sp@test1"], p.values[
"@all_aliases"][1])
3674 self.assertEqual((
True,
"EDProducer"), p.values[
"sp@test2"][1].values[
"@module_edm_type"])
3675 self.assertEqual((
True,
"Foo"), p.values[
"sp@test2"][1].values[
"@module_type"])
3676 self.assertEqual((
True,
"EDAlias"), p.values[
"sp@test1"][1].values[
"@module_edm_type"])
3677 self.assertEqual((
True,
"Bar"), p.values[
"sp@test1"][1].values[
"a"][1][0].values[
"type"])
3686 proc.s =
Sequence(proc.a + proc.sp)
3687 proc.t =
Task(proc.a, proc.sp)
3689 proc.p.associate(proc.t)
3691 proc.fillProcessDesc(p)
3692 self.assertEqual((
True,
"EDProducer"), p.values[
"sp"][1].values[
"@module_edm_type"])
3693 self.assertEqual((
True,
"SwitchProducer"), p.values[
"sp"][1].values[
"@module_type"])
3694 self.assertEqual((
True,
"sp"), p.values[
"sp"][1].values[
"@module_label"])
3695 self.assertEqual((
True, [
"sp@test1",
"sp@test2"]), p.values[
"sp"][1].values[
"@all_cases"])
3696 self.assertEqual((
False,
"sp@test2"), p.values[
"sp"][1].values[
"@chosen_case"])
3697 self.assertEqual([
"a",
"sp",
"sp@test1"], p.values[
"@all_modules"][1])
3698 self.assertEqual([
"sp@test2"], p.values[
"@all_aliases"][1])
3699 self.assertEqual((
True,
"EDProducer"), p.values[
"sp@test1"][1].values[
"@module_edm_type"])
3700 self.assertEqual((
True,
"Foo"), p.values[
"sp@test1"][1].values[
"@module_type"])
3701 self.assertEqual((
True,
"EDAlias"), p.values[
"sp@test2"][1].values[
"@module_edm_type"])
3702 self.assertEqual((
True,
"Bar"), p.values[
"sp@test2"][1].values[
"a"][1][0].values[
"type"])
3713 proc.spp = proc.spct.clone()
3716 proc.p =
Path(proc.a, proc.ct)
3717 proc.pp =
Path(proc.a + proc.spp)
3719 proc.fillProcessDesc(p)
3720 self.assertEqual([
"a",
"spct",
"spct@test1",
"spct@test2",
"spp",
"spp@test1",
"spp@test2"], p.values[
"@all_modules"][1])
3721 self.assertEqual([
"a",
"#",
"spct",
"spct@test1",
"spct@test2",
"@"], p.values[
"p"][1])
3722 self.assertEqual([
"a",
"spp",
"#",
"spp@test1",
"spp@test2",
"@"], p.values[
"pp"][1])
3737 p.t3 =
Task(p.g, p.t1)
3741 p.path1 =
Path(p.a, p.t3, p.ct3)
3743 self.assertTrue(p.schedule
is None)
3746 self.assertEqual(pths[keys[0]],p.path1)
3747 self.assertEqual(pths[keys[1]],p.path2)
3749 p.pset2 = untracked.PSet(parA =
string(
"pset2"))
3751 p.vpset2 = untracked.VPSet()
3753 self.assertTrue(hasattr(p,
'a'))
3754 self.assertTrue(hasattr(p,
'b'))
3755 self.assertTrue(
not hasattr(p,
'c'))
3756 self.assertTrue(
not hasattr(p,
'd'))
3757 self.assertTrue(hasattr(p,
'e'))
3758 self.assertTrue(
not hasattr(p,
'f'))
3759 self.assertTrue(hasattr(p,
'g'))
3760 self.assertTrue(hasattr(p,
'h'))
3761 self.assertTrue(
not hasattr(p,
's'))
3762 self.assertTrue(hasattr(p,
't1'))
3763 self.assertTrue(
not hasattr(p,
't2'))
3764 self.assertTrue(hasattr(p,
't3'))
3765 self.assertTrue(hasattr(p,
'path1'))
3766 self.assertTrue(hasattr(p,
'path2'))
3796 p.path1 =
Path(p.a, p.t3, p.ct3)
3798 p.path3 =
Path(p.b+p.s2)
3799 p.path4 =
Path(p.b+p.s3)
3800 p.schedule =
Schedule(p.path1,p.path2,p.path3)
3801 p.schedule.associate(p.t4)
3804 self.assertEqual(pths[keys[0]],p.path1)
3805 self.assertEqual(pths[keys[1]],p.path2)
3807 self.assertTrue(hasattr(p,
'a'))
3808 self.assertTrue(hasattr(p,
'b'))
3809 self.assertTrue(
not hasattr(p,
'c'))
3810 self.assertTrue(
not hasattr(p,
'd'))
3811 self.assertTrue(
not hasattr(p,
'e'))
3812 self.assertTrue(
not hasattr(p,
'f'))
3813 self.assertTrue(hasattr(p,
'g'))
3814 self.assertTrue(hasattr(p,
'h'))
3815 self.assertTrue(hasattr(p,
'i'))
3816 self.assertTrue(hasattr(p,
'j'))
3817 self.assertTrue(hasattr(p,
'k'))
3818 self.assertTrue(
not hasattr(p,
'l'))
3819 self.assertTrue(
not hasattr(p,
't1'))
3820 self.assertTrue(hasattr(p,
't2'))
3821 self.assertTrue(hasattr(p,
't3'))
3822 self.assertTrue(hasattr(p,
't4'))
3823 self.assertTrue(
not hasattr(p,
'ct1'))
3824 self.assertTrue(hasattr(p,
'ct2'))
3825 self.assertTrue(hasattr(p,
'ct3'))
3826 self.assertTrue(
not hasattr(p,
'ct4'))
3827 self.assertTrue(
not hasattr(p,
's'))
3828 self.assertTrue(hasattr(p,
's2'))
3829 self.assertTrue(
not hasattr(p,
's3'))
3830 self.assertTrue(hasattr(p,
'path1'))
3831 self.assertTrue(hasattr(p,
'path2'))
3832 self.assertTrue(hasattr(p,
'path3'))
3833 self.assertTrue(
not hasattr(p,
'path4'))
3841 self.assertTrue(hasattr(p,
'a'))
3842 self.assertTrue(hasattr(p,
'b'))
3843 self.assertTrue(hasattr(p,
's'))
3844 self.assertTrue(hasattr(p,
'pth'))
3850 p.prune(keepUnresolvedSequencePlaceholders=
True)
3851 self.assertTrue(hasattr(p,
'b'))
3852 self.assertTrue(hasattr(p,
's'))
3853 self.assertTrue(hasattr(p,
'pth'))
3854 self.assertEqual(p.s.dumpPython(),
'cms.Sequence(cms.SequencePlaceholder("a")+process.b)\n')
3862 self.assertTrue(hasattr(p,
'a'))
3863 self.assertTrue(hasattr(p,
'b'))
3864 self.assertTrue(hasattr(p,
's'))
3865 self.assertTrue(hasattr(p,
'pth'))
3873 self.assertTrue(hasattr(p,
'a'))
3874 self.assertTrue(hasattr(p,
'b'))
3875 self.assertTrue(hasattr(p,
's'))
3876 self.assertTrue(hasattr(p,
'pth'))
3882 p.prune(keepUnresolvedSequencePlaceholders=
True)
3883 self.assertTrue(hasattr(p,
'b'))
3884 self.assertTrue(hasattr(p,
's'))
3885 self.assertTrue(hasattr(p,
'pth'))
3886 self.assertEqual(p.s.dumpPython(),
'cms.Task(cms.TaskPlaceholder("a"), process.b)\n')
3894 p.path1 =
Path(p.b, p.t2, p.t3)
3897 p.endpath1 =
EndPath(p.b, p.t5)
3901 p.schedule =
Schedule(p.path1, p.endpath1,tasks=[p.t7,p.t8])
3911 """process.a = cms.EDProducer("ma") 3912 process.c = cms.EDProducer("mc") 3913 process.d = cms.EDProducer("md") 3914 process.e = cms.EDProducer("me") 3915 process.f = cms.EDProducer("mf") 3916 process.g = cms.EDProducer("mg") 3917 process.h = cms.EDProducer("mh") 3918 process.i = cms.EDProducer("mi") 3919 process.j = cms.EDProducer("mj") 3920 process.b = cms.EDAnalyzer("mb") 3921 process.t1 = cms.Task(cms.TaskPlaceholder("c")) 3922 process.t2 = cms.Task(cms.TaskPlaceholder("d"), process.a, process.t1) 3923 process.t3 = cms.Task(cms.TaskPlaceholder("e")) 3924 process.t5 = cms.Task(cms.TaskPlaceholder("g"), cms.TaskPlaceholder("t4"), process.a) 3925 process.t4 = cms.Task(cms.TaskPlaceholder("f")) 3926 process.t6 = cms.Task(cms.TaskPlaceholder("h")) 3927 process.t7 = cms.Task(cms.TaskPlaceholder("i"), process.a, process.t6) 3928 process.t8 = cms.Task(cms.TaskPlaceholder("j")) 3929 process.path1 = cms.Path(process.b, process.t2, process.t3) 3930 process.endpath1 = cms.EndPath(process.b, process.t5) 3931 process.schedule = cms.Schedule(*[ process.path1, process.endpath1 ], tasks=[process.t7, process.t8])""")
3934 """process.a = cms.EDProducer("ma") 3935 process.c = cms.EDProducer("mc") 3936 process.d = cms.EDProducer("md") 3937 process.e = cms.EDProducer("me") 3938 process.f = cms.EDProducer("mf") 3939 process.g = cms.EDProducer("mg") 3940 process.h = cms.EDProducer("mh") 3941 process.i = cms.EDProducer("mi") 3942 process.j = cms.EDProducer("mj") 3943 process.b = cms.EDAnalyzer("mb") 3944 process.t1 = cms.Task(process.c) 3945 process.t2 = cms.Task(process.a, process.d, process.t1) 3946 process.t3 = cms.Task(process.e) 3947 process.t4 = cms.Task(process.f) 3948 process.t6 = cms.Task(process.h) 3949 process.t7 = cms.Task(process.a, process.i, process.t6) 3950 process.t8 = cms.Task(process.j) 3951 process.t5 = cms.Task(process.a, process.g, process.t4) 3952 process.path1 = cms.Path(process.b, process.t2, process.t3) 3953 process.endpath1 = cms.EndPath(process.b, process.t5) 3954 process.schedule = cms.Schedule(*[ process.path1, process.endpath1 ], tasks=[process.t7, process.t8])""")
3962 p.path1 =
Path(p.b, p.t2, p.t3)
3965 p.path2 =
Path(p.b, p.t5)
3966 p.schedule =
Schedule(p.path1, p.path2)
3976 """process.a = cms.EDProducer("ma") 3977 process.c = cms.EDProducer("mc") 3978 process.d = cms.EDProducer("md") 3979 process.e = cms.EDProducer("me") 3980 process.f = cms.EDProducer("mf") 3981 process.g = cms.EDProducer("mg") 3982 process.h = cms.EDProducer("mh") 3983 process.i = cms.EDProducer("mi") 3984 process.j = cms.EDProducer("mj") 3985 process.b = cms.EDAnalyzer("mb") 3986 process.t1 = cms.ConditionalTask(cms.ConditionalTaskPlaceholder("c")) 3987 process.t2 = cms.ConditionalTask(cms.ConditionalTaskPlaceholder("d"), process.a, process.t1) 3988 process.t3 = cms.ConditionalTask(cms.ConditionalTaskPlaceholder("e")) 3989 process.t5 = cms.ConditionalTask(cms.ConditionalTaskPlaceholder("g"), cms.ConditionalTaskPlaceholder("t4"), process.a) 3990 process.t4 = cms.ConditionalTask(cms.ConditionalTaskPlaceholder("f")) 3991 process.path1 = cms.Path(process.b, process.t2, process.t3) 3992 process.path2 = cms.Path(process.b, process.t5) 3993 process.schedule = cms.Schedule(*[ process.path1, process.path2 ])""")
3996 """process.a = cms.EDProducer("ma") 3997 process.c = cms.EDProducer("mc") 3998 process.d = cms.EDProducer("md") 3999 process.e = cms.EDProducer("me") 4000 process.f = cms.EDProducer("mf") 4001 process.g = cms.EDProducer("mg") 4002 process.h = cms.EDProducer("mh") 4003 process.i = cms.EDProducer("mi") 4004 process.j = cms.EDProducer("mj") 4005 process.b = cms.EDAnalyzer("mb") 4006 process.t1 = cms.ConditionalTask(process.c) 4007 process.t2 = cms.ConditionalTask(process.a, process.d, process.t1) 4008 process.t3 = cms.ConditionalTask(process.e) 4009 process.t4 = cms.ConditionalTask(process.f) 4010 process.t5 = cms.ConditionalTask(process.a, process.g, process.t4) 4011 process.path1 = cms.Path(process.b, process.t2, process.t3) 4012 process.path2 = cms.Path(process.b, process.t5) 4013 process.schedule = cms.Schedule(*[ process.path1, process.path2 ])""")
4029 p.t1 =
Task(p.g, p.h, p.i)
4030 t2 =
Task(p.g, p.h, p.i)
4038 p.path1 =
Path(p.a+p.f+p.s,t2,ct2)
4040 p.path3 =
Path(ct3, p.ct4)
4043 p.schedule =
Schedule(p.path2, p.path3, p.endpath2, tasks=[t3, p.t4])
4044 self.assertTrue(hasattr(p,
'f'))
4045 self.assertTrue(hasattr(p,
'g'))
4046 self.assertTrue(hasattr(p,
'i'))
4051 self.assertFalse(hasattr(p,
'f'))
4052 self.assertFalse(hasattr(p,
'g'))
4053 self.assertEqual(p.t1.dumpPython(),
'cms.Task(process.h)\n')
4054 self.assertEqual(p.ct1.dumpPython(),
'cms.ConditionalTask(process.h)\n')
4055 self.assertEqual(p.s.dumpPython(),
'cms.Sequence(process.d)\n')
4056 self.assertEqual(p.path1.dumpPython(),
'cms.Path(process.a+process.s, cms.ConditionalTask(process.h), cms.Task(process.h))\n')
4057 self.assertEqual(p.endpath1.dumpPython(),
'cms.EndPath(process.b)\n')
4058 self.assertEqual(p.path3.dumpPython(),
'cms.Path(cms.ConditionalTask(process.h), process.ct4)\n')
4060 self.assertEqual(p.path1.dumpPython(),
'cms.Path(process.a+(process.d), cms.ConditionalTask(process.h), cms.Task(process.h))\n')
4061 self.assertEqual(p.schedule_().
dumpPython(),
'cms.Schedule(*[ process.path2, process.path3, process.endpath2 ], tasks=[cms.Task(process.h), process.t4])\n')
4063 self.assertEqual(p.schedule_().
dumpPython(),
'cms.Schedule(*[ process.path3, process.endpath2 ], tasks=[cms.Task(process.h), process.t4])\n')
4065 self.assertEqual(p.schedule_().
dumpPython(),
'cms.Schedule(*[ process.endpath2 ], tasks=[cms.Task(process.h), process.t4])\n')
4067 self.assertEqual(p.schedule_().
dumpPython(),
'cms.Schedule(tasks=[cms.Task(process.h), process.t4])\n')
4069 self.assertEqual(p.schedule_().
dumpPython(),
'cms.Schedule(tasks=[cms.Task(process.h)])\n')
4072 Process._firstProcess =
True 4074 self.assertRaises(RuntimeError,
lambda:
Process(
"test2", m1))
4076 Process._firstProcess =
True 4081 m1.toModify(p.a,_mod_fred)
4082 self.assertEqual(p.a.fred.value(),2)
4084 m1.toModify(p.b, wilma = 2)
4085 self.assertEqual(p.b.wilma.value(),2)
4086 self.assertTrue(p.isUsingModifier(m1))
4089 Process._firstProcess =
True 4092 m1.toModify(p.a,_mod_fred)
4094 m1.toModify(p.b, wilma = 2)
4095 self.assertEqual(p.a.fred.value(),1)
4096 self.assertEqual(p.b.wilma.value(),1)
4097 self.assertEqual(p.isUsingModifier(m1),
False)
4100 Process._firstProcess =
True 4103 m1.toModify(p.a, fred =
int32(2))
4104 p.b = p.a.clone(wilma =
int32(3))
4105 self.assertEqual(p.a.fred.value(),2)
4106 self.assertEqual(p.a.wilma.value(),1)
4107 self.assertEqual(p.b.fred.value(),2)
4108 self.assertEqual(p.b.wilma.value(),3)
4111 Process._firstProcess =
True 4114 m1.toModify(p.a, fred =
None, fintstones = dict(fred =
None))
4115 self.assertEqual(hasattr(p.a,
"fred"),
False)
4116 self.assertEqual(hasattr(p.a.fintstones,
"fred"),
False)
4117 self.assertEqual(p.a.wilma.value(),1)
4120 Process._firstProcess =
True 4123 m1.toModify(p.a, wilma =
int32(2))
4124 self.assertEqual(p.a.fred.value(), 1)
4125 self.assertEqual(p.a.wilma.value(),2)
4128 Process._firstProcess =
True 4131 m1.toModify(p.a, flintstones = dict(fred =
int32(2)))
4132 self.assertEqual(p.a.flintstones.fred.value(),2)
4133 self.assertEqual(p.a.flintstones.wilma.value(),1)
4136 Process._firstProcess =
True 4139 self.assertRaises(KeyError,
lambda: m1.toModify(p.a, flintstones = dict(imnothere = dict(wilma=2))))
4140 self.assertRaises(KeyError,
lambda: m1.toModify(p.a, foo = 1))
4143 Process._firstProcess =
True 4146 m1.toModify(p.a, flintstones = {1:dict(wilma =
int32(2))})
4147 self.assertEqual(p.a.flintstones[0].fred.value(),1)
4148 self.assertEqual(p.a.flintstones[1].wilma.value(),2)
4151 Process._firstProcess =
True 4154 m1.toModify(p.a, fred = {1:7})
4155 self.assertEqual(p.a.fred[0],1)
4156 self.assertEqual(p.a.fred[1],7)
4157 self.assertEqual(p.a.fred[2],3)
4160 Process._firstProcess =
True 4164 try: m1.toModify(p.a, fred = {5:7})
4165 except IndexError
as e: raised =
True 4166 self.assertEqual(raised,
True)
4169 Process._firstProcess =
True 4173 try: m1.toModify(p.a, flintstones = dict(bogus =
int32(37)))
4174 except TypeError
as e: raised =
True 4175 self.assertEqual(raised,
True)
4179 class ProcModifierMod(
object):
4185 testMod = DummyMod()
4187 self.assertTrue(hasattr(p,
"a"))
4189 Process._firstProcess =
True 4191 testProcMod = ProcModifierMod(m1,_rem_a)
4193 p.extend(testProcMod)
4194 self.assertTrue(
not hasattr(p,
"a"))
4198 Process._firstProcess =
True 4200 self.assertTrue(p.isUsingModifier(m1))
4201 self.assertTrue(p.isUsingModifier(mc))
4202 testMod = DummyMod()
4204 m1.toModify(p.b, fred =
int32(3))
4206 testProcMod = ProcModifierMod(m1,_rem_a)
4207 p.extend(testProcMod)
4208 self.assertTrue(
not hasattr(p,
"a"))
4209 self.assertEqual(p.b.fred.value(),3)
4214 mclone = mc.copyAndExclude([m2])
4215 self.assertTrue(
not mclone._isOrContains(m2))
4216 self.assertTrue(mclone._isOrContains(m1))
4219 mclone = mc2.copyAndExclude([m2])
4220 self.assertTrue(
not mclone._isOrContains(m2))
4221 self.assertTrue(mclone._isOrContains(m1))
4222 self.assertTrue(mclone._isOrContains(m3))
4226 Process._firstProcess =
True 4229 (m1 & m2).toModify(p.a, fred =
int32(2))
4230 self.assertRaises(TypeError,
lambda: (m1 & m2).toModify(p.a, 1, wilma=2))
4231 self.assertEqual(p.a.fred, 1)
4234 Process._firstProcess =
True 4237 (m1 & m2).toModify(p.a, fred =
int32(2))
4238 self.assertEqual(p.a.fred, 2)
4242 Process._firstProcess =
True 4245 (m1 & m2 & m3).toModify(p.a, fred =
int32(2))
4246 self.assertEqual(p.a.fred, 2)
4247 (m1 & (m2 & m3)).toModify(p.a, fred =
int32(3))
4248 self.assertEqual(p.a.fred, 3)
4249 ((m1 & m2) & m3).toModify(p.a, fred =
int32(4))
4250 self.assertEqual(p.a.fred, 4)
4254 Process._firstProcess =
True 4257 (~m1).toModify(p.a, fred=2)
4258 self.assertEqual(p.a.fred, 1)
4259 (~m2).toModify(p.a, wilma=2)
4260 self.assertEqual(p.a.wilma, 2)
4261 self.assertRaises(TypeError,
lambda: (~m1).toModify(p.a, 1, wilma=2))
4262 self.assertRaises(TypeError,
lambda: (~m2).toModify(p.a, 1, wilma=2))
4267 Process._firstProcess =
True 4270 (m1 | m2).toModify(p.a, fred=2)
4271 self.assertEqual(p.a.fred, 2)
4272 (m1 | m2 | m3).toModify(p.a, fred=3)
4273 self.assertEqual(p.a.fred, 3)
4274 (m3 | m2 | m1).toModify(p.a, fred=4)
4275 self.assertEqual(p.a.fred, 4)
4276 ((m1 | m2) | m3).toModify(p.a, fred=5)
4277 self.assertEqual(p.a.fred, 5)
4278 (m1 | (m2 | m3)).toModify(p.a, fred=6)
4279 self.assertEqual(p.a.fred, 6)
4280 (m2 | m3).toModify(p.a, fred=7)
4281 self.assertEqual(p.a.fred, 6)
4282 self.assertRaises(TypeError,
lambda: (m1 | m2).toModify(p.a, 1, wilma=2))
4283 self.assertRaises(TypeError,
lambda: (m2 | m3).toModify(p.a, 1, wilma=2))
4289 Process._firstProcess =
True 4292 (m1 & ~m2).toModify(p.a, fred=2)
4293 self.assertEqual(p.a.fred, 1)
4294 (m1 & ~m3).toModify(p.a, fred=2)
4295 self.assertEqual(p.a.fred, 2)
4296 (m1 | ~m2).toModify(p.a, fred=3)
4297 self.assertEqual(p.a.fred, 3)
4298 (~m1 | ~m2).toModify(p.a, fred=4)
4299 self.assertEqual(p.a.fred, 3)
4300 (~m3 & ~m4).toModify(p.a, fred=4)
4301 self.assertEqual(p.a.fred, 4)
4302 ((m1 & m3) | ~m4).toModify(p.a, fred=5)
4303 self.assertEqual(p.a.fred, 5)
4306 Process._firstProcess =
True 4310 self.assertRaises(TypeError,
lambda: m1.toReplaceWith(p.a,
EDProducer(
"YourProducer")))
4318 m1.toReplaceWith(p.s,
Sequence(p.a+p.b, p.td))
4319 self.assertEqual(p.a.wilma.value(),3)
4320 self.assertEqual(p.a.type_(),
"YourAnalyzer")
4321 self.assertEqual(hasattr(p,
"fred"),
False)
4322 self.assertTrue(p.s.dumpPython() ==
"cms.Sequence(process.a+process.b, process.td)\n")
4324 m1.toReplaceWith(p.td,
Task(p.e))
4325 self.assertTrue(p.td._collection ==
OrderedSet([p.e]))
4335 m1.toReplaceWith(p.s,
Sequence(p.a+p.b, p.td))
4336 self.assertEqual(p.a.wilma.value(),3)
4337 self.assertEqual(p.a.type_(),
"YourAnalyzer")
4338 self.assertEqual(hasattr(p,
"fred"),
False)
4339 self.assertTrue(p.s.dumpPython() ==
"cms.Sequence(process.a+process.b, process.td)\n")
4342 self.assertTrue(p.td._collection ==
OrderedSet([p.e]))
4345 Process._firstProcess =
True 4349 self.assertEqual(p.a.type_(),
"MyAnalyzer")
4355 Process._firstProcess =
True 4358 self.assertRaises(TypeError,
lambda: (m1 & m2).toReplaceWith(p.a,
EDProducer(
"YourProducer")))
4359 self.assertRaises(TypeError,
lambda: (m3 & m4).toReplaceWith(p.a,
EDProducer(
"YourProducer")))
4360 self.assertRaises(TypeError,
lambda: (~m3).toReplaceWith(p.a,
EDProducer(
"YourProducer")))
4361 self.assertRaises(TypeError,
lambda: (~m1).toReplaceWith(p.a,
EDProducer(
"YourProducer")))
4362 self.assertRaises(TypeError,
lambda: (m1 | m3).toReplaceWith(p.a,
EDProducer(
"YourProducer")))
4363 self.assertRaises(TypeError,
lambda: (m3 | m4).toReplaceWith(p.a,
EDProducer(
"YourProducer")))
4364 (m1 & m2).toReplaceWith(p.a,
EDAnalyzer(
"YourAnalyzer1"))
4365 self.assertEqual(p.a.type_(),
"YourAnalyzer1")
4366 (m1 & m3).toReplaceWith(p.a,
EDAnalyzer(
"YourAnalyzer2"))
4367 self.assertEqual(p.a.type_(),
"YourAnalyzer1")
4368 (~m1).toReplaceWith(p.a,
EDAnalyzer(
"YourAnalyzer2"))
4369 self.assertEqual(p.a.type_(),
"YourAnalyzer1")
4370 (~m3).toReplaceWith(p.a,
EDAnalyzer(
"YourAnalyzer2"))
4371 self.assertEqual(p.a.type_(),
"YourAnalyzer2")
4372 (m1 | m3).toReplaceWith(p.a,
EDAnalyzer(
"YourAnalyzer3"))
4373 self.assertEqual(p.a.type_(),
"YourAnalyzer3")
4374 (m3 | m4).toReplaceWith(p.a,
EDAnalyzer(
"YourAnalyzer4"))
4375 self.assertEqual(p.a.type_(),
"YourAnalyzer3")
4382 m.toModify(a, foo2 = {0: dict(type =
"Foo3")})
4383 self.assertEqual(a.foo2[0].type,
"Foo3")
4386 self.assertEqual(a.foo2[0].type,
"Foo3")
4387 self.assertEqual(a.foo4[0].type,
"Foo4")
4389 m.toModify(a, foo2 =
None)
4390 self.assertFalse(hasattr(a,
"foo2"))
4391 self.assertEqual(a.foo4[0].type,
"Foo4")
4394 self.assertFalse(hasattr(a,
"foo2"))
4395 self.assertFalse(hasattr(a,
"foo4"))
4396 self.assertTrue(hasattr(a,
"bar"))
4397 self.assertEqual(a.bar[0].type,
"Bar")
4410 test1 = dict(a = 4, b = dict(c =
None)),
4411 test2 = dict(aa = 15, bb = dict(cc = 45, dd =
string(
"foo"))))
4412 self.assertEqual(sp.test1.a.value(), 4)
4413 self.assertEqual(sp.test1.b.hasParameter(
"c"),
False)
4414 self.assertEqual(sp.test2.aa.value(), 15)
4415 self.assertEqual(sp.test2.bb.cc.value(), 45)
4416 self.assertEqual(sp.test2.bb.dd.value(),
"foo")
4419 self.assertEqual(sp.test1.type_(),
"Fred")
4420 self.assertEqual(sp.test1.x.value(), 42)
4421 self.assertRaises(TypeError,
lambda: m.toReplaceWith(sp.test1,
EDAnalyzer(
"Foo")))
4424 self.assertEqual(sp.test2.type_(),
"Xyzzy")
4425 self.assertEqual(sp.test2.x.value(), 24)
4426 self.assertRaises(TypeError,
lambda: m.toModify(sp, test2 =
EDAnalyzer(
"Foo")))
4429 self.assertEqual(sp.test3.type_(),
"Wilma")
4430 self.assertEqual(sp.test3.y.value(), 24)
4431 self.assertRaises(TypeError,
lambda: m.toModify(sp, test4 =
EDAnalyzer(
"Foo")))
4433 m.toModify(sp, test2 =
None)
4434 self.assertEqual(hasattr(sp,
"test2"),
False)
4437 self.assertTrue(hasattr(sp.test2,
"foo"))
4440 self.assertTrue(hasattr(sp.test2,
"bar"))
4443 self.assertTrue(hasattr(sp.test2,
"xyzzy"))
4445 self.assertRaises(TypeError,
lambda: m.toReplaceWith(sp.test2,
EDProducer(
"Foo")))
4451 p.maxEvents.input = 10
4452 p.options.numberOfThreads = 4
4453 p.maxLuminosityBlocks.input = 2
4455 self.assertEqual(p.maxEvents.input.value(),10)
4456 self.assertEqual(p.options.numberOfThreads.value(), 4)
4457 self.assertEqual(p.maxLuminosityBlocks.input.value(),2)
4463 self.assertTrue(hasattr(p,
'fltr'))
4467 p.TestService =
Service(
"TestService")
4468 self.assertTrue(hasattr(proc,
"TestService"))
4469 self.assertEqual(proc.TestService.type_(),
"TestService")
4470 self.assertRaises(TypeError, setattr, p,
"a",
EDProducer(
"Foo"))
4471 p.add_(
Service(
"TestServiceTwo"))
4472 self.assertTrue(hasattr(proc,
"TestServiceTwo"))
4473 self.assertEqual(proc.TestServiceTwo.type_(),
"TestServiceTwo")
4474 p.TestService.foo = untracked.uint32(42)
4475 self.assertEqual(proc.TestService.foo.value(), 42)
4477 self.assertRaises(TypeError, getattr, p,
"mod")
4481 proc.fillProcessDesc(p)
4482 self.assertTrue([
"cpu"], p.values[
"@available_accelerators"][1])
4483 self.assertFalse(p.values[
"@selected_accelerators"][0])
4484 self.assertTrue([
"cpu"], p.values[
"@selected_accelerators"][1])
4489 del proc.MessageLogger
4490 self.assertEqual(proc.dumpPython(),
4491 """import FWCore.ParameterSet.Config as cms 4492 from test import ProcessAcceleratorTest 4494 process = cms.Process("TEST") 4496 process.maxEvents = cms.untracked.PSet( 4497 input = cms.optional.untracked.int32, 4498 output = cms.optional.untracked.allowed(cms.int32,cms.PSet) 4501 process.maxLuminosityBlocks = cms.untracked.PSet( 4502 input = cms.untracked.int32(-1) 4505 process.options = cms.untracked.PSet( 4506 FailPath = cms.untracked.vstring(), 4507 IgnoreCompletely = cms.untracked.vstring(), 4508 Rethrow = cms.untracked.vstring(), 4509 SkipEvent = cms.untracked.vstring(), 4510 accelerators = cms.untracked.vstring('*'), 4511 allowUnscheduled = cms.obsolete.untracked.bool, 4512 canDeleteEarly = cms.untracked.vstring(), 4513 deleteNonConsumedUnscheduledModules = cms.untracked.bool(True), 4514 dumpOptions = cms.untracked.bool(False), 4515 emptyRunLumiMode = cms.obsolete.untracked.string, 4516 eventSetup = cms.untracked.PSet( 4517 forceNumberOfConcurrentIOVs = cms.untracked.PSet( 4518 allowAnyLabel_=cms.required.untracked.uint32 4520 numberOfConcurrentIOVs = cms.untracked.uint32(0) 4522 fileMode = cms.untracked.string('FULLMERGE'), 4523 forceEventSetupCacheClearOnNewRun = cms.untracked.bool(False), 4524 makeTriggerResults = cms.obsolete.untracked.bool, 4525 numberOfConcurrentLuminosityBlocks = cms.untracked.uint32(0), 4526 numberOfConcurrentRuns = cms.untracked.uint32(1), 4527 numberOfStreams = cms.untracked.uint32(0), 4528 numberOfThreads = cms.untracked.uint32(1), 4529 printDependencies = cms.untracked.bool(False), 4530 sizeOfStackForThreadsInKB = cms.optional.untracked.uint32, 4531 throwIfIllegalParameter = cms.untracked.bool(True), 4532 wantSummary = cms.untracked.bool(False) 4535 process.ProcessAcceleratorTest = ProcessAcceleratorTest( 4536 enabled = ['test1', 'test2', 'anothertest3'] 4542 proc.fillProcessDesc(p)
4543 self.assertEqual([
"*"], p.values[
"options"][1].values[
"accelerators"][1])
4544 self.assertFalse(p.values[
"options"][1].values[
"accelerators"][0])
4545 self.assertTrue([
"anothertest3",
"cpu",
"test1",
"test2"], p.values[
"@selected_accelerators"][1])
4546 self.assertEqual(
"AcceleratorTestService", p.values[
"services"][1][0].values[
"@service_type"][1])
4547 self.assertFalse(p.values[
"@available_accelerators"][0])
4548 self.assertTrue([
"anothertest3",
"cpu",
"test1",
"test2"], p.values[
"@available_accelerators"][1])
4553 proc.fillProcessDesc(p)
4554 self.assertEqual([
"cpu",
"test1"], p.values[
"@selected_accelerators"][1])
4555 self.assertEqual([
"cpu",
"test1"], p.values[
"@available_accelerators"][1])
4559 proc.options.accelerators = [
"test2"]
4561 proc.fillProcessDesc(p)
4562 self.assertEqual([
"test2"], p.values[
"@selected_accelerators"][1])
4563 self.assertEqual([
"anothertest3",
"cpu",
"test1",
"test2"], p.values[
"@available_accelerators"][1])
4567 proc.options.accelerators = [
"test*"]
4568 proc.fillProcessDesc(p)
4569 self.assertEqual([
"test1",
"test2"], p.values[
"@selected_accelerators"][1])
4570 self.assertEqual([
"anothertest3",
"cpu",
"test1",
"test2"], p.values[
"@available_accelerators"][1])
4574 proc.options.accelerators = [
"test2"]
4576 proc.fillProcessDesc(p)
4577 self.assertEqual([], p.values[
"@selected_accelerators"][1])
4578 self.assertEqual([
"cpu",
"test1"], p.values[
"@available_accelerators"][1])
4582 proc.options.accelerators = [
"cpu*"]
4584 proc.fillProcessDesc(p)
4585 self.assertEqual([
"cpu"], p.values[
"@selected_accelerators"][1])
4586 self.assertEqual([
"anothertest3",
"cpu",
"test1",
"test2"], p.values[
"@available_accelerators"][1])
4590 proc.options.accelerators = [
"test3"]
4592 self.assertRaises(ValueError, proc.fillProcessDesc, p)
4596 proc.options.accelerators = [
"*",
"test1"]
4598 self.assertRaises(ValueError, proc.fillProcessDesc, p)
4604 proc.fillProcessDesc(p)
4605 self.assertEqual([
"anothertest3",
"anothertest4",
"cpu",
"test1",
"test2"], p.values[
"@selected_accelerators"][1])
4606 self.assertEqual([
"anothertest3",
"anothertest4",
"cpu",
"test1",
"test2"], p.values[
"@available_accelerators"][1])
4611 proc.options.accelerators = [
"*test3",
"c*"]
4613 proc.fillProcessDesc(p)
4614 self.assertEqual([
"anothertest3",
"cpu"], p.values[
"@selected_accelerators"][1])
4615 self.assertEqual([
"anothertest3",
"anothertest4",
"cpu",
"test1",
"test2"], p.values[
"@available_accelerators"][1])
4625 proc.p =
Path(proc.sp)
4627 proc.fillProcessDesc(p)
4628 self.assertEqual((
False,
"sp@test2"), p.values[
"sp"][1].values[
"@chosen_case"])
4638 proc.p =
Path(proc.sp)
4640 proc.fillProcessDesc(p)
4641 self.assertEqual((
False,
"sp@test1"), p.values[
"sp"][1].values[
"@chosen_case"])
4645 proc.options.accelerators = [
"test1"]
4652 proc.p =
Path(proc.sp)
4654 proc.fillProcessDesc(p)
4655 self.assertEqual((
False,
"sp@test1"), p.values[
"sp"][1].values[
"@chosen_case"])
4659 proc.options.accelerators = [
"test*"]
4666 proc.p =
Path(proc.sp)
4668 proc.fillProcessDesc(p)
4669 self.assertEqual((
False,
"sp@test2"), p.values[
"sp"][1].values[
"@chosen_case"])
4673 proc.options.accelerators = [
"anothertest3"]
4680 proc.p =
Path(proc.sp)
4682 self.assertRaises(RuntimeError, proc.fillProcessDesc, p)
4693 proc.p =
Path(proc.sp)
4694 pkl = pickle.dumps(proc)
4695 unpkl = pickle.loads(pkl)
4697 unpkl.fillProcessDesc(p)
4698 self.assertEqual((
False,
"sp@test2"), p.values[
"sp"][1].values[
"@chosen_case"])
4699 self.assertEqual([
"anothertest3",
"cpu",
"test1",
"test2"], p.values[
"@available_accelerators"][1])
4700 unpkl = pickle.loads(pkl)
4701 unpkl.ProcessAcceleratorTest.setEnabled([
"test1"])
4703 unpkl.fillProcessDesc(p)
4704 self.assertEqual((
False,
"sp@test1"), p.values[
"sp"][1].values[
"@chosen_case"])
4705 self.assertEqual([
"cpu",
"test1"], p.values[
"@available_accelerators"][1])
def __setstate__(self, pkldict)
def conditionaltasks_(self)
def addVString(self, tracked, label, value)
def testProcessAccelerator(self)
def _dumpConfigOptionallyNamedList(self, items, typeName, options)
def testConditionalTaskPlaceholder(self)
def addEventRange(self, tracked, label, value)
def __init__(self, lhs, rhs)
def __init__(self, enabled=["test1", test2, anothertest3)
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 __init__(self, process)
def __updateMaxEvents(self, ps)
def _placeSwitchProducer(self, name, mod)
def _insertPaths(self, processPSet, nodeVisitor)
def apply(self, process, accelerators)
def _placeESProducer(self, name, mod)
def _splitPythonList(self, subfolder, d, options)
bool any(const std::vector< T > &v, const T &what)
def addVESInputTag(self, tracked, label, value)
def _switchproducer_test2_case2(accelerators)
def _placeSequence(self, name, mod)
def __init__(self, dataset, job_number, job_id, job_name, isDA, isMC, applyBOWS, applyEXTRACOND, extraconditions, runboundary, lumilist, intlumi, maxevents, gt, allFromGT, alignmentDB, alignmentTAG, apeDB, apeTAG, bowDB, bowTAG, vertextype, tracktype, refittertype, ttrhtype, applyruncontrol, ptcut, CMSSW_dir, the_dir)
def _validateSequence(self, sequence, label)
def __getattr__(self, attr)
def setStrict(self, value)
def addDouble(self, tracked, label, value)
def dumpPythonImpl(self, options)
def _findPreferred(self, esname, d, args, kargs)
def apply(self, process, accelerators)
def __init__(self, kargs)
def apply(self, process, accelerators)
def _insertOneInto(self, parameterSet, label, item, tracked)
def __setattr__(self, label, value)
def __updateOptions(self, opt)
def __delattr__(self, name)
def _placePath(self, name, mod)
def addVUInt64(self, tracked, label, value)
def _placeEndPath(self, name, mod)
def __init__(self, enabled=["anothertest3", anothertest4)
def testProcessForProcessAccelerator(self)
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 _lineDiff(newString, oldString)
def dumpPythonImpl(self, options)
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 __getattr__(self, label)
def _replaceInTasks(self, label, new)
def addVInt32(self, tracked, label, value)
def _placeFilter(self, name, mod)
def handleProcessAccelerators(self, parameterSet)
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 setEnabled(self, enabled)
def __setattr__(self, name, value)
def _placeESSource(self, name, mod)
def addVInt64(self, tracked, label, value)
def addVEventID(self, tracked, label, value)
def setEnabled(self, enabled)
def toModify(self, obj, func=None, kw)
def testGlobalReplace(self)
def testSwitchProducer(self)
def getVString(self, tracked, label)
def defaultMaxLuminosityBlocks_()
def testProcessFragment(self)
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
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 split(sequence, size)
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)
def _switchproducer_test2_case1(accelerators)
static std::string join(char **cmd)
def _isOrContains(self, other)
def getSubProcessPSet(self, parameterSet)
def _validateConditionalTask(self, task, label)
def copyAndExclude(self, toExclude)
def addVUInt32(self, tracked, label, value)
def addVEventRange(self, tracked, label, value)
def _splitPython(self, subfolder, d, options)
def __init__(self, lhs, rhs)
def _placeAccelerator(self, typeName, mod)
def dumpPython(process, name)
def __setObjectLabel(self, object, newLabel)
def testConditionalTask(self)
def _delHelper(self, name)
def _placeAlias(self, name, mod)
def dumpPython(self, options=PrintOptions())
def _replaceInSequences(self, label, new)
def setSchedule_(self, sch)
def dumpPython(self, options=PrintOptions())
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)
void add(std::map< std::string, TH1 *> &h, TH1 *hist)
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 _placeFinalPath(self, name, mod)
def _isOrContains(self, other)
def addInt64(self, tracked, label, value)
def addService(process, multirun=False)
def _place(self, name, mod, d)
def testProcessExtend(self)
def _dumpPythonList(self, d, options)
def __insertValue(self, tracked, label, value)
def splitPython(self, options=PrintOptions())
def __init__(self, kargs)
def __getValue(self, tracked, label)
def _place(self, name, proc)
def _placeVPSet(self, name, mod)
def processAccelerators_(self)
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 _replaceInConditionalTasks(self, label, new)
def makeProcessModifier(self, func)
def __init__(self, process, SelectEvents=untracked.PSet(), outputCommands=untracked.vstring())
def _placeConditionalTask(self, name, task)
def _replaceInScheduleDirectly(self, label, new)
def __init__(self, chainedModifiers)
def testTaskPlaceholder(self)
def _replaceInSchedule(self, label, new)
def dumpPythonImpl(self, options)
def _dumpPython(self, d, options)
def addInt32(self, tracked, label, value)
def fillProcessDesc(self, processPSet)
def testProcessInsertion(self)