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 3372 of file Config.py.

References l1ctLayer2EG_cff.id, and str.

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

◆ testConditionalTask()

def Config.TestModuleCommand.testConditionalTask (   self)

Definition at line 3074 of file Config.py.

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

◆ testConditionalTaskPlaceholder()

def Config.TestModuleCommand.testConditionalTaskPlaceholder (   self)

Definition at line 4098 of file Config.py.

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

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

◆ testContains()

def Config.TestModuleCommand.testContains (   self)

Definition at line 3388 of file Config.py.

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

◆ testDelete()

def Config.TestModuleCommand.testDelete (   self)

Definition at line 4158 of file Config.py.

References ConfigBuilder.dumpPython().

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

References Types.untracked.

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

◆ testFinalPath()

def Config.TestModuleCommand.testFinalPath (   self)

Definition at line 3313 of file Config.py.

References str.

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

◆ testFreeze()

def Config.TestModuleCommand.testFreeze (   self)

Definition at line 3690 of file Config.py.

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

◆ testGlobalReplace()

def Config.TestModuleCommand.testGlobalReplace (   self)

Definition at line 2768 of file Config.py.

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

◆ testImplicitSchedule()

def Config.TestModuleCommand.testImplicitSchedule (   self)

Definition at line 3561 of file Config.py.

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

◆ testMaxEvents()

def Config.TestModuleCommand.testMaxEvents (   self)

Definition at line 3640 of file Config.py.

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

◆ testModifier()

def Config.TestModuleCommand.testModifier (   self)

Definition at line 4213 of file Config.py.

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

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

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

◆ testOverride()

def Config.TestModuleCommand.testOverride (   self)

Definition at line 3601 of file Config.py.

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

References SequenceTypes.ignore(), and str.

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

◆ testPrefers()

def Config.TestModuleCommand.testPrefers (   self)

Definition at line 3670 of file Config.py.

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

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

◆ testProcessAccelerator()

def Config.TestModuleCommand.testProcessAccelerator (   self)

Definition at line 4647 of file Config.py.

References ALCARECOTkAlBeamHalo_cff.filter, and Config.TestModuleCommand.maxDiff.

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

◆ testProcessDumpPython()

def Config.TestModuleCommand.testProcessDumpPython (   self)

Definition at line 2448 of file Config.py.

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

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

◆ testProcessFragment()

def Config.TestModuleCommand.testProcessFragment (   self)

Definition at line 4616 of file Config.py.

4616  def testProcessFragment(self):
4617  #check defaults are not overwritten
4618  f = ProcessFragment('Fragment')
4619  p = Process('PROCESS')
4620  p.maxEvents.input = 10
4621  p.options.numberOfThreads = 4
4622  p.maxLuminosityBlocks.input = 2
4623  p.extend(f)
4624  self.assertEqual(p.maxEvents.input.value(),10)
4625  self.assertEqual(p.options.numberOfThreads.value(), 4)
4626  self.assertEqual(p.maxLuminosityBlocks.input.value(),2)
4627  #general checks
4628  f = ProcessFragment("Fragment")
4629  f.fltr = EDFilter("Foo")
4630  p = Process('PROCESS')
4631  p.extend(f)
4632  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 3867 of file Config.py.

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

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

◆ testSchedule()

def Config.TestModuleCommand.testSchedule (   self)

Definition at line 3456 of file Config.py.

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

◆ testSecSource()

def Config.TestModuleCommand.testSecSource (   self)

Definition at line 2763 of file Config.py.

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

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

◆ testSequence()

def Config.TestModuleCommand.testSequence (   self)

Definition at line 2839 of file Config.py.

References str.

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

◆ testSequence2()

def Config.TestModuleCommand.testSequence2 (   self)

Definition at line 2854 of file Config.py.

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

◆ testServiceInProcess()

def Config.TestModuleCommand.testServiceInProcess (   self)

Definition at line 2864 of file Config.py.

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

◆ testSubProcess()

def Config.TestModuleCommand.testSubProcess (   self)

Definition at line 3708 of file Config.py.

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

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

References jetUpdater_cfi.sort.

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

◆ testTask()

def Config.TestModuleCommand.testTask (   self)

Definition at line 2877 of file Config.py.

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

◆ testTaskPlaceholder()

def Config.TestModuleCommand.testTaskPlaceholder (   self)

Definition at line 4030 of file Config.py.

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

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

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

Member Data Documentation

◆ a

Config.TestModuleCommand.a
static

Definition at line 2627 of file Config.py.

◆ b

Config.TestModuleCommand.b
static

Definition at line 2644 of file Config.py.

◆ c

Config.TestModuleCommand.c
static

Definition at line 2645 of file Config.py.

◆ d

Config.TestModuleCommand.d
static

Definition at line 2633 of file Config.py.

◆ e

Config.TestModuleCommand.e
static

Definition at line 2647 of file Config.py.

◆ f

Config.TestModuleCommand.f
static

Definition at line 2648 of file Config.py.

◆ g

Config.TestModuleCommand.g
static

Definition at line 2649 of file Config.py.

◆ maxDiff

Config.TestModuleCommand.maxDiff

Definition at line 2449 of file Config.py.

Referenced by Config.TestModuleCommand.testProcessAccelerator().

◆ p

Config.TestModuleCommand.p
static

Definition at line 2626 of file Config.py.

Referenced by Electron.Electron.ptErr().

◆ p2

Config.TestModuleCommand.p2
static

Definition at line 2631 of file Config.py.

◆ proc_mod_

Config.TestModuleCommand.proc_mod_

Definition at line 4324 of file Config.py.

◆ process

Config.TestModuleCommand.process
static

◆ r

Config.TestModuleCommand.r
static

Definition at line 2630 of file Config.py.

◆ s

Config.TestModuleCommand.s
static

Definition at line 2629 of file Config.py.

◆ s1

Config.TestModuleCommand.s1
static

Definition at line 2750 of file Config.py.

◆ s2

Config.TestModuleCommand.s2
static

Definition at line 2740 of file Config.py.

◆ s3

Config.TestModuleCommand.s3
static

Definition at line 2752 of file Config.py.

◆ schedule

Config.TestModuleCommand.schedule
static

Definition at line 2632 of file Config.py.

◆ task1

Config.TestModuleCommand.task1
static

Definition at line 2654 of file Config.py.

◆ task2

Config.TestModuleCommand.task2
static

Definition at line 2652 of file Config.py.

◆ task3

Config.TestModuleCommand.task3
static

Definition at line 2651 of file Config.py.

◆ task4

Config.TestModuleCommand.task4
static

Definition at line 2653 of file Config.py.

◆ task5

Config.TestModuleCommand.task5
static

Definition at line 2650 of file Config.py.

◆ tasks

Config.TestModuleCommand.tasks
static

Definition at line 2660 of file Config.py.