CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes | Static Public Attributes
Config.TestModuleCommand Class Reference
Inheritance diagram for Config.TestModuleCommand:

Public Member Functions

def setUp (self)
 
def testCloneSequence (self)
 
def testConditionalTask (self)
 
def testConditionalTaskPlaceholder (self)
 
def testContains (self)
 
def testDelete (self)
 
def testExamples (self)
 
def testFinalPath (self)
 
def testFreeze (self)
 
def testGlobalReplace (self)
 
def testImplicitSchedule (self)
 
def testMaxEvents (self)
 
def testModifier (self)
 
def testOptions (self)
 
def testOverride (self)
 
def testParameterizable (self)
 
def testPath (self)
 
def testPrefers (self)
 
def testProcessAccelerator (self)
 
def testProcessDumpPython (self)
 
def testProcessExtend (self)
 
def testProcessForProcessAccelerator (self)
 
def testProcessFragment (self)
 
def testProcessInsertion (self)
 
def testPrune (self)
 
def testRefToPSet (self)
 
def testSchedule (self)
 
def testSecSource (self)
 
def testSequence (self)
 
def testSequence2 (self)
 
def testServiceInProcess (self)
 
def testSubProcess (self)
 
def testSwitchProducer (self)
 
def testTask (self)
 
def testTaskPlaceholder (self)
 
def testTypedParameterizable (self)
 
def testUsing (self)
 

Public Attributes

 maxDiff
 
 proc_mod_
 

Static Public Attributes

 a
 
 b
 
 c
 
 d
 
 e
 
 f
 
 g
 
 p
 
 p2
 
 process
 
 r
 
 s
 
 s1
 
 s2
 
 s3
 
 schedule
 
 task1
 
 task2
 
 task3
 
 task4
 
 task5
 
 tasks
 

Detailed Description

Definition at line 2284 of file Config.py.

Member Function Documentation

◆ setUp()

def Config.TestModuleCommand.setUp (   self)
Nothing to do 

Definition at line 2285 of file Config.py.

2285  def setUp(self):
2286  """Nothing to do """
2287  None

◆ testCloneSequence()

def Config.TestModuleCommand.testCloneSequence (   self)

Definition at line 3371 of file Config.py.

References l1ctLayer2EG_cff.id, and str.

3371  def testCloneSequence(self):
3372  p = Process("test")
3373  a = EDAnalyzer("MyAnalyzer")
3374  p.a = a
3375  a.setLabel("a")
3376  b = EDAnalyzer("YOurAnalyzer")
3377  p.b = b
3378  b.setLabel("b")
3379  path = Path(a * b)
3380  p.path = Path(p.a*p.b)
3381  lookuptable = {id(a): p.a, id(b): p.b}
3382  #self.assertEqual(str(path),str(path._postProcessFixup(lookuptable)))
3383  #lookuptable = p._cloneToObjectDict
3384  #self.assertEqual(str(path),str(path._postProcessFixup(lookuptable)))
3385  self.assertEqual(str(path),str(p.path))
3386 
#define str(s)

◆ testConditionalTask()

def Config.TestModuleCommand.testConditionalTask (   self)

Definition at line 3073 of file Config.py.

3073  def testConditionalTask(self):
3074 
3075  # create some objects to use in tests
3076  edanalyzer = EDAnalyzer("a")
3077  edproducer = EDProducer("b")
3078  edproducer2 = EDProducer("b2")
3079  edproducer3 = EDProducer("b3")
3080  edproducer4 = EDProducer("b4")
3081  edproducer8 = EDProducer("b8")
3082  edproducer9 = EDProducer("b9")
3083  edfilter = EDFilter("c")
3084  service = Service("d")
3085  service3 = Service("d", v = untracked.uint32(3))
3086  essource = ESSource("e")
3087  esproducer = ESProducer("f")
3088  testTask2 = Task()
3089  testCTask2 = ConditionalTask()
3090 
3091  # test adding things to Tasks
3092  testTask1 = ConditionalTask(edproducer, edfilter)
3093  self.assertRaises(RuntimeError, testTask1.add, edanalyzer)
3094  testTask1.add(essource, service)
3095  testTask1.add(essource, esproducer)
3096  testTask1.add(testTask2)
3097  testTask1.add(testCTask2)
3098  coll = testTask1._collection
3099  self.assertTrue(edproducer in coll)
3100  self.assertTrue(edfilter in coll)
3101  self.assertTrue(service in coll)
3102  self.assertTrue(essource in coll)
3103  self.assertTrue(esproducer in coll)
3104  self.assertTrue(testTask2 in coll)
3105  self.assertTrue(testCTask2 in coll)
3106  self.assertTrue(len(coll) == 7)
3107  self.assertTrue(len(testTask2._collection) == 0)
3108 
3109  taskContents = []
3110  for i in testTask1:
3111  taskContents.append(i)
3112  self.assertEqual(taskContents, [edproducer, edfilter, essource, service, esproducer, testTask2, testCTask2])
3113 
3114  # test attaching Task to Process
3115  process = Process("test")
3116 
3117  process.mproducer = edproducer
3118  process.mproducer2 = edproducer2
3119  process.mfilter = edfilter
3120  process.messource = essource
3121  process.mesproducer = esproducer
3122  process.d = service
3123 
3124  testTask3 = ConditionalTask(edproducer, edproducer2)
3125  testTask1.add(testTask3)
3126  process.myTask1 = testTask1
3127 
3128  # test the validation that occurs when attaching a ConditionalTask to a Process
3129  # first a case that passes, then one the fails on an EDProducer
3130  # then one that fails on a service
3131  l = set()
3132  visitor = NodeNameVisitor(l)
3133  testTask1.visit(visitor)
3134  self.assertEqual(l, set(['mesproducer', 'mproducer', 'mproducer2', 'mfilter', 'd', 'messource']))
3135  l2 = testTask1.moduleNames()
3136  self.assertEqual(l2, set(['mesproducer', 'mproducer', 'mproducer2', 'mfilter', 'd', 'messource']))
3137 
3138  testTask4 = ConditionalTask(edproducer3)
3139  l.clear()
3140  self.assertRaises(RuntimeError, testTask4.visit, visitor)
3141  try:
3142  process.myTask4 = testTask4
3143  self.assertTrue(False)
3144  except RuntimeError:
3145  pass
3146 
3147  testTask5 = ConditionalTask(service3)
3148  l.clear()
3149  self.assertRaises(RuntimeError, testTask5.visit, visitor)
3150  try:
3151  process.myTask5 = testTask5
3152  self.assertTrue(False)
3153  except RuntimeError:
3154  pass
3155 
3156  process.d = service3
3157  process.myTask5 = testTask5
3158 
3159  # test placement into the Process and the tasks property
3160  expectedDict = { 'myTask1' : testTask1, 'myTask5' : testTask5 }
3161  expectedFixedDict = DictTypes.FixedKeysDict(expectedDict);
3162  self.assertEqual(process.conditionaltasks, expectedFixedDict)
3163  self.assertEqual(process.conditionaltasks['myTask1'], testTask1)
3164  self.assertEqual(process.myTask1, testTask1)
3165 
3166  # test replacing an EDProducer in a ConditionalTask when calling __settattr__
3167  # for the EDProducer on the Process.
3168  process.mproducer2 = edproducer4
3169  process.d = service
3170  l = list()
3171  visitor1 = ModuleNodeVisitor(l)
3172  testTask1.visit(visitor1)
3173  l.sort(key=lambda mod: mod.__str__())
3174  expectedList = sorted([edproducer,essource,esproducer,service,edfilter,edproducer,edproducer4],key=lambda mod: mod.__str__())
3175  self.assertEqual(expectedList, l)
3176  process.myTask6 = ConditionalTask()
3177  process.myTask7 = ConditionalTask()
3178  process.mproducer8 = edproducer8
3179  process.myTask8 = ConditionalTask(process.mproducer8)
3180  process.myTask6.add(process.myTask7)
3181  process.myTask7.add(process.myTask8)
3182  process.myTask1.add(process.myTask6)
3183  process.myTask8.add(process.myTask5)
3184  self.assertEqual(process.myTask8.dumpPython(), "cms.ConditionalTask(process.mproducer8, process.myTask5)\n")
3185 
3186  testDict = process._itemsInDependencyOrder(process.conditionaltasks)
3187  expectedLabels = ["myTask5", "myTask8", "myTask7", "myTask6", "myTask1"]
3188  expectedTasks = [process.myTask5, process.myTask8, process.myTask7, process.myTask6, process.myTask1]
3189  index = 0
3190  for testLabel, testTask in testDict.items():
3191  self.assertEqual(testLabel, expectedLabels[index])
3192  self.assertEqual(testTask, expectedTasks[index])
3193  index += 1
3194 
3195  pythonDump = testTask1.dumpPython(PrintOptions())
3196 
3197 
3198  expectedPythonDump = 'cms.ConditionalTask(process.d, process.mesproducer, process.messource, process.mfilter, process.mproducer, process.mproducer2, process.myTask6)\n'
3199  self.assertEqual(pythonDump, expectedPythonDump)
3200 
3201  process.myTask5 = ConditionalTask()
3202  self.assertEqual(process.myTask8.dumpPython(), "cms.ConditionalTask(process.mproducer8, process.myTask5)\n")
3203  process.myTask100 = ConditionalTask()
3204  process.mproducer9 = edproducer9
3205  sequence1 = Sequence(process.mproducer8, process.myTask1, process.myTask5, testTask2, testTask3)
3206  sequence2 = Sequence(process.mproducer8 + process.mproducer9)
3207  process.sequence3 = Sequence((process.mproducer8 + process.mfilter))
3208  sequence4 = Sequence()
3209  process.path1 = Path(process.mproducer+process.mproducer8+sequence1+sequence2+process.sequence3+sequence4)
3210  process.path1.associate(process.myTask1, process.myTask5, testTask2, testTask3)
3211  process.path11 = Path(process.mproducer+process.mproducer8+sequence1+sequence2+process.sequence3+ sequence4,process.myTask1, process.myTask5, testTask2, testTask3, process.myTask100)
3212  process.path2 = Path(process.mproducer)
3213  process.path3 = Path(process.mproducer9+process.mproducer8,testTask2)
3214 
3215  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')
3216 
3217  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')
3218 
3219  # test NodeNameVisitor and moduleNames
3220  l = set()
3221  nameVisitor = NodeNameVisitor(l)
3222  process.path1.visit(nameVisitor)
3223  self.assertTrue(l == set(['mproducer', 'd', 'mesproducer', None, 'mproducer9', 'mproducer8', 'messource', 'mproducer2', 'mfilter']))
3224  self.assertTrue(process.path1.moduleNames() == set(['mproducer', 'd', 'mesproducer', None, 'mproducer9', 'mproducer8', 'messource', 'mproducer2', 'mfilter']))
3225 
3226  # test copy
3227  process.mproducer10 = EDProducer("b10")
3228  process.path21 = process.path11.copy()
3229  process.path21.replace(process.mproducer, process.mproducer10)
3230 
3231  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')
3232 
3233  # Some peculiarities of the way things work show up here. dumpPython sorts tasks and
3234  # removes duplication at the level of strings. The Task and Sequence objects themselves
3235  # remove duplicate tasks in their contents if the instances are the same (exact same python
3236  # object id which is not the same as the string representation being the same).
3237  # Also note that the mutating visitor replaces sequences and tasks that have
3238  # modified contents with their modified contents, it does not modify the sequence
3239  # or task itself.
3240  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')
3241 
3242  process.path22 = process.path21.copyAndExclude([process.d, process.mesproducer, process.mfilter])
3243  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')
3244 
3245  process.path23 = process.path22.copyAndExclude([process.messource, process.mproducer10])
3246  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')
3247 
3248  process = Process("Test")
3249 
3250  process.b = EDProducer("b")
3251  process.b2 = EDProducer("b2")
3252  process.b3 = EDProducer("b3")
3253  process.p = Path(process.b, ConditionalTask(process.b3, process.b2))
3254  p = TestMakePSet()
3255  process.fillProcessDesc(p)
3256  self.assertEqual(p.values["@all_modules"], (True, ['b', 'b2', 'b3']))
3257  self.assertEqual(p.values["@paths"], (True, ['p']))
3258  self.assertEqual(p.values["p"], (True, ['b','#','b2','b3','@']))
3259 
3260 

◆ testConditionalTaskPlaceholder()

def Config.TestModuleCommand.testConditionalTaskPlaceholder (   self)

Definition at line 4097 of file Config.py.

References Config._lineDiff(), and ConfigBuilder.dumpPython().

4097  def testConditionalTaskPlaceholder(self):
4098  p = Process("test")
4099  p.a = EDProducer("ma")
4100  p.b = EDAnalyzer("mb")
4101  p.t1 = ConditionalTask(ConditionalTaskPlaceholder("c"))
4102  p.t2 = ConditionalTask(p.a, ConditionalTaskPlaceholder("d"), p.t1)
4103  p.t3 = ConditionalTask(ConditionalTaskPlaceholder("e"))
4104  p.path1 = Path(p.b, p.t2, p.t3)
4105  p.t5 = ConditionalTask(p.a, ConditionalTaskPlaceholder("g"), ConditionalTaskPlaceholder("t4"))
4106  p.t4 = ConditionalTask(ConditionalTaskPlaceholder("f"))
4107  p.path2 = Path(p.b, p.t5)
4108  p.schedule = Schedule(p.path1, p.path2)
4109  p.c = EDProducer("mc")
4110  p.d = EDProducer("md")
4111  p.e = EDProducer("me")
4112  p.f = EDProducer("mf")
4113  p.g = EDProducer("mg")
4114  p.h = EDProducer("mh")
4115  p.i = EDProducer("mi")
4116  p.j = EDProducer("mj")
4117  self.assertEqual(_lineDiff(p.dumpPython(),Process('test').dumpPython()),
4118 """process.a = cms.EDProducer("ma")
4119 process.c = cms.EDProducer("mc")
4120 process.d = cms.EDProducer("md")
4121 process.e = cms.EDProducer("me")
4122 process.f = cms.EDProducer("mf")
4123 process.g = cms.EDProducer("mg")
4124 process.h = cms.EDProducer("mh")
4125 process.i = cms.EDProducer("mi")
4126 process.j = cms.EDProducer("mj")
4127 process.b = cms.EDAnalyzer("mb")
4128 process.t1 = cms.ConditionalTask(cms.ConditionalTaskPlaceholder("c"))
4129 process.t2 = cms.ConditionalTask(cms.ConditionalTaskPlaceholder("d"), process.a, process.t1)
4130 process.t3 = cms.ConditionalTask(cms.ConditionalTaskPlaceholder("e"))
4131 process.t5 = cms.ConditionalTask(cms.ConditionalTaskPlaceholder("g"), cms.ConditionalTaskPlaceholder("t4"), process.a)
4132 process.t4 = cms.ConditionalTask(cms.ConditionalTaskPlaceholder("f"))
4133 process.path1 = cms.Path(process.b, process.t2, process.t3)
4134 process.path2 = cms.Path(process.b, process.t5)
4135 process.schedule = cms.Schedule(*[ process.path1, process.path2 ])""")
4136  p.resolve()
4137  self.assertEqual(_lineDiff(p.dumpPython(),Process('test').dumpPython()),
4138 """process.a = cms.EDProducer("ma")
4139 process.c = cms.EDProducer("mc")
4140 process.d = cms.EDProducer("md")
4141 process.e = cms.EDProducer("me")
4142 process.f = cms.EDProducer("mf")
4143 process.g = cms.EDProducer("mg")
4144 process.h = cms.EDProducer("mh")
4145 process.i = cms.EDProducer("mi")
4146 process.j = cms.EDProducer("mj")
4147 process.b = cms.EDAnalyzer("mb")
4148 process.t1 = cms.ConditionalTask(process.c)
4149 process.t2 = cms.ConditionalTask(process.a, process.d, process.t1)
4150 process.t3 = cms.ConditionalTask(process.e)
4151 process.t4 = cms.ConditionalTask(process.f)
4152 process.t5 = cms.ConditionalTask(process.a, process.g, process.t4)
4153 process.path1 = cms.Path(process.b, process.t2, process.t3)
4154 process.path2 = cms.Path(process.b, process.t5)
4155 process.schedule = cms.Schedule(*[ process.path1, process.path2 ])""")
4156 
def _lineDiff(newString, oldString)
Definition: Config.py:2094
def dumpPython(process, name)

◆ testContains()

def Config.TestModuleCommand.testContains (   self)

Definition at line 3387 of file Config.py.

3387  def testContains(self):
3388 
3389  a = EDProducer("a")
3390  b = EDProducer("b")
3391  c = EDProducer("c")
3392  d = EDProducer("d")
3393  e = EDProducer("e")
3394  f = EDProducer("f")
3395  g = EDProducer("g")
3396  h = EDProducer("h")
3397  i = EDProducer("i")
3398  j = EDProducer("j")
3399  k = EDProducer("k")
3400  l = EDProducer("l")
3401  m = EDProducer("m")
3402  n = EDProducer("n")
3403 
3404  seq1 = Sequence(e)
3405  task1 = Task(g)
3406  ctask1 = ConditionalTask(h)
3407  path = Path(a * c * seq1, task1, ctask1)
3408 
3409  self.assertTrue(path.contains(a))
3410  self.assertFalse(path.contains(b))
3411  self.assertTrue(path.contains(c))
3412  self.assertFalse(path.contains(d))
3413  self.assertTrue(path.contains(e))
3414  self.assertFalse(path.contains(f))
3415  self.assertTrue(path.contains(g))
3416  self.assertTrue(path.contains(h))
3417 
3418  endpath = EndPath(h * i)
3419  self.assertFalse(endpath.contains(b))
3420  self.assertTrue(endpath.contains(i))
3421 
3422  seq = Sequence(a * c)
3423  self.assertFalse(seq.contains(b))
3424  self.assertTrue(seq.contains(c))
3425 
3426  task2 = Task(l)
3427  task = Task(j, k, task2)
3428  self.assertFalse(task.contains(b))
3429  self.assertTrue(task.contains(j))
3430  self.assertTrue(task.contains(k))
3431  self.assertTrue(task.contains(l))
3432 
3433  task3 = Task(m)
3434  path2 = Path(n)
3435  sch = Schedule(path, path2, tasks=[task,task3])
3436  self.assertFalse(sch.contains(b))
3437  self.assertTrue(sch.contains(a))
3438  self.assertTrue(sch.contains(c))
3439  self.assertTrue(sch.contains(e))
3440  self.assertTrue(sch.contains(g))
3441  self.assertTrue(sch.contains(n))
3442  self.assertTrue(sch.contains(j))
3443  self.assertTrue(sch.contains(k))
3444  self.assertTrue(sch.contains(l))
3445  self.assertTrue(sch.contains(m))
3446 
3447  ctask2 = ConditionalTask(l, task1)
3448  ctask = ConditionalTask(j, k, ctask2)
3449  self.assertFalse(ctask.contains(b))
3450  self.assertTrue(ctask.contains(j))
3451  self.assertTrue(ctask.contains(k))
3452  self.assertTrue(ctask.contains(l))
3453  self.assertTrue(ctask.contains(g))
3454 
def testContains(self)
Definition: helpers.py:421

◆ testDelete()

def Config.TestModuleCommand.testDelete (   self)

Definition at line 4157 of file Config.py.

References ConfigBuilder.dumpPython().

4157  def testDelete(self):
4158  p = Process("test")
4159  p.a = EDAnalyzer("MyAnalyzer")
4160  p.b = EDAnalyzer("YourAnalyzer")
4161  p.c = EDAnalyzer("OurAnalyzer")
4162  p.d = EDAnalyzer("OurAnalyzer")
4163  p.e = EDAnalyzer("OurAnalyzer")
4164  p.f = EDAnalyzer("OurAnalyzer")
4165  p.g = EDProducer("OurProducer")
4166  p.h = EDProducer("YourProducer")
4167  p.i = SwitchProducerTest(
4168  test1 = EDProducer("OneProducer"),
4169  test2 = EDProducer("TwoProducer")
4170  )
4171  p.t1 = Task(p.g, p.h, p.i)
4172  t2 = Task(p.g, p.h, p.i)
4173  t3 = Task(p.g, p.h)
4174  p.t4 = Task(p.h)
4175  p.ct1 = ConditionalTask(p.g, p.h, p.i)
4176  ct2 = ConditionalTask(p.g, p.h)
4177  ct3 = ConditionalTask(p.g, p.h)
4178  p.ct4 = ConditionalTask(p.h)
4179  p.s = Sequence(p.d+p.e)
4180  p.path1 = Path(p.a+p.f+p.s,t2,ct2)
4181  p.path2 = Path(p.a)
4182  p.path3 = Path(ct3, p.ct4)
4183  p.endpath2 = EndPath(p.b)
4184  p.endpath1 = EndPath(p.b+p.f)
4185  p.schedule = Schedule(p.path2, p.path3, p.endpath2, tasks=[t3, p.t4])
4186  self.assertTrue(hasattr(p, 'f'))
4187  self.assertTrue(hasattr(p, 'g'))
4188  self.assertTrue(hasattr(p, 'i'))
4189  del p.e
4190  del p.f
4191  del p.g
4192  del p.i
4193  self.assertFalse(hasattr(p, 'f'))
4194  self.assertFalse(hasattr(p, 'g'))
4195  self.assertEqual(p.t1.dumpPython(), 'cms.Task(process.h)\n')
4196  self.assertEqual(p.ct1.dumpPython(), 'cms.ConditionalTask(process.h)\n')
4197  self.assertEqual(p.s.dumpPython(), 'cms.Sequence(process.d)\n')
4198  self.assertEqual(p.path1.dumpPython(), 'cms.Path(process.a+process.s, cms.ConditionalTask(process.h), cms.Task(process.h))\n')
4199  self.assertEqual(p.endpath1.dumpPython(), 'cms.EndPath(process.b)\n')
4200  self.assertEqual(p.path3.dumpPython(), 'cms.Path(cms.ConditionalTask(process.h), process.ct4)\n')
4201  del p.s
4202  self.assertEqual(p.path1.dumpPython(), 'cms.Path(process.a+(process.d), cms.ConditionalTask(process.h), cms.Task(process.h))\n')
4203  self.assertEqual(p.schedule_().dumpPython(), 'cms.Schedule(*[ process.path2, process.path3, process.endpath2 ], tasks=[cms.Task(process.h), process.t4])\n')
4204  del p.path2
4205  self.assertEqual(p.schedule_().dumpPython(), 'cms.Schedule(*[ process.path3, process.endpath2 ], tasks=[cms.Task(process.h), process.t4])\n')
4206  del p.path3
4207  self.assertEqual(p.schedule_().dumpPython(), 'cms.Schedule(*[ process.endpath2 ], tasks=[cms.Task(process.h), process.t4])\n')
4208  del p.endpath2
4209  self.assertEqual(p.schedule_().dumpPython(), 'cms.Schedule(tasks=[cms.Task(process.h), process.t4])\n')
4210  del p.t4
4211  self.assertEqual(p.schedule_().dumpPython(), 'cms.Schedule(tasks=[cms.Task(process.h)])\n')
def dumpPython(process, name)

◆ testExamples()

def Config.TestModuleCommand.testExamples (   self)

Definition at line 3657 of file Config.py.

References Types.untracked.

3657  def testExamples(self):
3658  p = Process("Test")
3659  p.source = Source("PoolSource",fileNames = untracked(string("file:reco.root")))
3660  p.foos = EDProducer("FooProducer")
3661  p.bars = EDProducer("BarProducer", foos=InputTag("foos"))
3662  p.out = OutputModule("PoolOutputModule",fileName=untracked(string("file:foos.root")))
3663  p.bars.foos = 'Foosball'
3664  self.assertEqual(p.bars.foos, InputTag('Foosball'))
3665  p.p = Path(p.foos*p.bars)
3666  p.e = EndPath(p.out)
3667  p.add_(Service("MessageLogger"))
3668 
untracked
Definition: Types.py:34

◆ testFinalPath()

def Config.TestModuleCommand.testFinalPath (   self)

Definition at line 3312 of file Config.py.

References str.

3312  def testFinalPath(self):
3313  p = Process("test")
3314  p.a = OutputModule("MyOutputModule")
3315  p.b = OutputModule("YourOutputModule")
3316  p.c = OutputModule("OurOutputModule")
3317  path = FinalPath(p.a)
3318  path *= p.b
3319  path += p.c
3320  self.assertEqual(str(path),'a+b+c')
3321  path = FinalPath(p.a*p.b+p.c)
3322  self.assertEqual(str(path),'a+b+c')
3323  path = FinalPath(p.a+ p.b*p.c)
3324  self.assertEqual(str(path),'a+b+c')
3325  path = FinalPath(p.a*(p.b+p.c))
3326  self.assertEqual(str(path),'a+b+c')
3327  p.es = ESProducer("AnESProducer")
3328  self.assertRaises(TypeError,FinalPath, p.es)
3329 
3330  t = FinalPath()
3331  self.assertEqual(t.dumpPython(PrintOptions()), 'cms.FinalPath()\n')
3332 
3333  t = FinalPath(p.a)
3334  self.assertEqual(t.dumpPython(PrintOptions()), 'cms.FinalPath(process.a)\n')
3335 
3336  self.assertRaises(TypeError, FinalPath, Task())
3337  self.assertRaises(TypeError, FinalPath, p.a, Task())
3338 
3339  p.prod = EDProducer("prodName")
3340  p.t1 = Task(p.prod)
3341  self.assertRaises(TypeError, FinalPath, p.a, p.t1, Task(), p.t1)
3342 
3343  p.prod = EDProducer("prodName")
3344  p.t1 = ConditionalTask(p.prod)
3345  self.assertRaises(TypeError, FinalPath, p.a, p.t1, ConditionalTask(), p.t1)
3346 
3347  p.t = FinalPath(p.a)
3348  p.a = OutputModule("ReplacedOutputModule")
3349  self.assertEqual(p.t.dumpPython(PrintOptions()), 'cms.FinalPath(process.a)\n')
3350 
3351  p.anal = EDAnalyzer("MyAnalyzer")
3352  p.t = FinalPath(p.anal)
3353  pset = TestMakePSet()
3354  self.assertRaises(RuntimeError, p.fillProcessDesc, pset)
3355 
3356  p.prod = EDProducer("MyProducer")
3357  p.t = FinalPath(p.prod)
3358  pset = TestMakePSet()
3359  self.assertRaises(RuntimeError, p.fillProcessDesc, pset)
3360 
3361  p.filt = EDFilter("MyFilter")
3362  p.t = FinalPath(p.filt)
3363  pset = TestMakePSet()
3364  self.assertRaises(RuntimeError, p.fillProcessDesc, pset)
3365 
3366  p.outp = OutputModule("MyOutputModule")
3367  p.t = FinalPath(p.outp)
3368  pset = TestMakePSet()
3369  p.fillProcessDesc(pset)
3370 
#define str(s)

◆ testFreeze()

def Config.TestModuleCommand.testFreeze (   self)

Definition at line 3689 of file Config.py.

3689  def testFreeze(self):
3690  process = Process("Freeze")
3691  m = EDProducer("M", p=PSet(i = int32(1)))
3692  m.p.i = 2
3693  process.m = m
3694  # should be frozen
3695  #self.assertRaises(ValueError, setattr, m.p, 'i', 3)
3696  #self.assertRaises(ValueError, setattr, m, 'p', PSet(i=int32(1)))
3697  #self.assertRaises(ValueError, setattr, m.p, 'j', 1)
3698  #self.assertRaises(ValueError, setattr, m, 'j', 1)
3699  # But OK to change through the process
3700  process.m.p.i = 4
3701  self.assertEqual(process.m.p.i.value(), 4)
3702  process.m.p = PSet(j=int32(1))
3703  # should work to clone it, though
3704  m2 = m.clone(p = PSet(i = int32(5)), j = int32(8))
3705  m2.p.i = 6
3706  m2.j = 8
Definition: PSet.py:1

◆ testGlobalReplace()

def Config.TestModuleCommand.testGlobalReplace (   self)

Definition at line 2767 of file Config.py.

2767  def testGlobalReplace(self):
2768  p = Process('test')
2769  p.a = EDAnalyzer("MyAnalyzer")
2770  old = p.a
2771  p.b = EDAnalyzer("YourAnalyzer")
2772  p.c = EDAnalyzer("OurAnalyzer")
2773  p.d = EDProducer("MyProducer")
2774  old2 = p.d
2775  p.t1 = Task(p.d)
2776  t2 = Task(p.d)
2777  t3 = Task(p.d)
2778  t4 = Task(p.d)
2779  t5 = Task(p.d)
2780  t6 = Task(p.d)
2781  p.ct1 = ConditionalTask(p.d)
2782  s = Sequence(p.a*p.b)
2783  p.s4 = Sequence(p.a*p.b, p.ct1)
2784  s.associate(t2)
2785  p.s4.associate(t2)
2786  p.p = Path(p.c+s+p.a)
2787  p.p2 = Path(p.c+p.s4+p.a, p.ct1)
2788  p.e3 = EndPath(p.c+s+p.a)
2789  new = EDAnalyzer("NewAnalyzer")
2790  new2 = EDProducer("NewProducer")
2791  visitor1 = NodeVisitor()
2792  p.p.visit(visitor1)
2793  self.assertTrue(visitor1.modules == set([old,old2,p.b,p.c]))
2794  p.schedule = Schedule(tasks=[t6])
2795  p.globalReplace("a",new)
2796  p.globalReplace("d",new2)
2797  visitor2 = NodeVisitor()
2798  p.p.visit(visitor2)
2799  self.assertTrue(visitor2.modules == set([new,new2,p.b,p.c]))
2800  self.assertEqual(p.p.dumpPython()[:-1], "cms.Path(process.c+process.a+process.b+process.a, cms.Task(process.d))")
2801  visitor_p2 = NodeVisitor()
2802  p.p2.visit(visitor_p2)
2803  self.assertTrue(visitor_p2.modules == set([new,new2,p.b,p.c]))
2804  self.assertEqual(p.p2.dumpPython()[:-1], "cms.Path(process.c+process.s4+process.a, process.ct1)")
2805  visitor3 = NodeVisitor()
2806  p.e3.visit(visitor3)
2807  self.assertTrue(visitor3.modules == set([new,new2,p.b,p.c]))
2808  visitor4 = NodeVisitor()
2809  p.s4.visit(visitor4)
2810  self.assertTrue(visitor4.modules == set([new,new2,p.b]))
2811  self.assertEqual(p.s4.dumpPython()[:-1],"cms.Sequence(process.a+process.b, cms.Task(process.d), process.ct1)")
2812  visitor5 = NodeVisitor()
2813  p.t1.visit(visitor5)
2814  self.assertTrue(visitor5.modules == set([new2]))
2815  visitor6 = NodeVisitor()
2816  listOfTasks = list(p.schedule._tasks)
2817  listOfTasks[0].visit(visitor6)
2818  self.assertTrue(visitor6.modules == set([new2]))
2819  visitor7 = NodeVisitor()
2820  p.ct1.visit(visitor7)
2821  self.assertTrue(visitor7.modules == set([new2]))
2822  visitor8 = NodeVisitor()
2823  listOfConditionalTasks = list(p.conditionaltasks.values())
2824  listOfConditionalTasks[0].visit(visitor8)
2825  self.assertTrue(visitor8.modules == set([new2]))
2826 
2827 
2828  p.d2 = EDProducer("YourProducer")
2829  p.schedule = Schedule(p.p, p.p2, p.e3, tasks=[p.t1])
2830  self.assertEqual(p.schedule.dumpPython()[:-1], "cms.Schedule(*[ process.p, process.p2, process.e3 ], tasks=[process.t1])")
2831  p.p = Path(p.c+s)
2832  self.assertEqual(p.schedule.dumpPython()[:-1], "cms.Schedule(*[ process.p, process.p2, process.e3 ], tasks=[process.t1])")
2833  p.e3 = EndPath(p.c)
2834  self.assertEqual(p.schedule.dumpPython()[:-1], "cms.Schedule(*[ process.p, process.p2, process.e3 ], tasks=[process.t1])")
2835  p.t1 = Task(p.d2)
2836  self.assertEqual(p.schedule.dumpPython()[:-1], "cms.Schedule(*[ process.p, process.p2, process.e3 ], tasks=[process.t1])")
2837 

◆ testImplicitSchedule()

def Config.TestModuleCommand.testImplicitSchedule (   self)

Definition at line 3560 of file Config.py.

3560  def testImplicitSchedule(self):
3561  p = Process("test")
3562  p.a = EDAnalyzer("MyAnalyzer")
3563  p.b = EDAnalyzer("YourAnalyzer")
3564  p.c = EDAnalyzer("OurAnalyzer")
3565  p.path1 = Path(p.a)
3566  p.path2 = Path(p.b)
3567  self.assertTrue(p.schedule is None)
3568  pths = p.paths
3569  keys = pths.keys()
3570  self.assertEqual(pths[keys[0]],p.path1)
3571  self.assertEqual(pths[keys[1]],p.path2)
3572  p.prune()
3573  self.assertTrue(hasattr(p, 'a'))
3574  self.assertTrue(hasattr(p, 'b'))
3575  self.assertTrue(not hasattr(p, 'c'))
3576  self.assertTrue(hasattr(p, 'path1'))
3577  self.assertTrue(hasattr(p, 'path2'))
3578 
3579 
3580  p = Process("test")
3581  p.a = EDAnalyzer("MyAnalyzer")
3582  p.b = EDAnalyzer("YourAnalyzer")
3583  p.c = EDAnalyzer("OurAnalyzer")
3584  p.path2 = Path(p.b)
3585  p.path1 = Path(p.a)
3586  self.assertTrue(p.schedule is None)
3587  pths = p.paths
3588  keys = pths.keys()
3589  self.assertEqual(pths[keys[1]],p.path1)
3590  self.assertEqual(pths[keys[0]],p.path2)
3591 
3592 

◆ testMaxEvents()

def Config.TestModuleCommand.testMaxEvents (   self)

Definition at line 3639 of file Config.py.

3639  def testMaxEvents(self):
3640  p = Process("Test")
3641  p.maxEvents.input = 10
3642  self.assertEqual(p.maxEvents.input.value(),10)
3643  p = Process("Test")
3644  p.maxEvents.output = 10
3645  self.assertEqual(p.maxEvents.output.value(),10)
3646  p = Process("Test")
3647  p.maxEvents.output = PSet(out=untracked.int32(10))
3648  self.assertEqual(p.maxEvents.output.out.value(), 10)
3649  p = Process("Test")
3650  p.maxEvents = untracked.PSet(input = untracked.int32(5))
3651  self.assertEqual(p.maxEvents.input.value(), 5)
3652  del p.maxEvents
3653  self.assertRaises(TypeError, setattr, p, 'maxEvents', untracked.PSet(input = untracked.uint32(1)))
3654  p.maxEvents = untracked.PSet(input = untracked.int32(1))
3655  self.assertEqual(p.maxEvents.input.value(), 1)
3656 
Definition: PSet.py:1

◆ testModifier()

def Config.TestModuleCommand.testModifier (   self)

Definition at line 4212 of file Config.py.

References submitPVValidationJobs.__init__(), and resolutioncreator_cfi.object.

4212  def testModifier(self):
4213  m1 = Modifier()
4214  Process._firstProcess = True
4215  p = Process("test")
4216  self.assertRaises(RuntimeError, lambda: Process("test2", m1))
4217  m1 = Modifier()
4218  Process._firstProcess = True
4219  p = Process("test",m1)
4220  p.a = EDAnalyzer("MyAnalyzer", fred = int32(1))
4221  def _mod_fred(obj):
4222  obj.fred = 2
4223  m1.toModify(p.a,_mod_fred)
4224  self.assertEqual(p.a.fred.value(),2)
4225  p.b = EDAnalyzer("YourAnalyzer", wilma = int32(1))
4226  m1.toModify(p.b, wilma = 2)
4227  self.assertEqual(p.b.wilma.value(),2)
4228  self.assertTrue(p.isUsingModifier(m1))
4229  #check that Modifier not attached to a process doesn't run
4230  m1 = Modifier()
4231  Process._firstProcess = True
4232  p = Process("test")
4233  p.a = EDAnalyzer("MyAnalyzer", fred = int32(1))
4234  m1.toModify(p.a,_mod_fred)
4235  p.b = EDAnalyzer("YourAnalyzer", wilma = int32(1))
4236  m1.toModify(p.b, wilma = 2)
4237  self.assertEqual(p.a.fred.value(),1)
4238  self.assertEqual(p.b.wilma.value(),1)
4239  self.assertEqual(p.isUsingModifier(m1),False)
4240  #make sure clones get the changes
4241  m1 = Modifier()
4242  Process._firstProcess = True
4243  p = Process("test",m1)
4244  p.a = EDAnalyzer("MyAnalyzer", fred = int32(1), wilma = int32(1))
4245  m1.toModify(p.a, fred = int32(2))
4246  p.b = p.a.clone(wilma = int32(3))
4247  self.assertEqual(p.a.fred.value(),2)
4248  self.assertEqual(p.a.wilma.value(),1)
4249  self.assertEqual(p.b.fred.value(),2)
4250  self.assertEqual(p.b.wilma.value(),3)
4251  #test removal of parameter
4252  m1 = Modifier()
4253  Process._firstProcess = True
4254  p = Process("test",m1)
4255  p.a = EDAnalyzer("MyAnalyzer", fred = int32(1), wilma = int32(1), fintstones = PSet(fred = int32(1)))
4256  m1.toModify(p.a, fred = None, fintstones = dict(fred = None))
4257  self.assertEqual(hasattr(p.a, "fred"), False)
4258  self.assertEqual(hasattr(p.a.fintstones, "fred"), False)
4259  self.assertEqual(p.a.wilma.value(),1)
4260  #test adding a parameter
4261  m1 = Modifier()
4262  Process._firstProcess = True
4263  p = Process("test",m1)
4264  p.a = EDAnalyzer("MyAnalyzer", fred = int32(1))
4265  m1.toModify(p.a, wilma = int32(2))
4266  self.assertEqual(p.a.fred.value(), 1)
4267  self.assertEqual(p.a.wilma.value(),2)
4268  #test setting of value in PSet
4269  m1 = Modifier()
4270  Process._firstProcess = True
4271  p = Process("test",m1)
4272  p.a = EDAnalyzer("MyAnalyzer", flintstones = PSet(fred = int32(1), wilma = int32(1)))
4273  m1.toModify(p.a, flintstones = dict(fred = int32(2)))
4274  self.assertEqual(p.a.flintstones.fred.value(),2)
4275  self.assertEqual(p.a.flintstones.wilma.value(),1)
4276  #test proper exception from nonexisting parameter name
4277  m1 = Modifier()
4278  Process._firstProcess = True
4279  p = Process("test",m1)
4280  p.a = EDAnalyzer("MyAnalyzer", flintstones = PSet(fred = PSet(wilma = int32(1))))
4281  self.assertRaises(KeyError, lambda: m1.toModify(p.a, flintstones = dict(imnothere = dict(wilma=2))))
4282  self.assertRaises(KeyError, lambda: m1.toModify(p.a, foo = 1))
4283  #test setting a value in a VPSet
4284  m1 = Modifier()
4285  Process._firstProcess = True
4286  p = Process("test",m1)
4287  p.a = EDAnalyzer("MyAnalyzer", flintstones = VPSet(PSet(fred = int32(1)), PSet(wilma = int32(1))))
4288  m1.toModify(p.a, flintstones = {1:dict(wilma = int32(2))})
4289  self.assertEqual(p.a.flintstones[0].fred.value(),1)
4290  self.assertEqual(p.a.flintstones[1].wilma.value(),2)
4291  #test setting a value in a list of values
4292  m1 = Modifier()
4293  Process._firstProcess = True
4294  p = Process("test",m1)
4295  p.a = EDAnalyzer("MyAnalyzer", fred = vuint32(1,2,3))
4296  m1.toModify(p.a, fred = {1:7})
4297  self.assertEqual(p.a.fred[0],1)
4298  self.assertEqual(p.a.fred[1],7)
4299  self.assertEqual(p.a.fred[2],3)
4300  #test IndexError setting a value in a list to an item key not in the list
4301  m1 = Modifier()
4302  Process._firstProcess = True
4303  p = Process("test",m1)
4304  p.a = EDAnalyzer("MyAnalyzer", fred = vuint32(1,2,3))
4305  raised = False
4306  try: m1.toModify(p.a, fred = {5:7})
4307  except IndexError as e: raised = True
4308  self.assertEqual(raised, True)
4309  #test TypeError setting a value in a list using a key that is not an int
4310  m1 = Modifier()
4311  Process._firstProcess = True
4312  p = Process("test",m1)
4313  p.a = EDAnalyzer("MyAnalyzer", flintstones = VPSet(PSet(fred = int32(1)), PSet(wilma = int32(1))))
4314  raised = False
4315  try: m1.toModify(p.a, flintstones = dict(bogus = int32(37)))
4316  except TypeError as e: raised = True
4317  self.assertEqual(raised, True)
4318  #test that load causes process wide methods to run
4319  def _rem_a(proc):
4320  del proc.a
4321  class ProcModifierMod(object):
4322  def __init__(self,modifier,func):
4323  self.proc_mod_ = modifier.makeProcessModifier(func)
4324  class DummyMod(object):
4325  def __init__(self):
4326  self.a = EDAnalyzer("Dummy")
4327  testMod = DummyMod()
4328  p.extend(testMod)
4329  self.assertTrue(hasattr(p,"a"))
4330  m1 = Modifier()
4331  Process._firstProcess = True
4332  p = Process("test",m1)
4333  testProcMod = ProcModifierMod(m1,_rem_a)
4334  p.extend(testMod)
4335  p.extend(testProcMod)
4336  self.assertTrue(not hasattr(p,"a"))
4337  #test ModifierChain
4338  m1 = Modifier()
4339  mc = ModifierChain(m1)
4340  Process._firstProcess = True
4341  p = Process("test",mc)
4342  self.assertTrue(p.isUsingModifier(m1))
4343  self.assertTrue(p.isUsingModifier(mc))
4344  testMod = DummyMod()
4345  p.b = EDAnalyzer("Dummy2", fred = int32(1))
4346  m1.toModify(p.b, fred = int32(3))
4347  p.extend(testMod)
4348  testProcMod = ProcModifierMod(m1,_rem_a)
4349  p.extend(testProcMod)
4350  self.assertTrue(not hasattr(p,"a"))
4351  self.assertEqual(p.b.fred.value(),3)
4352  #check cloneAndExclude
4353  m1 = Modifier()
4354  m2 = Modifier()
4355  mc = ModifierChain(m1,m2)
4356  mclone = mc.copyAndExclude([m2])
4357  self.assertTrue(not mclone._isOrContains(m2))
4358  self.assertTrue(mclone._isOrContains(m1))
4359  m3 = Modifier()
4360  mc2 = ModifierChain(mc,m3)
4361  mclone = mc2.copyAndExclude([m2])
4362  self.assertTrue(not mclone._isOrContains(m2))
4363  self.assertTrue(mclone._isOrContains(m1))
4364  self.assertTrue(mclone._isOrContains(m3))
4365  #check combining
4366  m1 = Modifier()
4367  m2 = Modifier()
4368  Process._firstProcess = True
4369  p = Process("test",m1)
4370  p.a = EDAnalyzer("MyAnalyzer", fred = int32(1), wilma = int32(1))
4371  (m1 & m2).toModify(p.a, fred = int32(2))
4372  self.assertRaises(TypeError, lambda: (m1 & m2).toModify(p.a, 1, wilma=2))
4373  self.assertEqual(p.a.fred, 1)
4374  m1 = Modifier()
4375  m2 = Modifier()
4376  Process._firstProcess = True
4377  p = Process("test",m1,m2)
4378  p.a = EDAnalyzer("MyAnalyzer", fred = int32(1), wilma = int32(1))
4379  (m1 & m2).toModify(p.a, fred = int32(2))
4380  self.assertEqual(p.a.fred, 2)
4381  m1 = Modifier()
4382  m2 = Modifier()
4383  m3 = Modifier()
4384  Process._firstProcess = True
4385  p = Process("test",m1,m2,m3)
4386  p.a = EDAnalyzer("MyAnalyzer", fred = int32(1), wilma = int32(1))
4387  (m1 & m2 & m3).toModify(p.a, fred = int32(2))
4388  self.assertEqual(p.a.fred, 2)
4389  (m1 & (m2 & m3)).toModify(p.a, fred = int32(3))
4390  self.assertEqual(p.a.fred, 3)
4391  ((m1 & m2) & m3).toModify(p.a, fred = int32(4))
4392  self.assertEqual(p.a.fred, 4)
4393  #check inverse
4394  m1 = Modifier()
4395  m2 = Modifier()
4396  Process._firstProcess = True
4397  p = Process("test", m1)
4398  p.a = EDAnalyzer("MyAnalyzer", fred = int32(1), wilma = int32(1))
4399  (~m1).toModify(p.a, fred=2)
4400  self.assertEqual(p.a.fred, 1)
4401  (~m2).toModify(p.a, wilma=2)
4402  self.assertEqual(p.a.wilma, 2)
4403  self.assertRaises(TypeError, lambda: (~m1).toModify(p.a, 1, wilma=2))
4404  self.assertRaises(TypeError, lambda: (~m2).toModify(p.a, 1, wilma=2))
4405  # check or
4406  m1 = Modifier()
4407  m2 = Modifier()
4408  m3 = Modifier()
4409  Process._firstProcess = True
4410  p = Process("test", m1)
4411  p.a = EDAnalyzer("MyAnalyzer", fred = int32(1), wilma = int32(1))
4412  (m1 | m2).toModify(p.a, fred=2)
4413  self.assertEqual(p.a.fred, 2)
4414  (m1 | m2 | m3).toModify(p.a, fred=3)
4415  self.assertEqual(p.a.fred, 3)
4416  (m3 | m2 | m1).toModify(p.a, fred=4)
4417  self.assertEqual(p.a.fred, 4)
4418  ((m1 | m2) | m3).toModify(p.a, fred=5)
4419  self.assertEqual(p.a.fred, 5)
4420  (m1 | (m2 | m3)).toModify(p.a, fred=6)
4421  self.assertEqual(p.a.fred, 6)
4422  (m2 | m3).toModify(p.a, fred=7)
4423  self.assertEqual(p.a.fred, 6)
4424  self.assertRaises(TypeError, lambda: (m1 | m2).toModify(p.a, 1, wilma=2))
4425  self.assertRaises(TypeError, lambda: (m2 | m3).toModify(p.a, 1, wilma=2))
4426  # check combinations
4427  m1 = Modifier()
4428  m2 = Modifier()
4429  m3 = Modifier()
4430  m4 = Modifier()
4431  Process._firstProcess = True
4432  p = Process("test", m1, m2)
4433  p.a = EDAnalyzer("MyAnalyzer", fred = int32(1), wilma = int32(1))
4434  (m1 & ~m2).toModify(p.a, fred=2)
4435  self.assertEqual(p.a.fred, 1)
4436  (m1 & ~m3).toModify(p.a, fred=2)
4437  self.assertEqual(p.a.fred, 2)
4438  (m1 | ~m2).toModify(p.a, fred=3)
4439  self.assertEqual(p.a.fred, 3)
4440  (~m1 | ~m2).toModify(p.a, fred=4)
4441  self.assertEqual(p.a.fred, 3)
4442  (~m3 & ~m4).toModify(p.a, fred=4)
4443  self.assertEqual(p.a.fred, 4)
4444  ((m1 & m3) | ~m4).toModify(p.a, fred=5)
4445  self.assertEqual(p.a.fred, 5)
4446  #check toReplaceWith
4447  m1 = Modifier()
4448  Process._firstProcess = True
4449  p = Process("test",m1)
4450  p.a =EDAnalyzer("MyAnalyzer", fred = int32(1))
4451  m1.toReplaceWith(p.a, EDAnalyzer("YourAnalyzer", wilma = int32(3)))
4452  self.assertRaises(TypeError, lambda: m1.toReplaceWith(p.a, EDProducer("YourProducer")))
4453  #Task
4454  p.b =EDAnalyzer("BAn")
4455  p.c =EDProducer("c")
4456  p.d =EDProducer("d")
4457  p.tc = Task(p.c)
4458  p.td = Task(p.d)
4459  p.s = Sequence(p.a, p.tc)
4460  m1.toReplaceWith(p.s, Sequence(p.a+p.b, p.td))
4461  self.assertEqual(p.a.wilma.value(),3)
4462  self.assertEqual(p.a.type_(),"YourAnalyzer")
4463  self.assertEqual(hasattr(p,"fred"),False)
4464  self.assertTrue(p.s.dumpPython() == "cms.Sequence(process.a+process.b, process.td)\n")
4465  p.e =EDProducer("e")
4466  m1.toReplaceWith(p.td, Task(p.e))
4467  self.assertTrue(p.td._collection == OrderedSet([p.e]))
4468  #ConditionalTask
4469  p.b =EDAnalyzer("BAn")
4470  p.c =EDProducer("c")
4471  p.d =EDProducer("d")
4472  del p.tc
4473  del p.td
4474  p.tc = ConditionalTask(p.c)
4475  p.td = ConditionalTask(p.d)
4476  p.s = Sequence(p.a, p.tc)
4477  m1.toReplaceWith(p.s, Sequence(p.a+p.b, p.td))
4478  self.assertEqual(p.a.wilma.value(),3)
4479  self.assertEqual(p.a.type_(),"YourAnalyzer")
4480  self.assertEqual(hasattr(p,"fred"),False)
4481  self.assertTrue(p.s.dumpPython() == "cms.Sequence(process.a+process.b, process.td)\n")
4482  p.e =EDProducer("e")
4483  m1.toReplaceWith(p.td, ConditionalTask(p.e))
4484  self.assertTrue(p.td._collection == OrderedSet([p.e]))
4485  #check toReplaceWith doesn't activate not chosen
4486  m1 = Modifier()
4487  Process._firstProcess = True
4488  p = Process("test")
4489  p.a =EDAnalyzer("MyAnalyzer", fred = int32(1))
4490  m1.toReplaceWith(p.a, EDAnalyzer("YourAnalyzer", wilma = int32(3)))
4491  self.assertEqual(p.a.type_(),"MyAnalyzer")
4492  #check toReplaceWith and and/not/or combinations
4493  m1 = Modifier()
4494  m2 = Modifier()
4495  m3 = Modifier()
4496  m4 = Modifier()
4497  Process._firstProcess = True
4498  p = Process("test", m1, m2)
4499  p.a = EDAnalyzer("MyAnalyzer", fred = int32(1), wilma = int32(1))
4500  self.assertRaises(TypeError, lambda: (m1 & m2).toReplaceWith(p.a, EDProducer("YourProducer")))
4501  self.assertRaises(TypeError, lambda: (m3 & m4).toReplaceWith(p.a, EDProducer("YourProducer")))
4502  self.assertRaises(TypeError, lambda: (~m3).toReplaceWith(p.a, EDProducer("YourProducer")))
4503  self.assertRaises(TypeError, lambda: (~m1).toReplaceWith(p.a, EDProducer("YourProducer")))
4504  self.assertRaises(TypeError, lambda: (m1 | m3).toReplaceWith(p.a, EDProducer("YourProducer")))
4505  self.assertRaises(TypeError, lambda: (m3 | m4).toReplaceWith(p.a, EDProducer("YourProducer")))
4506  (m1 & m2).toReplaceWith(p.a, EDAnalyzer("YourAnalyzer1"))
4507  self.assertEqual(p.a.type_(), "YourAnalyzer1")
4508  (m1 & m3).toReplaceWith(p.a, EDAnalyzer("YourAnalyzer2"))
4509  self.assertEqual(p.a.type_(), "YourAnalyzer1")
4510  (~m1).toReplaceWith(p.a, EDAnalyzer("YourAnalyzer2"))
4511  self.assertEqual(p.a.type_(), "YourAnalyzer1")
4512  (~m3).toReplaceWith(p.a, EDAnalyzer("YourAnalyzer2"))
4513  self.assertEqual(p.a.type_(), "YourAnalyzer2")
4514  (m1 | m3).toReplaceWith(p.a, EDAnalyzer("YourAnalyzer3"))
4515  self.assertEqual(p.a.type_(), "YourAnalyzer3")
4516  (m3 | m4).toReplaceWith(p.a, EDAnalyzer("YourAnalyzer4"))
4517  self.assertEqual(p.a.type_(), "YourAnalyzer3")
4518  #check chaining of toModify and toReplaceWith
4519  m1 = Modifier()
4520  m2 = Modifier()
4521  m3 = Modifier()
4522  Process._firstProcess = True
4523  p = Process("test", m1, m2)
4524  p.a = EDAnalyzer("MyAnalyzer", fred = int32(1), wilma = int32(1))
4525  p.b = EDProducer("MyProducer", barney = int32(1), betty = int32(1))
4526  (m1 & m2).toModify(p.a, fred = 2).toModify(p.b, betty = 3)
4527  self.assertEqual(p.a.fred, 2)
4528  self.assertEqual(p.a.wilma, 1)
4529  self.assertEqual(p.b.barney, 1)
4530  self.assertEqual(p.b.betty, 3)
4531  (m1 | m3).toModify(p.a, wilma = 4).toModify(p.b, barney = 5)
4532  self.assertEqual(p.a.fred, 2)
4533  self.assertEqual(p.a.wilma, 4)
4534  self.assertEqual(p.b.barney, 5)
4535  self.assertEqual(p.b.betty, 3)
4536  (m2 & ~m3).toReplaceWith(p.a, EDAnalyzer("YourAnalyzer")).toModify(p.b, barney = 6)
4537  self.assertEqual(p.a.type_(), "YourAnalyzer")
4538  self.assertEqual(p.b.barney, 6)
4539  self.assertEqual(p.b.betty, 3)
4540  (m1 & ~m3).toModify(p.a, param=int32(42)).toReplaceWith(p.b, EDProducer("YourProducer"))
4541  self.assertEqual(p.a.type_(), "YourAnalyzer")
4542  self.assertEqual(p.a.param, 42)
4543  self.assertEqual(p.b.type_(), "YourProducer")
4544 
4545  # EDAlias
4546  a = EDAlias(foo2 = VPSet(PSet(type = string("Foo2"))))
4547  m = Modifier()
4548  m._setChosen()
4549  # Modify parameters
4550  m.toModify(a, foo2 = {0: dict(type = "Foo3")})
4551  self.assertEqual(a.foo2[0].type, "Foo3")
4552  # Add an alias
4553  m.toModify(a, foo4 = VPSet(PSet(type = string("Foo4"))))
4554  self.assertEqual(a.foo2[0].type, "Foo3")
4555  self.assertEqual(a.foo4[0].type, "Foo4")
4556  # Remove an alias
4557  m.toModify(a, foo2 = None)
4558  self.assertFalse(hasattr(a, "foo2"))
4559  self.assertEqual(a.foo4[0].type, "Foo4")
4560  # Replace (doesn't work out of the box because EDAlias is not _Parameterizable
4561  m.toReplaceWith(a, EDAlias(bar = VPSet(PSet(type = string("Bar")))))
4562  self.assertFalse(hasattr(a, "foo2"))
4563  self.assertFalse(hasattr(a, "foo4"))
4564  self.assertTrue(hasattr(a, "bar"))
4565  self.assertEqual(a.bar[0].type, "Bar")
4566 
4567  # SwitchProducer
4568  sp = SwitchProducerTest(test1 = EDProducer("Foo",
4569  a = int32(1),
4570  b = PSet(c = int32(2))),
4571  test2 = EDProducer("Bar",
4572  aa = int32(11),
4573  bb = PSet(cc = int32(12))))
4574  m = Modifier()
4575  m._setChosen()
4576  # Modify parameters
4577  m.toModify(sp,
4578  test1 = dict(a = 4, b = dict(c = None)),
4579  test2 = dict(aa = 15, bb = dict(cc = 45, dd = string("foo"))))
4580  self.assertEqual(sp.test1.a.value(), 4)
4581  self.assertEqual(sp.test1.b.hasParameter("c"), False)
4582  self.assertEqual(sp.test2.aa.value(), 15)
4583  self.assertEqual(sp.test2.bb.cc.value(), 45)
4584  self.assertEqual(sp.test2.bb.dd.value(), "foo")
4585  # Replace a producer
4586  m.toReplaceWith(sp.test1, EDProducer("Fred", x = int32(42)))
4587  self.assertEqual(sp.test1.type_(), "Fred")
4588  self.assertEqual(sp.test1.x.value(), 42)
4589  self.assertRaises(TypeError, lambda: m.toReplaceWith(sp.test1, EDAnalyzer("Foo")))
4590  # Alternative way (only to be allow same syntax to be used as for adding)
4591  m.toModify(sp, test2 = EDProducer("Xyzzy", x = int32(24)))
4592  self.assertEqual(sp.test2.type_(), "Xyzzy")
4593  self.assertEqual(sp.test2.x.value(), 24)
4594  self.assertRaises(TypeError, lambda: m.toModify(sp, test2 = EDAnalyzer("Foo")))
4595  # Add a producer
4596  m.toModify(sp, test3 = EDProducer("Wilma", y = int32(24)))
4597  self.assertEqual(sp.test3.type_(), "Wilma")
4598  self.assertEqual(sp.test3.y.value(), 24)
4599  self.assertRaises(TypeError, lambda: m.toModify(sp, test4 = EDAnalyzer("Foo")))
4600  # Remove a producer
4601  m.toModify(sp, test2 = None)
4602  self.assertEqual(hasattr(sp, "test2"), False)
4603  # Add an alias
4604  m.toModify(sp, test2 = EDAlias(foo = VPSet(PSet(type = string("int")))))
4605  self.assertTrue(hasattr(sp.test2, "foo"))
4606  # Replace an alias
4607  m.toReplaceWith(sp.test2, EDAlias(bar = VPSet(PSet(type = string("int")))))
4608  self.assertTrue(hasattr(sp.test2, "bar"))
4609  # Alternative way
4610  m.toModify(sp, test2 = EDAlias(xyzzy = VPSet(PSet(type = string("int")))))
4611  self.assertTrue(hasattr(sp.test2, "xyzzy"))
4612  # Replace an alias with EDProducer
4613  self.assertRaises(TypeError, lambda: m.toReplaceWith(sp.test2, EDProducer("Foo")))
4614  m.toModify(sp, test2 = EDProducer("Foo"))
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)
Definition: PSet.py:1

◆ testOptions()

def Config.TestModuleCommand.testOptions (   self)

Definition at line 3623 of file Config.py.

3623  def testOptions(self):
3624  p = Process('test')
3625  self.assertEqual(p.options.numberOfThreads.value(),1)
3626  p.options.numberOfThreads = 8
3627  self.assertEqual(p.options.numberOfThreads.value(),8)
3628  p.options = PSet()
3629  self.assertEqual(p.options.numberOfThreads.value(),1)
3630  p.options = dict(numberOfStreams =2,
3631  numberOfThreads =2)
3632  self.assertEqual(p.options.numberOfThreads.value(),2)
3633  self.assertEqual(p.options.numberOfStreams.value(),2)
3634  del p.options
3635  self.assertRaises(TypeError, setattr, p, 'options', untracked.PSet(numberOfThreads = int32(-1)))
3636  p.options = untracked.PSet(numberOfThreads = untracked.uint32(4))
3637  self.assertEqual(p.options.numberOfThreads.value(), 4)
3638 
Definition: PSet.py:1

◆ testOverride()

def Config.TestModuleCommand.testOverride (   self)

Definition at line 3600 of file Config.py.

3600  def testOverride(self):
3601  p = Process('test')
3602  a = EDProducer("A", a1=int32(0))
3603  self.assertTrue(not a.isModified())
3604  a.a1 = 1
3605  self.assertTrue(a.isModified())
3606  p.a = a
3607  self.assertEqual(p.a.a1.value(), 1)
3608  # try adding an unmodified module.
3609  # should accept it
3610  p.a = EDProducer("A", a1=int32(2))
3611  self.assertEqual(p.a.a1.value(), 2)
3612  # try adding a modified module. Should throw
3613  # no longer, since the same (modified) say, geometry
3614  # could come from more than one cff
3615  b = EDProducer("A", a1=int32(3))
3616  b.a1 = 4
3617  #self.assertRaises(RuntimeError, setattr, *(p,'a',b))
3618  ps1 = PSet(a = int32(1))
3619  ps2 = PSet(a = int32(2))
3620  self.assertRaises(ValueError, EDProducer, 'C', ps1, ps2)
3621  self.assertRaises(ValueError, EDProducer, 'C', ps1, a=int32(3))
3622 
Definition: PSet.py:1

◆ testParameterizable()

def Config.TestModuleCommand.testParameterizable (   self)

Definition at line 2288 of file Config.py.

2288  def testParameterizable(self):
2289  p = _Parameterizable()
2290  self.assertEqual(len(p.parameterNames_()),0)
2291  p.a = int32(1)
2292  self.assertTrue('a' in p.parameterNames_())
2293  self.assertEqual(p.a.value(), 1)
2294  p.a = 10
2295  self.assertEqual(p.a.value(), 10)
2296  p.a = untracked(int32(1))
2297  self.assertEqual(p.a.value(), 1)
2298  self.assertFalse(p.a.isTracked())
2299  p.a = untracked.int32(1)
2300  self.assertEqual(p.a.value(), 1)
2301  self.assertFalse(p.a.isTracked())
2302  p = _Parameterizable(foo=int32(10), bar = untracked(double(1.0)))
2303  self.assertEqual(p.foo.value(), 10)
2304  self.assertEqual(p.bar.value(),1.0)
2305  self.assertFalse(p.bar.isTracked())
2306  self.assertRaises(TypeError,setattr,(p,'c',1))
2307  p = _Parameterizable(a=PSet(foo=int32(10), bar = untracked(double(1.0))))
2308  self.assertEqual(p.a.foo.value(),10)
2309  self.assertEqual(p.a.bar.value(),1.0)
2310  p.b = untracked(PSet(fii = int32(1)))
2311  self.assertEqual(p.b.fii.value(),1)
2312  self.assertFalse(p.b.isTracked())
2313  #test the fact that values can be shared
2314  v = int32(10)
2315  p=_Parameterizable(a=v)
2316  v.setValue(11)
2317  self.assertEqual(p.a.value(),11)
2318  p.a = 12
2319  self.assertEqual(p.a.value(),12)
2320  self.assertEqual(v.value(),12)
untracked
Definition: Types.py:34
Definition: PSet.py:1

◆ testPath()

def Config.TestModuleCommand.testPath (   self)

Definition at line 3261 of file Config.py.

References SequenceTypes.ignore(), and str.

3261  def testPath(self):
3262  p = Process("test")
3263  p.a = EDAnalyzer("MyAnalyzer")
3264  p.b = EDAnalyzer("YourAnalyzer")
3265  p.c = EDAnalyzer("OurAnalyzer")
3266  path = Path(p.a)
3267  path *= p.b
3268  path += p.c
3269  self.assertEqual(str(path),'a+b+c')
3270  path = Path(p.a*p.b+p.c)
3271  self.assertEqual(str(path),'a+b+c')
3272 # path = Path(p.a)*p.b+p.c #This leads to problems with sequences
3273 # self.assertEqual(str(path),'((a*b)+c)')
3274  path = Path(p.a+ p.b*p.c)
3275  self.assertEqual(str(path),'a+b+c')
3276  path = Path(p.a*(p.b+p.c))
3277  self.assertEqual(str(path),'a+b+c')
3278  path = Path(p.a*(p.b+~p.c))
3279  pathx = Path(p.a*(p.b+ignore(p.c)))
3280  self.assertEqual(str(path),'a+b+~c')
3281  p.es = ESProducer("AnESProducer")
3282  self.assertRaises(TypeError,Path,p.es)
3283 
3284  t = Path()
3285  self.assertEqual(t.dumpPython(PrintOptions()), 'cms.Path()\n')
3286 
3287  t = Path(p.a)
3288  self.assertEqual(t.dumpPython(PrintOptions()), 'cms.Path(process.a)\n')
3289 
3290  t = Path(Task())
3291  self.assertEqual(t.dumpPython(PrintOptions()), 'cms.Path(cms.Task())\n')
3292 
3293  t = Path(p.a, Task())
3294  self.assertEqual(t.dumpPython(PrintOptions()), 'cms.Path(process.a, cms.Task())\n')
3295 
3296  p.prod = EDProducer("prodName")
3297  p.t1 = Task(p.prod)
3298  t = Path(p.a, p.t1, Task(), p.t1)
3299  self.assertEqual(t.dumpPython(PrintOptions()), 'cms.Path(process.a, cms.Task(), process.t1)\n')
3300 
3301  t = Path(ConditionalTask())
3302  self.assertEqual(t.dumpPython(PrintOptions()), 'cms.Path(cms.ConditionalTask())\n')
3303 
3304  t = Path(p.a, ConditionalTask())
3305  self.assertEqual(t.dumpPython(PrintOptions()), 'cms.Path(process.a, cms.ConditionalTask())\n')
3306 
3307  p.prod = EDProducer("prodName")
3308  p.t1 = ConditionalTask(p.prod)
3309  t = Path(p.a, p.t1, Task(), p.t1)
3310  self.assertEqual(t.dumpPython(PrintOptions()), 'cms.Path(process.a, cms.Task(), process.t1)\n')
3311 
def ignore(seq)
#define str(s)

◆ testPrefers()

def Config.TestModuleCommand.testPrefers (   self)

Definition at line 3669 of file Config.py.

References Config._lineDiff(), and ConfigBuilder.dumpPython().

3669  def testPrefers(self):
3670  p = Process("Test")
3671  p.add_(ESSource("ForceSource"))
3672  p.juicer = ESProducer("JuicerProducer")
3673  p.prefer("ForceSource")
3674  p.prefer("juicer")
3675  self.assertEqual(_lineDiff(p.dumpPython(), Process('Test').dumpPython()),
3676 """process.juicer = cms.ESProducer("JuicerProducer")
3677 process.ForceSource = cms.ESSource("ForceSource")
3678 process.prefer("ForceSource")
3679 process.prefer("juicer")""")
3680  p.prefer("juicer",fooRcd=vstring("Foo"))
3681  self.assertEqual(_lineDiff(p.dumpPython(), Process('Test').dumpPython()),
3682 """process.juicer = cms.ESProducer("JuicerProducer")
3683 process.ForceSource = cms.ESSource("ForceSource")
3684 process.prefer("ForceSource")
3685 process.prefer("juicer",
3686  fooRcd = cms.vstring('Foo')
3687 )""")
3688 
def _lineDiff(newString, oldString)
Definition: Config.py:2094
def dumpPython(process, name)

◆ testProcessAccelerator()

def Config.TestModuleCommand.testProcessAccelerator (   self)

Definition at line 4646 of file Config.py.

4646  def testProcessAccelerator(self):
4647  proc = Process("TEST")
4648  p = TestMakePSet()
4649  proc.fillProcessDesc(p)
4650  self.assertTrue(["cpu"], p.values["@available_accelerators"][1])
4651  self.assertFalse(p.values["@selected_accelerators"][0])
4652  self.assertTrue(["cpu"], p.values["@selected_accelerators"][1])
4653  self.assertFalse(p.values["@module_type_resolver"][0])
4654  self.assertEqual("", p.values["@module_type_resolver"][1])
4655 
4656  proc = Process("TEST")
4657  self.assertRaises(TypeError, setattr, proc, "processAcceleratorTest", ProcessAcceleratorTest())
4658  proc.ProcessAcceleratorTest = ProcessAcceleratorTest()
4659  del proc.MessageLogger # remove boilerplate unnecessary for this test case
4660  self.maxDiff = None
4661  self.assertEqual(proc.dumpPython(),
4662 """import FWCore.ParameterSet.Config as cms
4663 from test import ProcessAcceleratorTest
4664 
4665 process = cms.Process("TEST")
4666 
4667 process.maxEvents = cms.untracked.PSet(
4668  input = cms.optional.untracked.int32,
4669  output = cms.optional.untracked.allowed(cms.int32,cms.PSet)
4670 )
4671 
4672 process.maxLuminosityBlocks = cms.untracked.PSet(
4673  input = cms.untracked.int32(-1)
4674 )
4675 
4676 process.options = cms.untracked.PSet(
4677  IgnoreCompletely = cms.untracked.vstring(),
4678  Rethrow = cms.untracked.vstring(),
4679  TryToContinue = cms.untracked.vstring(),
4680  accelerators = cms.untracked.vstring('*'),
4681  allowUnscheduled = cms.obsolete.untracked.bool,
4682  canDeleteEarly = cms.untracked.vstring(),
4683  deleteNonConsumedUnscheduledModules = cms.untracked.bool(True),
4684  dumpOptions = cms.untracked.bool(False),
4685  emptyRunLumiMode = cms.obsolete.untracked.string,
4686  eventSetup = cms.untracked.PSet(
4687  forceNumberOfConcurrentIOVs = cms.untracked.PSet(
4688  allowAnyLabel_=cms.required.untracked.uint32
4689  ),
4690  numberOfConcurrentIOVs = cms.untracked.uint32(0)
4691  ),
4692  fileMode = cms.untracked.string('FULLMERGE'),
4693  forceEventSetupCacheClearOnNewRun = cms.untracked.bool(False),
4694  holdsReferencesToDeleteEarly = cms.untracked.VPSet(),
4695  makeTriggerResults = cms.obsolete.untracked.bool,
4696  modulesToCallForTryToContinue = cms.untracked.vstring(),
4697  modulesToIgnoreForDeleteEarly = cms.untracked.vstring(),
4698  numberOfConcurrentLuminosityBlocks = cms.untracked.uint32(0),
4699  numberOfConcurrentRuns = cms.untracked.uint32(1),
4700  numberOfStreams = cms.untracked.uint32(0),
4701  numberOfThreads = cms.untracked.uint32(1),
4702  printDependencies = cms.untracked.bool(False),
4703  sizeOfStackForThreadsInKB = cms.optional.untracked.uint32,
4704  throwIfIllegalParameter = cms.untracked.bool(True),
4705  wantSummary = cms.untracked.bool(False)
4706 )
4707 
4708 process.ProcessAcceleratorTest = ProcessAcceleratorTest(
4709  enabled = ['test1', 'test2', 'anothertest3']
4710 )
4711 
4712 
4713 """)
4714  p = TestMakePSet()
4715  proc.fillProcessDesc(p)
4716  self.assertEqual(["*"], p.values["options"][1].values["accelerators"][1])
4717  self.assertFalse(p.values["options"][1].values["accelerators"][0])
4718  self.assertTrue(["anothertest3", "cpu", "test1", "test2"], p.values["@selected_accelerators"][1])
4719  self.assertEqual("AcceleratorTestService", p.values["services"][1][0].values["@service_type"][1])
4720  self.assertFalse(p.values["@available_accelerators"][0])
4721  self.assertTrue(["anothertest3", "cpu", "test1", "test2"], p.values["@available_accelerators"][1])
4722  self.assertFalse(p.values["@module_type_resolver"][0])
4723  self.assertEqual("", p.values["@module_type_resolver"][1])
4724 
4725  proc = Process("TEST")
4726  proc.ProcessAcceleratorTest = ProcessAcceleratorTest()
4727  proc.add_(Service("AcceleratorTestServiceRemove"))
4728  p = TestMakePSet()
4729  proc.fillProcessDesc(p)
4730  services = [x.values["@service_type"][1] for x in p.values["services"][1]]
4731  self.assertTrue("AcceleratorTestService" in services)
4732  self.assertFalse("AcceleratorTestServiceRemove" in services)
4733 
4734  proc = Process("TEST")
4735  proc.ProcessAcceleratorTest = ProcessAcceleratorTest(enabled=["test1"])
4736  p = TestMakePSet()
4737  proc.fillProcessDesc(p)
4738  self.assertEqual(["cpu", "test1"], p.values["@selected_accelerators"][1])
4739  self.assertEqual(["cpu", "test1"], p.values["@available_accelerators"][1])
4740 
4741  proc = Process("TEST")
4742  proc.ProcessAcceleratorTest = ProcessAcceleratorTest()
4743  proc.options.accelerators = ["test2"]
4744  p = TestMakePSet()
4745  proc.fillProcessDesc(p)
4746  self.assertEqual(["test2"], p.values["@selected_accelerators"][1])
4747  self.assertEqual(["anothertest3", "cpu", "test1", "test2"], p.values["@available_accelerators"][1])
4748 
4749  proc = Process("TEST")
4750  proc.ProcessAcceleratorTest = ProcessAcceleratorTest()
4751  proc.options.accelerators = ["test*"]
4752  proc.fillProcessDesc(p)
4753  self.assertEqual(["test1", "test2"], p.values["@selected_accelerators"][1])
4754  self.assertEqual(["anothertest3", "cpu", "test1", "test2"], p.values["@available_accelerators"][1])
4755 
4756  proc = Process("TEST")
4757  proc.ProcessAcceleratorTest = ProcessAcceleratorTest(enabled=["test1"])
4758  proc.options.accelerators = ["test2"]
4759  p = TestMakePSet()
4760  proc.fillProcessDesc(p)
4761  self.assertEqual([], p.values["@selected_accelerators"][1])
4762  self.assertEqual(["cpu", "test1"], p.values["@available_accelerators"][1])
4763 
4764  proc = Process("TEST")
4765  proc.ProcessAcceleratorTest = ProcessAcceleratorTest()
4766  proc.options.accelerators = ["cpu*"]
4767  p = TestMakePSet()
4768  proc.fillProcessDesc(p)
4769  self.assertEqual(["cpu"], p.values["@selected_accelerators"][1])
4770  self.assertEqual(["anothertest3", "cpu", "test1", "test2"], p.values["@available_accelerators"][1])
4771 
4772  proc = Process("TEST")
4773  proc.ProcessAcceleratorTest = ProcessAcceleratorTest()
4774  proc.options.accelerators = ["test3"]
4775  p = TestMakePSet()
4776  self.assertRaises(ValueError, proc.fillProcessDesc, p)
4777 
4778  proc = Process("TEST")
4779  proc.ProcessAcceleratorTest = ProcessAcceleratorTest()
4780  proc.options.accelerators = ["*", "test1"]
4781  p = TestMakePSet()
4782  self.assertRaises(ValueError, proc.fillProcessDesc, p)
4783 
4784  proc = Process("TEST")
4785  proc.ProcessAcceleratorTest = ProcessAcceleratorTest()
4786  proc.ProcessAcceleratorTest2 = ProcessAcceleratorTest2()
4787  p = TestMakePSet()
4788  proc.fillProcessDesc(p)
4789  self.assertEqual(["anothertest3", "anothertest4", "cpu", "test1", "test2"], p.values["@selected_accelerators"][1])
4790  self.assertEqual(["anothertest3", "anothertest4", "cpu", "test1", "test2"], p.values["@available_accelerators"][1])
4791 
4792  proc = Process("TEST")
4793  proc.ProcessAcceleratorTest = ProcessAcceleratorTest()
4794  proc.ProcessAcceleratorTest2 = ProcessAcceleratorTest2()
4795  proc.options.accelerators = ["*test3", "c*"]
4796  p = TestMakePSet()
4797  proc.fillProcessDesc(p)
4798  self.assertEqual(["anothertest3", "cpu"], p.values["@selected_accelerators"][1])
4799  self.assertEqual(["anothertest3", "anothertest4", "cpu", "test1", "test2"], p.values["@available_accelerators"][1])
4800 
4801  proc = Process("TEST")
4802  proc.ProcessAcceleratorTest = ProcessAcceleratorTest()
4803  proc.sp = SwitchProducerTest2(test2 = EDProducer("Foo",
4804  a = int32(1),
4805  b = PSet(c = int32(2))),
4806  test1 = EDProducer("Bar",
4807  aa = int32(11),
4808  bb = PSet(cc = int32(12))))
4809  proc.p = Path(proc.sp)
4810  p = TestMakePSet()
4811  proc.fillProcessDesc(p)
4812  self.assertEqual((False, "sp@test2"), p.values["sp"][1].values["@chosen_case"])
4813 
4814  proc = Process("TEST")
4815  proc.ProcessAcceleratorTest = ProcessAcceleratorTest(enabled=["test1"])
4816  proc.sp = SwitchProducerTest2(test2 = EDProducer("Foo",
4817  a = int32(1),
4818  b = PSet(c = int32(2))),
4819  test1 = EDProducer("Bar",
4820  aa = int32(11),
4821  bb = PSet(cc = int32(12))))
4822  proc.p = Path(proc.sp)
4823  p = TestMakePSet()
4824  proc.fillProcessDesc(p)
4825  self.assertEqual((False, "sp@test1"), p.values["sp"][1].values["@chosen_case"])
4826 
4827  proc = Process("TEST")
4828  proc.ProcessAcceleratorTest = ProcessAcceleratorTest()
4829  proc.options.accelerators = ["test1"]
4830  proc.sp = SwitchProducerTest2(test2 = EDProducer("Foo",
4831  a = int32(1),
4832  b = PSet(c = int32(2))),
4833  test1 = EDProducer("Bar",
4834  aa = int32(11),
4835  bb = PSet(cc = int32(12))))
4836  proc.p = Path(proc.sp)
4837  p = TestMakePSet()
4838  proc.fillProcessDesc(p)
4839  self.assertEqual((False, "sp@test1"), p.values["sp"][1].values["@chosen_case"])
4840 
4841  proc = Process("TEST")
4842  proc.ProcessAcceleratorTest = ProcessAcceleratorTest()
4843  proc.options.accelerators = ["test*"]
4844  proc.sp = SwitchProducerTest2(test2 = EDProducer("Foo",
4845  a = int32(1),
4846  b = PSet(c = int32(2))),
4847  test1 = EDProducer("Bar",
4848  aa = int32(11),
4849  bb = PSet(cc = int32(12))))
4850  proc.p = Path(proc.sp)
4851  p = TestMakePSet()
4852  proc.fillProcessDesc(p)
4853  self.assertEqual((False, "sp@test2"), p.values["sp"][1].values["@chosen_case"])
4854 
4855  proc = Process("TEST")
4856  proc.ProcessAcceleratorTest = ProcessAcceleratorTest()
4857  proc.options.accelerators = ["anothertest3"]
4858  proc.sp = SwitchProducerTest2(test2 = EDProducer("Foo",
4859  a = int32(1),
4860  b = PSet(c = int32(2))),
4861  test1 = EDProducer("Bar",
4862  aa = int32(11),
4863  bb = PSet(cc = int32(12))))
4864  proc.p = Path(proc.sp)
4865  p = TestMakePSet()
4866  self.assertRaises(RuntimeError, proc.fillProcessDesc, p)
4867 
4868  proc = Process("TEST")
4869  proc.ProcessAcceleratorTest = ProcessAcceleratorTest(
4870  moduleTypeResolverMaker=lambda accelerators: TestModuleTypeResolver(accelerators))
4871  proc.ProcessAcceleratorTest2 = ProcessAcceleratorTest2()
4872  proc.normalProducer = EDProducer("FooProducer")
4873  proc.testProducer = EDProducer("BarProducer@test")
4874  proc.test2Producer = EDProducer("BarProducer@test", test=untracked.PSet(backend=untracked.string("test2_backend")))
4875  proc.testAnalyzer = EDAnalyzer("Analyzer@test")
4876  proc.testFilter = EDAnalyzer("Filter@test")
4877  proc.testESProducer = ESProducer("ESProducer@test")
4878  proc.testESSource = ESSource("ESSource@test")
4879  proc.p = Path(proc.normalProducer+proc.testProducer+proc.test2Producer+proc.testAnalyzer+proc.testFilter)
4880  p = TestMakePSet()
4881  proc.fillProcessDesc(p)
4882  self.assertEqual("TestModuleTypeResolver", p.values["@module_type_resolver"][1])
4883  self.assertEqual("FooProducer", p.values["normalProducer"][1].values["@module_type"][1])
4884  self.assertEqual(len(list(filter(lambda x: not "@" in x, p.values["normalProducer"][1].values.keys()))), 0)
4885  self.assertEqual("BarProducer@test", p.values["testProducer"][1].values["@module_type"][1])
4886  self.assertEqual(False, p.values["testProducer"][1].values["test"][0])
4887  self.assertEqual(False, p.values["testProducer"][1].values["test"][1].values["backend"][0])
4888  self.assertEqual("test1_backend", p.values["testProducer"][1].values["test"][1].values["backend"][1])
4889  self.assertEqual("BarProducer@test", p.values["test2Producer"][1].values["@module_type"][1])
4890  self.assertEqual("test2_backend", p.values["test2Producer"][1].values["test"][1].values["backend"][1])
4891  self.assertEqual("Analyzer@test", p.values["testAnalyzer"][1].values["@module_type"][1])
4892  self.assertEqual("test1_backend", p.values["testAnalyzer"][1].values["test"][1].values["backend"][1])
4893  self.assertEqual("Filter@test", p.values["testFilter"][1].values["@module_type"][1])
4894  self.assertEqual("test1_backend", p.values["testFilter"][1].values["test"][1].values["backend"][1])
4895  self.assertEqual("ESProducer@test", p.values["ESProducer@test@testESProducer"][1].values["@module_type"][1])
4896  self.assertEqual("test1_backend", p.values["ESProducer@test@testESProducer"][1].values["test"][1].values["backend"][1])
4897  self.assertEqual("ESSource@test", p.values["ESSource@test@testESSource"][1].values["@module_type"][1])
4898  self.assertEqual("test1_backend", p.values["ESSource@test@testESSource"][1].values["test"][1].values["backend"][1])
4899 
4900  # No required accelerators available
4901  proc = Process("Test")
4902  proc.ProcessAcceleratorTest = ProcessAcceleratorTest(
4903  moduleTypeResolverMaker=lambda accelerators: TestModuleTypeResolver(accelerators))
4904  proc.options.accelerators = []
4905  self.assertRaises(EDMException, proc.fillProcessDesc, p)
4906 
4907  proc = Process("Test")
4908  proc.ProcessAcceleratorTest = ProcessAcceleratorTest(
4909  moduleTypeResolverMaker=lambda accelerators: TestModuleTypeResolver(accelerators))
4910  proc.options.accelerators = ["test1"]
4911  proc.test2Producer = EDProducer("BarProducer@test", test=untracked.PSet(backend=untracked.string("test2_backend")))
4912  proc.p = Path(proc.test2Producer)
4913  self.assertRaises(EDMException, proc.fillProcessDesc, p)
4914 
4915  # Two ProcessAccelerators return type resolver
4916  proc = Process("TEST")
4917  proc.ProcessAcceleratorTest = ProcessAcceleratorTest(
4918  moduleTypeResolverMaker=lambda accelerators: TestModuleTypeResolver(accelerators))
4919  proc.ProcessAcceleratorTest2 = ProcessAcceleratorTest2(
4920  moduleTypeResolverMaker=lambda accelerators: TestModuleTypeResolver(accelerators))
4921  p = TestMakePSet()
4922  self.assertRaises(RuntimeError, proc.fillProcessDesc, p)
4923 
4924  import pickle
4925  proc = Process("TEST")
4926  proc.ProcessAcceleratorTest = ProcessAcceleratorTest()
4927  proc.sp = SwitchProducerTest2(test2 = EDProducer("Foo",
4928  a = int32(1),
4929  b = PSet(c = int32(2))),
4930  test1 = EDProducer("Bar",
4931  aa = int32(11),
4932  bb = PSet(cc = int32(12))))
4933  proc.p = Path(proc.sp)
4934  pkl = pickle.dumps(proc)
4935  unpkl = pickle.loads(pkl)
4936  p = TestMakePSet()
4937  unpkl.fillProcessDesc(p)
4938  self.assertEqual((False, "sp@test2"), p.values["sp"][1].values["@chosen_case"])
4939  self.assertEqual(["anothertest3", "cpu", "test1", "test2"], p.values["@available_accelerators"][1])
4940  unpkl = pickle.loads(pkl)
4941  unpkl.ProcessAcceleratorTest.setEnabled(["test1"])
4942  p = TestMakePSet()
4943  unpkl.fillProcessDesc(p)
4944  self.assertEqual((False, "sp@test1"), p.values["sp"][1].values["@chosen_case"])
4945  self.assertEqual(["cpu", "test1"], p.values["@available_accelerators"][1])
4946 
4947  unittest.main()
Definition: PSet.py:1

◆ testProcessDumpPython()

def Config.TestModuleCommand.testProcessDumpPython (   self)

Definition at line 2448 of file Config.py.

References Config._lineDiff(), and ConfigBuilder.dumpPython().

2448  def testProcessDumpPython(self):
2449  self.assertEqual(Process("test").dumpPython(),
2450 """import FWCore.ParameterSet.Config as cms
2451 
2452 process = cms.Process("test")
2453 
2454 process.maxEvents = cms.untracked.PSet(
2455  input = cms.optional.untracked.int32,
2456  output = cms.optional.untracked.allowed(cms.int32,cms.PSet)
2457 )
2458 
2459 process.maxLuminosityBlocks = cms.untracked.PSet(
2460  input = cms.untracked.int32(-1)
2461 )
2462 
2463 process.options = cms.untracked.PSet(
2464  IgnoreCompletely = cms.untracked.vstring(),
2465  Rethrow = cms.untracked.vstring(),
2466  TryToContinue = cms.untracked.vstring(),
2467  accelerators = cms.untracked.vstring('*'),
2468  allowUnscheduled = cms.obsolete.untracked.bool,
2469  canDeleteEarly = cms.untracked.vstring(),
2470  deleteNonConsumedUnscheduledModules = cms.untracked.bool(True),
2471  dumpOptions = cms.untracked.bool(False),
2472  emptyRunLumiMode = cms.obsolete.untracked.string,
2473  eventSetup = cms.untracked.PSet(
2474  forceNumberOfConcurrentIOVs = cms.untracked.PSet(
2475  allowAnyLabel_=cms.required.untracked.uint32
2476  ),
2477  numberOfConcurrentIOVs = cms.untracked.uint32(0)
2478  ),
2479  fileMode = cms.untracked.string('FULLMERGE'),
2480  forceEventSetupCacheClearOnNewRun = cms.untracked.bool(False),
2481  holdsReferencesToDeleteEarly = cms.untracked.VPSet(),
2482  makeTriggerResults = cms.obsolete.untracked.bool,
2483  modulesToCallForTryToContinue = cms.untracked.vstring(),
2484  modulesToIgnoreForDeleteEarly = cms.untracked.vstring(),
2485  numberOfConcurrentLuminosityBlocks = cms.untracked.uint32(0),
2486  numberOfConcurrentRuns = cms.untracked.uint32(1),
2487  numberOfStreams = cms.untracked.uint32(0),
2488  numberOfThreads = cms.untracked.uint32(1),
2489  printDependencies = cms.untracked.bool(False),
2490  sizeOfStackForThreadsInKB = cms.optional.untracked.uint32,
2491  throwIfIllegalParameter = cms.untracked.bool(True),
2492  wantSummary = cms.untracked.bool(False)
2493 )
2494 
2495 process.MessageLogger = cms.Service("MessageLogger",
2496  cerr = cms.untracked.PSet(
2497  FwkReport = cms.untracked.PSet(
2498  limit = cms.untracked.int32(10000000),
2499  reportEvery = cms.untracked.int32(1)
2500  ),
2501  FwkSummary = cms.untracked.PSet(
2502  limit = cms.untracked.int32(10000000),
2503  reportEvery = cms.untracked.int32(1)
2504  ),
2505  INFO = cms.untracked.PSet(
2506  limit = cms.untracked.int32(0)
2507  ),
2508  Root_NoDictionary = cms.untracked.PSet(
2509  limit = cms.untracked.int32(0)
2510  ),
2511  default = cms.untracked.PSet(
2512  limit = cms.untracked.int32(10000000)
2513  ),
2514  enable = cms.untracked.bool(True),
2515  enableStatistics = cms.untracked.bool(False),
2516  lineLength = cms.optional.untracked.int32,
2517  noLineBreaks = cms.optional.untracked.bool,
2518  noTimeStamps = cms.untracked.bool(False),
2519  resetStatistics = cms.untracked.bool(False),
2520  statisticsThreshold = cms.untracked.string('WARNING'),
2521  threshold = cms.untracked.string('INFO'),
2522  allowAnyLabel_=cms.optional.untracked.PSetTemplate(
2523  limit = cms.optional.untracked.int32,
2524  reportEvery = cms.untracked.int32(1),
2525  timespan = cms.optional.untracked.int32
2526  )
2527  ),
2528  cout = cms.untracked.PSet(
2529  enable = cms.untracked.bool(False),
2530  enableStatistics = cms.untracked.bool(False),
2531  lineLength = cms.optional.untracked.int32,
2532  noLineBreaks = cms.optional.untracked.bool,
2533  noTimeStamps = cms.optional.untracked.bool,
2534  resetStatistics = cms.untracked.bool(False),
2535  statisticsThreshold = cms.optional.untracked.string,
2536  threshold = cms.optional.untracked.string,
2537  allowAnyLabel_=cms.optional.untracked.PSetTemplate(
2538  limit = cms.optional.untracked.int32,
2539  reportEvery = cms.untracked.int32(1),
2540  timespan = cms.optional.untracked.int32
2541  )
2542  ),
2543  debugModules = cms.untracked.vstring(),
2544  default = cms.untracked.PSet(
2545  limit = cms.optional.untracked.int32,
2546  lineLength = cms.untracked.int32(80),
2547  noLineBreaks = cms.untracked.bool(False),
2548  noTimeStamps = cms.untracked.bool(False),
2549  reportEvery = cms.untracked.int32(1),
2550  statisticsThreshold = cms.untracked.string('INFO'),
2551  threshold = cms.untracked.string('INFO'),
2552  timespan = cms.optional.untracked.int32,
2553  allowAnyLabel_=cms.optional.untracked.PSetTemplate(
2554  limit = cms.optional.untracked.int32,
2555  reportEvery = cms.untracked.int32(1),
2556  timespan = cms.optional.untracked.int32
2557  )
2558  ),
2559  files = cms.untracked.PSet(
2560  allowAnyLabel_=cms.optional.untracked.PSetTemplate(
2561  enableStatistics = cms.untracked.bool(False),
2562  extension = cms.optional.untracked.string,
2563  filename = cms.optional.untracked.string,
2564  lineLength = cms.optional.untracked.int32,
2565  noLineBreaks = cms.optional.untracked.bool,
2566  noTimeStamps = cms.optional.untracked.bool,
2567  output = cms.optional.untracked.string,
2568  resetStatistics = cms.untracked.bool(False),
2569  statisticsThreshold = cms.optional.untracked.string,
2570  threshold = cms.optional.untracked.string,
2571  allowAnyLabel_=cms.optional.untracked.PSetTemplate(
2572  limit = cms.optional.untracked.int32,
2573  reportEvery = cms.untracked.int32(1),
2574  timespan = cms.optional.untracked.int32
2575  )
2576  )
2577  ),
2578  suppressDebug = cms.untracked.vstring(),
2579  suppressFwkInfo = cms.untracked.vstring(),
2580  suppressInfo = cms.untracked.vstring(),
2581  suppressWarning = cms.untracked.vstring(),
2582  allowAnyLabel_=cms.optional.untracked.PSetTemplate(
2583  limit = cms.optional.untracked.int32,
2584  reportEvery = cms.untracked.int32(1),
2585  timespan = cms.optional.untracked.int32
2586  )
2587 )
2588 
2589 
2590 """)
2591  p = Process("test")
2592  p.a = EDAnalyzer("MyAnalyzer")
2593  p.p = Path(p.a)
2594  p.s = Sequence(p.a)
2595  p.r = Sequence(p.s)
2596  p.p2 = Path(p.s)
2597  p.schedule = Schedule(p.p2,p.p)
2598  d=p.dumpPython()
2599  self.assertEqual(_lineDiff(d,Process("test").dumpPython()),
2600 """process.a = cms.EDAnalyzer("MyAnalyzer")
2601 process.s = cms.Sequence(process.a)
2602 process.r = cms.Sequence(process.s)
2603 process.p = cms.Path(process.a)
2604 process.p2 = cms.Path(process.s)
2605 process.schedule = cms.Schedule(*[ process.p2, process.p ])""")
2606  #Reverse order of 'r' and 's'
2607  p = Process("test")
2608  p.a = EDAnalyzer("MyAnalyzer")
2609  p.p = Path(p.a)
2610  p.r = Sequence(p.a)
2611  p.s = Sequence(p.r)
2612  p.p2 = Path(p.r)
2613  p.schedule = Schedule(p.p2,p.p)
2614  p.b = EDAnalyzer("YourAnalyzer")
2615  d=p.dumpPython()
2616  self.assertEqual(_lineDiff(d,Process("test").dumpPython()),
2617 """process.a = cms.EDAnalyzer("MyAnalyzer")
2618 process.b = cms.EDAnalyzer("YourAnalyzer")
2619 process.r = cms.Sequence(process.a)
2620 process.s = cms.Sequence(process.r)
2621 process.p = cms.Path(process.a)
2622 process.p2 = cms.Path(process.r)
2623 process.schedule = cms.Schedule(*[ process.p2, process.p ])""")
def _lineDiff(newString, oldString)
Definition: Config.py:2094
def dumpPython(process, name)

◆ testProcessExtend()

def Config.TestModuleCommand.testProcessExtend (   self)

Definition at line 2353 of file Config.py.

References submitPVValidationJobs.__init__(), resolutioncreator_cfi.object, and str.

2353  def testProcessExtend(self):
2354  class FromArg(object):
2355  def __init__(self,*arg,**args):
2356  for name in args.keys():
2357  self.__dict__[name]=args[name]
2358 
2359  a=EDAnalyzer("MyAnalyzer")
2360  t=EDAnalyzer("MyAnalyzer")
2361  t.setLabel("foo")
2362  s1 = Sequence(a)
2363  s2 = Sequence(s1)
2364  s3 = Sequence(s2)
2365  d = FromArg(
2366  a=a,
2367  b=Service("Full"),
2368  c=Path(a),
2369  d=s2,
2370  e=s1,
2371  f=s3,
2372  g=Sequence(s1+s2+s3)
2373  )
2374  p = Process("Test")
2375  p.extend(d)
2376  self.assertEqual(p.a.type_(),"MyAnalyzer")
2377  self.assertEqual(p.a.label_(),"a")
2378  self.assertRaises(AttributeError,getattr,p,'b')
2379  self.assertEqual(p.Full.type_(),"Full")
2380  self.assertEqual(str(p.c),'a')
2381  self.assertEqual(str(p.d),'a')
2382 
2383  z1 = FromArg(
2384  a=a,
2385  b=Service("Full"),
2386  c=Path(a),
2387  d=s2,
2388  e=s1,
2389  f=s3,
2390  s4=s3,
2391  g=Sequence(s1+s2+s3)
2392  )
2393 
2394  p1 = Process("Test")
2395  #p1.extend(z1)
2396  self.assertRaises(ValueError, p1.extend, z1)
2397 
2398  z2 = FromArg(
2399  a=a,
2400  b=Service("Full"),
2401  c=Path(a),
2402  d=s2,
2403  e=s1,
2404  f=s3,
2405  aaa=copy.deepcopy(a),
2406  s4=copy.deepcopy(s3),
2407  g=Sequence(s1+s2+s3),
2408  t=t
2409  )
2410  p2 = Process("Test")
2411  p2.extend(z2)
2412  #self.assertRaises(ValueError, p2.extend, z2)
2413  self.assertEqual(p2.s4.label_(),"s4")
2414  #p2.s4.setLabel("foo")
2415  self.assertRaises(ValueError, p2.s4.setLabel, "foo")
2416  p2.s4.setLabel("s4")
2417  p2.s4.setLabel(None)
2418  p2.s4.setLabel("foo")
2419  p2._Process__setObjectLabel(p2.s4, "foo")
2420  p2._Process__setObjectLabel(p2.s4, None)
2421  p2._Process__setObjectLabel(p2.s4, "bar")
2422 
2423 
2424  p = Process('test')
2425  p.a = EDProducer("MyProducer")
2426  p.t = Task(p.a)
2427  p.p = Path(p.t)
2428  self.assertRaises(ValueError, p.extend, FromArg(a = EDProducer("YourProducer")))
2429  self.assertRaises(ValueError, p.extend, FromArg(a = EDAlias()))
2430  self.assertRaises(ValueError, p.__setattr__, "a", EDAlias())
2431 
2432  p = Process('test')
2433  p.a = EDProducer("MyProducer")
2434  p.t = ConditionalTask(p.a)
2435  p.p = Path(p.t)
2436  self.assertRaises(ValueError, p.extend, FromArg(a = EDProducer("YourProducer")))
2437  self.assertRaises(ValueError, p.extend, FromArg(a = EDAlias()))
2438  self.assertRaises(ValueError, p.__setattr__, "a", EDAlias())
2439 
2440  p = Process('test')
2441  p.a = EDProducer("MyProducer")
2442  p.s = Sequence(p.a)
2443  p.p = Path(p.s)
2444  self.assertRaises(ValueError, p.extend, FromArg(a = EDProducer("YourProducer")))
2445  self.assertRaises(ValueError, p.extend, FromArg(a = EDAlias()))
2446  self.assertRaises(ValueError, p.__setattr__, "a", EDAlias())
2447 
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)
#define str(s)

◆ testProcessForProcessAccelerator()

def Config.TestModuleCommand.testProcessForProcessAccelerator (   self)

Definition at line 4632 of file Config.py.

4632  def testProcessForProcessAccelerator(self):
4633  proc = Process("TEST")
4634  p = ProcessForProcessAccelerator(proc)
4635  p.TestService = Service("TestService")
4636  self.assertTrue(hasattr(proc, "TestService"))
4637  self.assertEqual(proc.TestService.type_(), "TestService")
4638  self.assertRaises(TypeError, setattr, p, "a", EDProducer("Foo"))
4639  p.add_(Service("TestServiceTwo"))
4640  self.assertTrue(hasattr(proc, "TestServiceTwo"))
4641  self.assertEqual(proc.TestServiceTwo.type_(), "TestServiceTwo")
4642  p.TestService.foo = untracked.uint32(42)
4643  self.assertEqual(proc.TestService.foo.value(), 42)
4644  proc.mod = EDProducer("Producer")
4645  self.assertRaises(TypeError, getattr, p, "mod")

◆ testProcessFragment()

def Config.TestModuleCommand.testProcessFragment (   self)

Definition at line 4615 of file Config.py.

4615  def testProcessFragment(self):
4616  #check defaults are not overwritten
4617  f = ProcessFragment('Fragment')
4618  p = Process('PROCESS')
4619  p.maxEvents.input = 10
4620  p.options.numberOfThreads = 4
4621  p.maxLuminosityBlocks.input = 2
4622  p.extend(f)
4623  self.assertEqual(p.maxEvents.input.value(),10)
4624  self.assertEqual(p.options.numberOfThreads.value(), 4)
4625  self.assertEqual(p.maxLuminosityBlocks.input.value(),2)
4626  #general checks
4627  f = ProcessFragment("Fragment")
4628  f.fltr = EDFilter("Foo")
4629  p = Process('PROCESS')
4630  p.extend(f)
4631  self.assertTrue(hasattr(p,'fltr'))

◆ testProcessInsertion()

def Config.TestModuleCommand.testProcessInsertion (   self)

Definition at line 2328 of file Config.py.

2328  def testProcessInsertion(self):
2329  p = Process("test")
2330  p.a = EDAnalyzer("MyAnalyzer")
2331  self.assertTrue( 'a' in p.analyzers_() )
2332  self.assertTrue( 'a' in p.analyzers)
2333  p.add_(Service("SomeService"))
2334  self.assertTrue('SomeService' in p.services_())
2335  self.assertEqual(p.SomeService.type_(), "SomeService")
2336  p.Tracer = Service("Tracer")
2337  self.assertTrue('Tracer' in p.services_())
2338  self.assertRaises(TypeError, setattr, *(p,'b',"this should fail"))
2339  self.assertRaises(TypeError, setattr, *(p,'bad',Service("MessageLogger")))
2340  self.assertRaises(ValueError, setattr, *(p,'bad',Source("PoolSource")))
2341  p.out = OutputModule("Outer")
2342  self.assertEqual(p.out.type_(), 'Outer')
2343  self.assertTrue( 'out' in p.outputModules_() )
2344 
2345  p.geom = ESSource("GeomProd")
2346  self.assertTrue('geom' in p.es_sources_())
2347  p.add_(ESSource("ConfigDB"))
2348  self.assertTrue('ConfigDB' in p.es_sources_())
2349 
2350  p.aliasfoo1 = EDAlias(foo1 = VPSet(PSet(type = string("Foo1"))))
2351  self.assertTrue('aliasfoo1' in p.aliases_())
2352 
Definition: PSet.py:1

◆ testPrune()

def Config.TestModuleCommand.testPrune (   self)

Definition at line 3866 of file Config.py.

3866  def testPrune(self):
3867  p = Process("test")
3868  p.a = EDAnalyzer("MyAnalyzer")
3869  p.b = EDAnalyzer("YourAnalyzer")
3870  p.c = EDAnalyzer("OurAnalyzer")
3871  p.d = EDAnalyzer("OurAnalyzer")
3872  p.e = EDProducer("MyProducer")
3873  p.f = EDProducer("YourProducer")
3874  p.g = EDProducer("TheirProducer")
3875  p.h = EDProducer("OnesProducer")
3876  p.s = Sequence(p.d)
3877  p.t1 = Task(p.e)
3878  p.t2 = Task(p.f)
3879  p.t3 = Task(p.g, p.t1)
3880  p.ct1 = ConditionalTask(p.h)
3881  p.ct2 = ConditionalTask(p.f)
3882  p.ct3 = ConditionalTask(p.ct1)
3883  p.path1 = Path(p.a, p.t3, p.ct3)
3884  p.path2 = Path(p.b)
3885  self.assertTrue(p.schedule is None)
3886  pths = p.paths
3887  keys = pths.keys()
3888  self.assertEqual(pths[keys[0]],p.path1)
3889  self.assertEqual(pths[keys[1]],p.path2)
3890  p.pset1 = PSet(parA = string("pset1"))
3891  p.pset2 = untracked.PSet(parA = string("pset2"))
3892  p.vpset1 = VPSet()
3893  p.vpset2 = untracked.VPSet()
3894  p.prune()
3895  self.assertTrue(hasattr(p, 'a'))
3896  self.assertTrue(hasattr(p, 'b'))
3897  self.assertTrue(not hasattr(p, 'c'))
3898  self.assertTrue(not hasattr(p, 'd'))
3899  self.assertTrue(hasattr(p, 'e'))
3900  self.assertTrue(not hasattr(p, 'f'))
3901  self.assertTrue(hasattr(p, 'g'))
3902  self.assertTrue(hasattr(p, 'h'))
3903  self.assertTrue(not hasattr(p, 's'))
3904  self.assertTrue(hasattr(p, 't1'))
3905  self.assertTrue(not hasattr(p, 't2'))
3906  self.assertTrue(hasattr(p, 't3'))
3907  self.assertTrue(hasattr(p, 'path1'))
3908  self.assertTrue(hasattr(p, 'path2'))
3909 # self.assertTrue(not hasattr(p, 'pset1'))
3910 # self.assertTrue(hasattr(p, 'pset2'))
3911 # self.assertTrue(not hasattr(p, 'vpset1'))
3912 # self.assertTrue(not hasattr(p, 'vpset2'))
3913 
3914  p = Process("test")
3915  p.a = EDAnalyzer("MyAnalyzer")
3916  p.b = EDAnalyzer("YourAnalyzer")
3917  p.c = EDAnalyzer("OurAnalyzer")
3918  p.d = EDAnalyzer("OurAnalyzer")
3919  p.e = EDAnalyzer("OurAnalyzer")
3920  p.f = EDProducer("MyProducer")
3921  p.g = EDProducer("YourProducer")
3922  p.h = EDProducer("TheirProducer")
3923  p.i = EDProducer("OurProducer")
3924  p.j = EDProducer("OurProducer")
3925  p.k = EDProducer("OurProducer")
3926  p.l = EDProducer("OurProducer")
3927  p.t1 = Task(p.f)
3928  p.t2 = Task(p.g)
3929  p.t3 = Task(p.h)
3930  p.t4 = Task(p.i)
3931  p.ct1 = Task(p.f)
3932  p.ct2 = Task(p.j)
3933  p.ct3 = Task(p.k)
3934  p.ct4 = Task(p.l)
3935  p.s = Sequence(p.d, p.t1, p.ct1)
3936  p.s2 = Sequence(p.b, p.t2, p.ct2)
3937  p.s3 = Sequence(p.e)
3938  p.path1 = Path(p.a, p.t3, p.ct3)
3939  p.path2 = Path(p.b)
3940  p.path3 = Path(p.b+p.s2)
3941  p.path4 = Path(p.b+p.s3)
3942  p.schedule = Schedule(p.path1,p.path2,p.path3)
3943  p.schedule.associate(p.t4)
3944  pths = p.paths
3945  keys = pths.keys()
3946  self.assertEqual(pths[keys[0]],p.path1)
3947  self.assertEqual(pths[keys[1]],p.path2)
3948  p.prune()
3949  self.assertTrue(hasattr(p, 'a'))
3950  self.assertTrue(hasattr(p, 'b'))
3951  self.assertTrue(not hasattr(p, 'c'))
3952  self.assertTrue(not hasattr(p, 'd'))
3953  self.assertTrue(not hasattr(p, 'e'))
3954  self.assertTrue(not hasattr(p, 'f'))
3955  self.assertTrue(hasattr(p, 'g'))
3956  self.assertTrue(hasattr(p, 'h'))
3957  self.assertTrue(hasattr(p, 'i'))
3958  self.assertTrue(hasattr(p, 'j'))
3959  self.assertTrue(hasattr(p, 'k'))
3960  self.assertTrue(not hasattr(p, 'l'))
3961  self.assertTrue(not hasattr(p, 't1'))
3962  self.assertTrue(hasattr(p, 't2'))
3963  self.assertTrue(hasattr(p, 't3'))
3964  self.assertTrue(hasattr(p, 't4'))
3965  self.assertTrue(not hasattr(p, 'ct1'))
3966  self.assertTrue(hasattr(p, 'ct2'))
3967  self.assertTrue(hasattr(p, 'ct3'))
3968  self.assertTrue(not hasattr(p, 'ct4'))
3969  self.assertTrue(not hasattr(p, 's'))
3970  self.assertTrue(hasattr(p, 's2'))
3971  self.assertTrue(not hasattr(p, 's3'))
3972  self.assertTrue(hasattr(p, 'path1'))
3973  self.assertTrue(hasattr(p, 'path2'))
3974  self.assertTrue(hasattr(p, 'path3'))
3975  self.assertTrue(not hasattr(p, 'path4'))
3976  #test SequencePlaceholder
3977  p = Process("test")
3978  p.a = EDAnalyzer("MyAnalyzer")
3979  p.b = EDAnalyzer("YourAnalyzer")
3980  p.s = Sequence(SequencePlaceholder("a")+p.b)
3981  p.pth = Path(p.s)
3982  p.prune()
3983  self.assertTrue(hasattr(p, 'a'))
3984  self.assertTrue(hasattr(p, 'b'))
3985  self.assertTrue(hasattr(p, 's'))
3986  self.assertTrue(hasattr(p, 'pth'))
3987  #test unresolved SequencePlaceholder
3988  p = Process("test")
3989  p.b = EDAnalyzer("YourAnalyzer")
3990  p.s = Sequence(SequencePlaceholder("a")+p.b)
3991  p.pth = Path(p.s)
3992  p.prune(keepUnresolvedSequencePlaceholders=True)
3993  self.assertTrue(hasattr(p, 'b'))
3994  self.assertTrue(hasattr(p, 's'))
3995  self.assertTrue(hasattr(p, 'pth'))
3996  self.assertEqual(p.s.dumpPython(),'cms.Sequence(cms.SequencePlaceholder("a")+process.b)\n')
3997  #test TaskPlaceholder
3998  p = Process("test")
3999  p.a = EDProducer("MyProducer")
4000  p.b = EDProducer("YourProducer")
4001  p.s = Task(TaskPlaceholder("a"),p.b)
4002  p.pth = Path(p.s)
4003  p.prune()
4004  self.assertTrue(hasattr(p, 'a'))
4005  self.assertTrue(hasattr(p, 'b'))
4006  self.assertTrue(hasattr(p, 's'))
4007  self.assertTrue(hasattr(p, 'pth'))
4008  #test ConditionalTaskPlaceholder
4009  p = Process("test")
4010  p.a = EDProducer("MyProducer")
4011  p.b = EDProducer("YourProducer")
4012  p.s = ConditionalTask(ConditionalTaskPlaceholder("a"),p.b)
4013  p.pth = Path(p.s)
4014  p.prune()
4015  self.assertTrue(hasattr(p, 'a'))
4016  self.assertTrue(hasattr(p, 'b'))
4017  self.assertTrue(hasattr(p, 's'))
4018  self.assertTrue(hasattr(p, 'pth'))
4019  #test unresolved SequencePlaceholder
4020  p = Process("test")
4021  p.b = EDProducer("YourAnalyzer")
4022  p.s = Task(TaskPlaceholder("a"),p.b)
4023  p.pth = Path(p.s)
4024  p.prune(keepUnresolvedSequencePlaceholders=True)
4025  self.assertTrue(hasattr(p, 'b'))
4026  self.assertTrue(hasattr(p, 's'))
4027  self.assertTrue(hasattr(p, 'pth'))
4028  self.assertEqual(p.s.dumpPython(),'cms.Task(cms.TaskPlaceholder("a"), process.b)\n')
Definition: PSet.py:1

◆ testRefToPSet()

def Config.TestModuleCommand.testRefToPSet (   self)

Definition at line 3742 of file Config.py.

3742  def testRefToPSet(self):
3743  proc = Process("test")
3744  proc.top = PSet(a = int32(1))
3745  proc.ref = PSet(refToPSet_ = string("top"))
3746  proc.ref2 = PSet( a = int32(1), b = PSet( refToPSet_ = string("top")))
3747  proc.ref3 = PSet(refToPSet_ = string("ref"))
3748  proc.ref4 = VPSet(PSet(refToPSet_ = string("top")),
3749  PSet(refToPSet_ = string("ref2")))
3750  p = TestMakePSet()
3751  proc.fillProcessDesc(p)
3752  self.assertEqual((True,1),p.values["ref"][1].values["a"])
3753  self.assertEqual((True,1),p.values["ref3"][1].values["a"])
3754  self.assertEqual((True,1),p.values["ref2"][1].values["a"])
3755  self.assertEqual((True,1),p.values["ref2"][1].values["b"][1].values["a"])
3756  self.assertEqual((True,1),p.values["ref4"][1][0].values["a"])
3757  self.assertEqual((True,1),p.values["ref4"][1][1].values["a"])
Definition: PSet.py:1

◆ testSchedule()

def Config.TestModuleCommand.testSchedule (   self)

Definition at line 3455 of file Config.py.

3455  def testSchedule(self):
3456  p = Process("test")
3457  p.a = EDAnalyzer("MyAnalyzer")
3458  p.b = EDAnalyzer("YourAnalyzer")
3459  p.c = EDAnalyzer("OurAnalyzer")
3460  p.d = EDAnalyzer("OurAnalyzer")
3461  p.path1 = Path(p.a)
3462  p.path2 = Path(p.b)
3463  p.path3 = Path(p.d)
3464 
3465  s = Schedule(p.path1,p.path2)
3466  self.assertEqual(s[0],p.path1)
3467  self.assertEqual(s[1],p.path2)
3468  p.schedule = s
3469  self.assertTrue('b' in p.schedule.moduleNames())
3470  self.assertTrue(hasattr(p, 'b'))
3471  self.assertTrue(hasattr(p, 'c'))
3472  self.assertTrue(hasattr(p, 'd'))
3473  self.assertTrue(hasattr(p, 'path1'))
3474  self.assertTrue(hasattr(p, 'path2'))
3475  self.assertTrue(hasattr(p, 'path3'))
3476  p.prune()
3477  self.assertTrue('b' in p.schedule.moduleNames())
3478  self.assertTrue(hasattr(p, 'b'))
3479  self.assertTrue(not hasattr(p, 'c'))
3480  self.assertTrue(not hasattr(p, 'd'))
3481  self.assertTrue(hasattr(p, 'path1'))
3482  self.assertTrue(hasattr(p, 'path2'))
3483  self.assertTrue(not hasattr(p, 'path3'))
3484 
3485  self.assertTrue(len(p.schedule._tasks) == 0)
3486 
3487  p = Process("test")
3488  p.a = EDAnalyzer("MyAnalyzer")
3489  p.b = EDAnalyzer("YourAnalyzer")
3490  p.c = EDAnalyzer("OurAnalyzer")
3491  p.d = EDAnalyzer("dAnalyzer")
3492  p.e = EDProducer("eProducer")
3493  p.f = EDProducer("fProducer")
3494  p.Tracer = Service("Tracer")
3495  p.path1 = Path(p.a)
3496  p.path2 = Path(p.b)
3497  p.path3 = Path(p.d)
3498  p.task1 = Task(p.e)
3499  p.task2 = Task(p.f, p.Tracer)
3500  s = Schedule(p.path1,p.path2,tasks=[p.task1,p.task2,p.task1])
3501  self.assertEqual(s[0],p.path1)
3502  self.assertEqual(s[1],p.path2)
3503  self.assertTrue(len(s._tasks) == 2)
3504  self.assertTrue(p.task1 in s._tasks)
3505  self.assertTrue(p.task2 in s._tasks)
3506  listOfTasks = list(s._tasks)
3507  self.assertTrue(len(listOfTasks) == 2)
3508  self.assertTrue(p.task1 == listOfTasks[0])
3509  self.assertTrue(p.task2 == listOfTasks[1])
3510  p.schedule = s
3511  self.assertTrue('b' in p.schedule.moduleNames())
3512 
3513  process2 = Process("test")
3514  process2.a = EDAnalyzer("MyAnalyzer")
3515  process2.e = EDProducer("eProducer")
3516  process2.path1 = Path(process2.a)
3517  process2.task1 = Task(process2.e)
3518  process2.schedule = Schedule(process2.path1,tasks=process2.task1)
3519  listOfTasks = list(process2.schedule._tasks)
3520  self.assertTrue(listOfTasks[0] == process2.task1)
3521 
3522  # test Schedule copy
3523  s2 = s.copy()
3524  self.assertEqual(s2[0],p.path1)
3525  self.assertEqual(s2[1],p.path2)
3526  self.assertTrue(len(s2._tasks) == 2)
3527  self.assertTrue(p.task1 in s2._tasks)
3528  self.assertTrue(p.task2 in s2._tasks)
3529  listOfTasks = list(s2._tasks)
3530  self.assertTrue(len(listOfTasks) == 2)
3531  self.assertTrue(p.task1 == listOfTasks[0])
3532  self.assertTrue(p.task2 == listOfTasks[1])
3533 
3534  names = s.moduleNames()
3535  self.assertTrue(names == set(['a', 'b', 'e', 'Tracer', 'f']))
3536  #adding a path not attached to the Process should cause an exception
3537  p = Process("test")
3538  p.a = EDAnalyzer("MyAnalyzer")
3539  path1 = Path(p.a)
3540  s = Schedule(path1)
3541  self.assertRaises(RuntimeError, lambda : p.setSchedule_(s) )
3542 
3543  #make sure anonymous sequences work
3544  p = Process("test")
3545  p.a = EDAnalyzer("MyAnalyzer")
3546  p.b = EDAnalyzer("MyOtherAnalyzer")
3547  p.c = EDProducer("MyProd")
3548  path1 = Path(p.c*Sequence(p.a+p.b))
3549  s = Schedule(path1)
3550  self.assertTrue('a' in s.moduleNames())
3551  self.assertTrue('b' in s.moduleNames())
3552  self.assertTrue('c' in s.moduleNames())
3553  p.path1 = path1
3554  p.schedule = s
3555  p.prune()
3556  self.assertTrue('a' in s.moduleNames())
3557  self.assertTrue('b' in s.moduleNames())
3558  self.assertTrue('c' in s.moduleNames())
3559 

◆ testSecSource()

def Config.TestModuleCommand.testSecSource (   self)

Definition at line 2762 of file Config.py.

References Config._lineDiff(), and ConfigBuilder.dumpPython().

2762  def testSecSource(self):
2763  p = Process('test')
2764  p.a = SecSource("MySecSource")
2765  self.assertEqual(_lineDiff(p.dumpPython(),Process('test').dumpPython()),'process.a = cms.SecSource("MySecSource")')
2766 
def _lineDiff(newString, oldString)
Definition: Config.py:2094
def dumpPython(process, name)

◆ testSequence()

def Config.TestModuleCommand.testSequence (   self)

Definition at line 2838 of file Config.py.

References str.

2838  def testSequence(self):
2839  p = Process('test')
2840  p.a = EDAnalyzer("MyAnalyzer")
2841  p.b = EDAnalyzer("YourAnalyzer")
2842  p.c = EDAnalyzer("OurAnalyzer")
2843  p.s = Sequence(p.a*p.b)
2844  self.assertEqual(str(p.s),'a+b')
2845  self.assertEqual(p.s.label_(),'s')
2846  path = Path(p.c+p.s)
2847  self.assertEqual(str(path),'c+a+b')
2848  p._validateSequence(path, 'p1')
2849  notInProcess = EDAnalyzer('NotInProcess')
2850  p2 = Path(p.c+p.s*notInProcess)
2851  self.assertRaises(RuntimeError, p._validateSequence, p2, 'p2')
2852 
#define str(s)

◆ testSequence2()

def Config.TestModuleCommand.testSequence2 (   self)

Definition at line 2853 of file Config.py.

2853  def testSequence2(self):
2854  p = Process('test')
2855  p.a = EDAnalyzer("MyAnalyzer")
2856  p.b = EDAnalyzer("YourAnalyzer")
2857  p.c = EDAnalyzer("OurAnalyzer")
2858  testseq = Sequence(p.a*p.b)
2859  p.s = testseq
2860  #p.y = testseq
2861  self.assertRaises(ValueError, p.__setattr__, "y", testseq)
2862 

◆ testServiceInProcess()

def Config.TestModuleCommand.testServiceInProcess (   self)

Definition at line 2863 of file Config.py.

2863  def testServiceInProcess(self):
2864  service = Service("d")
2865  self.assertFalse(service._inProcess)
2866  process = Process("test")
2867  process.d = service
2868  self.assertTrue(service._inProcess)
2869  service2 = Service("d")
2870  process.d = service2
2871  self.assertFalse(service._inProcess)
2872  self.assertTrue(service2._inProcess)
2873  del process.d
2874  self.assertFalse(service2._inProcess)
2875 

◆ testSubProcess()

def Config.TestModuleCommand.testSubProcess (   self)

Definition at line 3707 of file Config.py.

References Config._lineDiff(), ConfigBuilder.dumpPython(), cond.hash, submitPVValidationJobs.split(), and str.

3707  def testSubProcess(self):
3708  process = Process("Parent")
3709  subProcess = Process("Child")
3710  subProcess.a = EDProducer("A")
3711  subProcess.p = Path(subProcess.a)
3712  subProcess.add_(Service("Foo"))
3713  process.addSubProcess(SubProcess(subProcess))
3714  d = process.dumpPython()
3715  equalD ="""parentProcess = process
3716 process.a = cms.EDProducer("A")
3717 process.Foo = cms.Service("Foo")
3718 process.p = cms.Path(process.a)
3719 childProcess = process
3720 process = parentProcess
3721 process.addSubProcess(cms.SubProcess(process = childProcess, SelectEvents = cms.untracked.PSet(
3722 ), outputCommands = cms.untracked.vstring()))"""
3723  equalD = equalD.replace("parentProcess","parentProcess"+str(hash(process.subProcesses_()[0])))
3724  # SubProcesses are dumped before Services, so in order to
3725  # craft the dump of the Parent and Child manually the dump
3726  # of the Parent needs to be split at the MessageLogger
3727  # boundary (now when it is part of Process by default),
3728  # and insert the dump of the Child between the top part of
3729  # the Parent (before MessageLogger) and the bottom part of
3730  # the Parent (after and including MessageLogger)
3731  messageLoggerSplit = 'process.MessageLogger = cms.Service'
3732  parentDumpSplit = Process('Parent').dumpPython().split(messageLoggerSplit)
3733  childProcess = Process('Child')
3734  del childProcess.MessageLogger
3735  combinedDump = parentDumpSplit[0] + childProcess.dumpPython() + messageLoggerSplit + parentDumpSplit[1]
3736  self.assertEqual(_lineDiff(d, combinedDump), equalD)
3737  p = TestMakePSet()
3738  process.fillProcessDesc(p)
3739  self.assertEqual((True,['a']),p.values["subProcesses"][1][0].values["process"][1].values['@all_modules'])
3740  self.assertEqual((True,['p']),p.values["subProcesses"][1][0].values["process"][1].values['@paths'])
3741  self.assertEqual({'@service_type':(True,'Foo')}, p.values["subProcesses"][1][0].values["process"][1].values["services"][1][0].values)
def _lineDiff(newString, oldString)
Definition: Config.py:2094
def dumpPython(process, name)
#define str(s)

◆ testSwitchProducer()

def Config.TestModuleCommand.testSwitchProducer (   self)

Definition at line 3758 of file Config.py.

References jetUpdater_cfi.sort.

3758  def testSwitchProducer(self):
3759  proc = Process("test")
3760  proc.sp = SwitchProducerTest(test2 = EDProducer("Foo",
3761  a = int32(1),
3762  b = PSet(c = int32(2))),
3763  test1 = EDProducer("Bar",
3764  aa = int32(11),
3765  bb = PSet(cc = int32(12))))
3766  self.assertEqual(proc.sp.label_(), "sp")
3767  self.assertEqual(proc.sp.test1.label_(), "sp@test1")
3768  self.assertEqual(proc.sp.test2.label_(), "sp@test2")
3769 
3770  proc.a = EDProducer("A")
3771  proc.s = Sequence(proc.a + proc.sp)
3772  proc.t = Task(proc.a, proc.sp)
3773  proc.p = Path()
3774  proc.p.associate(proc.t)
3775  p = TestMakePSet()
3776  proc.fillProcessDesc(p)
3777  self.assertEqual((True,"EDProducer"), p.values["sp"][1].values["@module_edm_type"])
3778  self.assertEqual((True, "SwitchProducer"), p.values["sp"][1].values["@module_type"])
3779  self.assertEqual((True, "sp"), p.values["sp"][1].values["@module_label"])
3780  all_cases = copy.deepcopy(p.values["sp"][1].values["@all_cases"])
3781  all_cases[1].sort() # names of all cases come via dict, i.e. their order is undefined
3782  self.assertEqual((True, ["sp@test1", "sp@test2"]), all_cases)
3783  self.assertEqual((False, "sp@test2"), p.values["sp"][1].values["@chosen_case"])
3784  self.assertEqual(["a", "sp", "sp@test1", "sp@test2"], p.values["@all_modules"][1])
3785  self.assertEqual((True,"EDProducer"), p.values["sp@test1"][1].values["@module_edm_type"])
3786  self.assertEqual((True,"Bar"), p.values["sp@test1"][1].values["@module_type"])
3787  self.assertEqual((True,"EDProducer"), p.values["sp@test2"][1].values["@module_edm_type"])
3788  self.assertEqual((True,"Foo"), p.values["sp@test2"][1].values["@module_type"])
3789  dump = proc.dumpPython()
3790  self.assertEqual(dump.find('@'), -1)
3791  self.assertEqual(specialImportRegistry.getSpecialImports(), ["from test import SwitchProducerTest"])
3792  self.assertTrue(dump.find("\nfrom test import SwitchProducerTest\n") != -1)
3793 
3794  # EDAlias as non-chosen case
3795  proc = Process("test")
3796  proc.sp = SwitchProducerTest(test2 = EDProducer("Foo",
3797  a = int32(1),
3798  b = PSet(c = int32(2))),
3799  test1 = EDAlias(a = VPSet(PSet(type = string("Bar")))))
3800  proc.a = EDProducer("A")
3801  proc.s = Sequence(proc.a + proc.sp)
3802  proc.t = Task(proc.a, proc.sp)
3803  proc.p = Path()
3804  proc.p.associate(proc.t)
3805  p = TestMakePSet()
3806  proc.fillProcessDesc(p)
3807  self.assertEqual((True,"EDProducer"), p.values["sp"][1].values["@module_edm_type"])
3808  self.assertEqual((True, "SwitchProducer"), p.values["sp"][1].values["@module_type"])
3809  self.assertEqual((True, "sp"), p.values["sp"][1].values["@module_label"])
3810  all_cases = copy.deepcopy(p.values["sp"][1].values["@all_cases"])
3811  all_cases[1].sort()
3812  self.assertEqual((True, ["sp@test1", "sp@test2"]), all_cases)
3813  self.assertEqual((False, "sp@test2"), p.values["sp"][1].values["@chosen_case"])
3814  self.assertEqual(["a", "sp", "sp@test2"], p.values["@all_modules"][1])
3815  self.assertEqual(["sp@test1"], p.values["@all_aliases"][1])
3816  self.assertEqual((True,"EDProducer"), p.values["sp@test2"][1].values["@module_edm_type"])
3817  self.assertEqual((True,"Foo"), p.values["sp@test2"][1].values["@module_type"])
3818  self.assertEqual((True,"EDAlias"), p.values["sp@test1"][1].values["@module_edm_type"])
3819  self.assertEqual((True,"Bar"), p.values["sp@test1"][1].values["a"][1][0].values["type"])
3820 
3821  # EDAlias as chosen case
3822  proc = Process("test")
3823  proc.sp = SwitchProducerTest(test1 = EDProducer("Foo",
3824  a = int32(1),
3825  b = PSet(c = int32(2))),
3826  test2 = EDAlias(a = VPSet(PSet(type = string("Bar")))))
3827  proc.a = EDProducer("A")
3828  proc.s = Sequence(proc.a + proc.sp)
3829  proc.t = Task(proc.a, proc.sp)
3830  proc.p = Path()
3831  proc.p.associate(proc.t)
3832  p = TestMakePSet()
3833  proc.fillProcessDesc(p)
3834  self.assertEqual((True,"EDProducer"), p.values["sp"][1].values["@module_edm_type"])
3835  self.assertEqual((True, "SwitchProducer"), p.values["sp"][1].values["@module_type"])
3836  self.assertEqual((True, "sp"), p.values["sp"][1].values["@module_label"])
3837  self.assertEqual((True, ["sp@test1", "sp@test2"]), p.values["sp"][1].values["@all_cases"])
3838  self.assertEqual((False, "sp@test2"), p.values["sp"][1].values["@chosen_case"])
3839  self.assertEqual(["a", "sp", "sp@test1"], p.values["@all_modules"][1])
3840  self.assertEqual(["sp@test2"], p.values["@all_aliases"][1])
3841  self.assertEqual((True,"EDProducer"), p.values["sp@test1"][1].values["@module_edm_type"])
3842  self.assertEqual((True,"Foo"), p.values["sp@test1"][1].values["@module_type"])
3843  self.assertEqual((True,"EDAlias"), p.values["sp@test2"][1].values["@module_edm_type"])
3844  self.assertEqual((True,"Bar"), p.values["sp@test2"][1].values["a"][1][0].values["type"])
3845 
3846  # ConditionalTask
3847  proc = Process("test")
3848  proc.spct = SwitchProducerTest(test2 = EDProducer("Foo",
3849  a = int32(1),
3850  b = PSet(c = int32(2))),
3851  test1 = EDProducer("Bar",
3852  aa = int32(11),
3853  bb = PSet(cc = int32(12))),
3854  test3 = EDAlias(a = VPSet(PSet(type = string("Bar")))))
3855  proc.spp = proc.spct.clone()
3856  proc.a = EDProducer("A")
3857  proc.ct = ConditionalTask(proc.spct)
3858  proc.p = Path(proc.a, proc.ct)
3859  proc.pp = Path(proc.a + proc.spp)
3860  p = TestMakePSet()
3861  proc.fillProcessDesc(p)
3862  self.assertEqual(["a", "spct", "spct@test1", "spct@test2", "spp", "spp@test1", "spp@test2"], p.values["@all_modules"][1])
3863  self.assertEqual(["a", "#", "spct", "spct@test1", "spct@test2", "@"], p.values["p"][1])
3864  self.assertEqual(["a", "spp", "#", "spp@test1", "spp@test2", "@"], p.values["pp"][1])
3865 
Definition: PSet.py:1

◆ testTask()

def Config.TestModuleCommand.testTask (   self)

Definition at line 2876 of file Config.py.

2876  def testTask(self):
2877 
2878  # create some objects to use in tests
2879  edanalyzer = EDAnalyzer("a")
2880  edproducer = EDProducer("b")
2881  edproducer2 = EDProducer("b2")
2882  edproducer3 = EDProducer("b3")
2883  edproducer4 = EDProducer("b4")
2884  edproducer8 = EDProducer("b8")
2885  edproducer9 = EDProducer("b9")
2886  edfilter = EDFilter("c")
2887  service = Service("d")
2888  service3 = Service("d", v = untracked.uint32(3))
2889  essource = ESSource("e")
2890  esproducer = ESProducer("f")
2891  testTask2 = Task()
2892 
2893  # test adding things to Tasks
2894  testTask1 = Task(edproducer, edfilter)
2895  self.assertRaises(RuntimeError, testTask1.add, edanalyzer)
2896  testTask1.add(essource, service)
2897  testTask1.add(essource, esproducer)
2898  testTask1.add(testTask2)
2899  coll = testTask1._collection
2900  self.assertTrue(edproducer in coll)
2901  self.assertTrue(edfilter in coll)
2902  self.assertTrue(service in coll)
2903  self.assertTrue(essource in coll)
2904  self.assertTrue(esproducer in coll)
2905  self.assertTrue(testTask2 in coll)
2906  self.assertTrue(len(coll) == 6)
2907  self.assertTrue(len(testTask2._collection) == 0)
2908 
2909  taskContents = []
2910  for i in testTask1:
2911  taskContents.append(i)
2912  self.assertTrue(taskContents == [edproducer, edfilter, essource, service, esproducer, testTask2])
2913 
2914  # test attaching Task to Process
2915  process = Process("test")
2916 
2917  process.mproducer = edproducer
2918  process.mproducer2 = edproducer2
2919  process.mfilter = edfilter
2920  process.messource = essource
2921  process.mesproducer = esproducer
2922  process.d = service
2923 
2924  testTask3 = Task(edproducer, edproducer2)
2925  testTask1.add(testTask3)
2926  process.myTask1 = testTask1
2927 
2928  # test the validation that occurs when attaching a Task to a Process
2929  # first a case that passes, then one the fails on an EDProducer
2930  # then one that fails on a service
2931  l = set()
2932  visitor = NodeNameVisitor(l)
2933  testTask1.visit(visitor)
2934  self.assertTrue(l == set(['mesproducer', 'mproducer', 'mproducer2', 'mfilter', 'd', 'messource']))
2935  l2 = testTask1.moduleNames
2936  self.assertTrue(l == set(['mesproducer', 'mproducer', 'mproducer2', 'mfilter', 'd', 'messource']))
2937 
2938  testTask4 = Task(edproducer3)
2939  l.clear()
2940  self.assertRaises(RuntimeError, testTask4.visit, visitor)
2941  try:
2942  process.myTask4 = testTask4
2943  self.assertTrue(False)
2944  except RuntimeError:
2945  pass
2946 
2947  testTask5 = Task(service3)
2948  l.clear()
2949  self.assertRaises(RuntimeError, testTask5.visit, visitor)
2950  try:
2951  process.myTask5 = testTask5
2952  self.assertTrue(False)
2953  except RuntimeError:
2954  pass
2955 
2956  process.d = service3
2957  process.myTask5 = testTask5
2958 
2959  # test placement into the Process and the tasks property
2960  expectedDict = { 'myTask1' : testTask1, 'myTask5' : testTask5 }
2961  expectedFixedDict = DictTypes.FixedKeysDict(expectedDict);
2962  self.assertTrue(process.tasks == expectedFixedDict)
2963  self.assertTrue(process.tasks['myTask1'] == testTask1)
2964  self.assertTrue(process.myTask1 == testTask1)
2965 
2966  # test replacing an EDProducer in a Task when calling __settattr__
2967  # for the EDProducer on the Process.
2968  process.mproducer2 = edproducer4
2969  process.d = service
2970  l = list()
2971  visitor1 = ModuleNodeVisitor(l)
2972  testTask1.visit(visitor1)
2973  l.sort(key=lambda mod: mod.__str__())
2974  expectedList = sorted([edproducer,essource,esproducer,service,edfilter,edproducer,edproducer4],key=lambda mod: mod.__str__())
2975  self.assertTrue(expectedList == l)
2976  process.myTask6 = Task()
2977  process.myTask7 = Task()
2978  process.mproducer8 = edproducer8
2979  process.myTask8 = Task(process.mproducer8)
2980  process.myTask6.add(process.myTask7)
2981  process.myTask7.add(process.myTask8)
2982  process.myTask1.add(process.myTask6)
2983  process.myTask8.add(process.myTask5)
2984 
2985  testDict = process._itemsInDependencyOrder(process.tasks)
2986  expectedLabels = ["myTask5", "myTask8", "myTask7", "myTask6", "myTask1"]
2987  expectedTasks = [process.myTask5, process.myTask8, process.myTask7, process.myTask6, process.myTask1]
2988  index = 0
2989  for testLabel, testTask in testDict.items():
2990  self.assertTrue(testLabel == expectedLabels[index])
2991  self.assertTrue(testTask == expectedTasks[index])
2992  index += 1
2993 
2994  pythonDump = testTask1.dumpPython(PrintOptions())
2995 
2996 
2997  expectedPythonDump = 'cms.Task(process.d, process.mesproducer, process.messource, process.mfilter, process.mproducer, process.mproducer2, process.myTask6)\n'
2998  self.assertTrue(pythonDump == expectedPythonDump)
2999 
3000  process.myTask5 = Task()
3001  process.myTask100 = Task()
3002  process.mproducer9 = edproducer9
3003  sequence1 = Sequence(process.mproducer8, process.myTask1, process.myTask5, testTask2, testTask3)
3004  sequence2 = Sequence(process.mproducer8 + process.mproducer9)
3005  process.sequence3 = Sequence((process.mproducer8 + process.mfilter))
3006  sequence4 = Sequence()
3007  process.path1 = Path(process.mproducer+process.mproducer8+sequence1+sequence2+process.sequence3+sequence4)
3008  process.path1.associate(process.myTask1, process.myTask5, testTask2, testTask3)
3009  process.path11 = Path(process.mproducer+process.mproducer8+sequence1+sequence2+process.sequence3+ sequence4,process.myTask1, process.myTask5, testTask2, testTask3, process.myTask100)
3010  process.path2 = Path(process.mproducer)
3011  process.path3 = Path(process.mproducer9+process.mproducer8,testTask2)
3012 
3013  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')
3014 
3015  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')
3016 
3017  # test NodeNameVisitor and moduleNames
3018  l = set()
3019  nameVisitor = NodeNameVisitor(l)
3020  process.path1.visit(nameVisitor)
3021  self.assertTrue(l == set(['mproducer', 'd', 'mesproducer', None, 'mproducer9', 'mproducer8', 'messource', 'mproducer2', 'mfilter']))
3022  self.assertTrue(process.path1.moduleNames() == set(['mproducer', 'd', 'mesproducer', None, 'mproducer9', 'mproducer8', 'messource', 'mproducer2', 'mfilter']))
3023 
3024  # test copy
3025  process.mproducer10 = EDProducer("b10")
3026  process.path21 = process.path11.copy()
3027  process.path21.replace(process.mproducer, process.mproducer10)
3028 
3029  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')
3030 
3031  # Some peculiarities of the way things work show up here. dumpPython sorts tasks and
3032  # removes duplication at the level of strings. The Task and Sequence objects themselves
3033  # remove duplicate tasks in their contents if the instances are the same (exact same python
3034  # object id which is not the same as the string representation being the same).
3035  # Also note that the mutating visitor replaces sequences and tasks that have
3036  # modified contents with their modified contents, it does not modify the sequence
3037  # or task itself.
3038  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')
3039 
3040  process.path22 = process.path21.copyAndExclude([process.d, process.mesproducer, process.mfilter])
3041  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')
3042 
3043  process.path23 = process.path22.copyAndExclude([process.messource, process.mproducer10])
3044  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')
3045 
3046  process.a = EDAnalyzer("MyAnalyzer")
3047  process.b = OutputModule("MyOutputModule")
3048  process.c = EDFilter("MyFilter")
3049  process.d = EDProducer("MyProducer")
3050  process.e = ESProducer("MyESProducer")
3051  process.f = ESSource("MyESSource")
3052  process.g = ESProducer("g")
3053  process.path24 = Path(process.a+process.b+process.c+process.d)
3054  process.path25 = process.path24.copyAndExclude([process.a,process.b,process.c])
3055  self.assertTrue(process.path25.dumpPython() == 'cms.Path(process.d)\n')
3056  #print process.path3
3057  #print process.dumpPython()
3058 
3059  process.path200 = EndPath(Sequence(process.c,Task(process.e)))
3060  process.path200.replace(process.c,process.b)
3061  process.path200.replace(process.e,process.f)
3062  self.assertEqual(process.path200.dumpPython(), "cms.EndPath(process.b, cms.Task(process.f))\n")
3063  process.path200.replace(process.b,process.c)
3064  process.path200.replace(process.f,process.e)
3065  self.assertEqual(process.path200.dumpPython(), "cms.EndPath(process.c, cms.Task(process.e))\n")
3066  process.path200.replace(process.c,process.a)
3067  process.path200.replace(process.e,process.g)
3068  self.assertEqual(process.path200.dumpPython(), "cms.EndPath(process.a, cms.Task(process.g))\n")
3069  process.path200.replace(process.a,process.c)
3070  process.path200.replace(process.g,process.e)
3071  self.assertEqual(process.path200.dumpPython(), "cms.EndPath(process.c, cms.Task(process.e))\n")
3072 

◆ testTaskPlaceholder()

def Config.TestModuleCommand.testTaskPlaceholder (   self)

Definition at line 4029 of file Config.py.

References Config._lineDiff(), and ConfigBuilder.dumpPython().

4029  def testTaskPlaceholder(self):
4030  p = Process("test")
4031  p.a = EDProducer("ma")
4032  p.b = EDAnalyzer("mb")
4033  p.t1 = Task(TaskPlaceholder("c"))
4034  p.t2 = Task(p.a, TaskPlaceholder("d"), p.t1)
4035  p.t3 = Task(TaskPlaceholder("e"))
4036  p.path1 = Path(p.b, p.t2, p.t3)
4037  p.t5 = Task(p.a, TaskPlaceholder("g"), TaskPlaceholder("t4"))
4038  p.t4 = Task(TaskPlaceholder("f"))
4039  p.endpath1 = EndPath(p.b, p.t5)
4040  p.t6 = Task(TaskPlaceholder("h"))
4041  p.t7 = Task(p.a, TaskPlaceholder("i"), p.t6)
4042  p.t8 = Task(TaskPlaceholder("j"))
4043  p.schedule = Schedule(p.path1, p.endpath1,tasks=[p.t7,p.t8])
4044  p.c = EDProducer("mc")
4045  p.d = EDProducer("md")
4046  p.e = EDProducer("me")
4047  p.f = EDProducer("mf")
4048  p.g = EDProducer("mg")
4049  p.h = EDProducer("mh")
4050  p.i = EDProducer("mi")
4051  p.j = EDProducer("mj")
4052  self.assertEqual(_lineDiff(p.dumpPython(),Process('test').dumpPython()),
4053 """process.a = cms.EDProducer("ma")
4054 process.c = cms.EDProducer("mc")
4055 process.d = cms.EDProducer("md")
4056 process.e = cms.EDProducer("me")
4057 process.f = cms.EDProducer("mf")
4058 process.g = cms.EDProducer("mg")
4059 process.h = cms.EDProducer("mh")
4060 process.i = cms.EDProducer("mi")
4061 process.j = cms.EDProducer("mj")
4062 process.b = cms.EDAnalyzer("mb")
4063 process.t1 = cms.Task(cms.TaskPlaceholder("c"))
4064 process.t2 = cms.Task(cms.TaskPlaceholder("d"), process.a, process.t1)
4065 process.t3 = cms.Task(cms.TaskPlaceholder("e"))
4066 process.t5 = cms.Task(cms.TaskPlaceholder("g"), cms.TaskPlaceholder("t4"), process.a)
4067 process.t4 = cms.Task(cms.TaskPlaceholder("f"))
4068 process.t6 = cms.Task(cms.TaskPlaceholder("h"))
4069 process.t7 = cms.Task(cms.TaskPlaceholder("i"), process.a, process.t6)
4070 process.t8 = cms.Task(cms.TaskPlaceholder("j"))
4071 process.path1 = cms.Path(process.b, process.t2, process.t3)
4072 process.endpath1 = cms.EndPath(process.b, process.t5)
4073 process.schedule = cms.Schedule(*[ process.path1, process.endpath1 ], tasks=[process.t7, process.t8])""")
4074  p.resolve()
4075  self.assertEqual(_lineDiff(p.dumpPython(),Process('test').dumpPython()),
4076 """process.a = cms.EDProducer("ma")
4077 process.c = cms.EDProducer("mc")
4078 process.d = cms.EDProducer("md")
4079 process.e = cms.EDProducer("me")
4080 process.f = cms.EDProducer("mf")
4081 process.g = cms.EDProducer("mg")
4082 process.h = cms.EDProducer("mh")
4083 process.i = cms.EDProducer("mi")
4084 process.j = cms.EDProducer("mj")
4085 process.b = cms.EDAnalyzer("mb")
4086 process.t1 = cms.Task(process.c)
4087 process.t2 = cms.Task(process.a, process.d, process.t1)
4088 process.t3 = cms.Task(process.e)
4089 process.t4 = cms.Task(process.f)
4090 process.t6 = cms.Task(process.h)
4091 process.t7 = cms.Task(process.a, process.i, process.t6)
4092 process.t8 = cms.Task(process.j)
4093 process.t5 = cms.Task(process.a, process.g, process.t4)
4094 process.path1 = cms.Path(process.b, process.t2, process.t3)
4095 process.endpath1 = cms.EndPath(process.b, process.t5)
4096 process.schedule = cms.Schedule(*[ process.path1, process.endpath1 ], tasks=[process.t7, process.t8])""")
def _lineDiff(newString, oldString)
Definition: Config.py:2094
def dumpPython(process, name)

◆ testTypedParameterizable()

def Config.TestModuleCommand.testTypedParameterizable (   self)

Definition at line 2321 of file Config.py.

2321  def testTypedParameterizable(self):
2322  p = _TypedParameterizable("blah", b=int32(1))
2323  #see if copy works deeply
2324  other = p.copy()
2325  other.b = 2
2326  self.assertNotEqual(p.b,other.b)
2327 

◆ testUsing()

def Config.TestModuleCommand.testUsing (   self)

Definition at line 3593 of file Config.py.

3593  def testUsing(self):
3594  p = Process('test')
3595  p.block = PSet(a = int32(1))
3596  p.modu = EDAnalyzer('Analyzer', p.block, b = int32(2))
3597  self.assertEqual(p.modu.a.value(),1)
3598  self.assertEqual(p.modu.b.value(),2)
3599 
Definition: PSet.py:1

Member Data Documentation

◆ a

Config.TestModuleCommand.a
static

Definition at line 2626 of file Config.py.

◆ b

Config.TestModuleCommand.b
static

Definition at line 2643 of file Config.py.

◆ c

Config.TestModuleCommand.c
static

Definition at line 2644 of file Config.py.

◆ d

Config.TestModuleCommand.d
static

Definition at line 2632 of file Config.py.

◆ e

Config.TestModuleCommand.e
static

Definition at line 2646 of file Config.py.

◆ f

Config.TestModuleCommand.f
static

Definition at line 2647 of file Config.py.

◆ g

Config.TestModuleCommand.g
static

Definition at line 2648 of file Config.py.

◆ maxDiff

Config.TestModuleCommand.maxDiff

Definition at line 4660 of file Config.py.

◆ p

Config.TestModuleCommand.p
static

Definition at line 2625 of file Config.py.

Referenced by Electron.Electron.ptErr().

◆ p2

Config.TestModuleCommand.p2
static

Definition at line 2630 of file Config.py.

◆ proc_mod_

Config.TestModuleCommand.proc_mod_

Definition at line 4323 of file Config.py.

◆ process

Config.TestModuleCommand.process
static

◆ r

Config.TestModuleCommand.r
static

Definition at line 2629 of file Config.py.

◆ s

Config.TestModuleCommand.s
static

Definition at line 2628 of file Config.py.

◆ s1

Config.TestModuleCommand.s1
static

Definition at line 2749 of file Config.py.

◆ s2

Config.TestModuleCommand.s2
static

Definition at line 2739 of file Config.py.

◆ s3

Config.TestModuleCommand.s3
static

Definition at line 2751 of file Config.py.

◆ schedule

Config.TestModuleCommand.schedule
static

Definition at line 2631 of file Config.py.

◆ task1

Config.TestModuleCommand.task1
static

Definition at line 2653 of file Config.py.

◆ task2

Config.TestModuleCommand.task2
static

Definition at line 2651 of file Config.py.

◆ task3

Config.TestModuleCommand.task3
static

Definition at line 2650 of file Config.py.

◆ task4

Config.TestModuleCommand.task4
static

Definition at line 2652 of file Config.py.

◆ task5

Config.TestModuleCommand.task5
static

Definition at line 2649 of file Config.py.

◆ tasks

Config.TestModuleCommand.tasks
static

Definition at line 2659 of file Config.py.