CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 2285 of file Config.py.

Member Function Documentation

◆ setUp()

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

Definition at line 2286 of file Config.py.

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

◆ testCloneSequence()

def Config.TestModuleCommand.testCloneSequence (   self)

Definition at line 3373 of file Config.py.

References l1ctLayer2EG_cff.id, and str.

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

◆ testConditionalTask()

def Config.TestModuleCommand.testConditionalTask (   self)

Definition at line 3075 of file Config.py.

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

◆ testConditionalTaskPlaceholder()

def Config.TestModuleCommand.testConditionalTaskPlaceholder (   self)

Definition at line 4099 of file Config.py.

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

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

◆ testContains()

def Config.TestModuleCommand.testContains (   self)

Definition at line 3389 of file Config.py.

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

◆ testDelete()

def Config.TestModuleCommand.testDelete (   self)

Definition at line 4159 of file Config.py.

References ConfigBuilder.dumpPython().

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

References Types.untracked.

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

◆ testFinalPath()

def Config.TestModuleCommand.testFinalPath (   self)

Definition at line 3314 of file Config.py.

References str.

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

◆ testFreeze()

def Config.TestModuleCommand.testFreeze (   self)

Definition at line 3691 of file Config.py.

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

◆ testGlobalReplace()

def Config.TestModuleCommand.testGlobalReplace (   self)

Definition at line 2769 of file Config.py.

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

◆ testImplicitSchedule()

def Config.TestModuleCommand.testImplicitSchedule (   self)

Definition at line 3562 of file Config.py.

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

◆ testMaxEvents()

def Config.TestModuleCommand.testMaxEvents (   self)

Definition at line 3641 of file Config.py.

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

◆ testModifier()

def Config.TestModuleCommand.testModifier (   self)

Definition at line 4214 of file Config.py.

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

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

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

◆ testOverride()

def Config.TestModuleCommand.testOverride (   self)

Definition at line 3602 of file Config.py.

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

◆ testParameterizable()

def Config.TestModuleCommand.testParameterizable (   self)

Definition at line 2289 of file Config.py.

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

◆ testPath()

def Config.TestModuleCommand.testPath (   self)

Definition at line 3263 of file Config.py.

References SequenceTypes.ignore(), and str.

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

◆ testPrefers()

def Config.TestModuleCommand.testPrefers (   self)

Definition at line 3671 of file Config.py.

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

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

◆ testProcessAccelerator()

def Config.TestModuleCommand.testProcessAccelerator (   self)

Definition at line 4648 of file Config.py.

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

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

◆ testProcessDumpPython()

def Config.TestModuleCommand.testProcessDumpPython (   self)

Definition at line 2449 of file Config.py.

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

◆ testProcessExtend()

def Config.TestModuleCommand.testProcessExtend (   self)

Definition at line 2354 of file Config.py.

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

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

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

◆ testProcessFragment()

def Config.TestModuleCommand.testProcessFragment (   self)

Definition at line 4617 of file Config.py.

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

◆ testProcessInsertion()

def Config.TestModuleCommand.testProcessInsertion (   self)

Definition at line 2329 of file Config.py.

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

◆ testPrune()

def Config.TestModuleCommand.testPrune (   self)

Definition at line 3868 of file Config.py.

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

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

◆ testSchedule()

def Config.TestModuleCommand.testSchedule (   self)

Definition at line 3457 of file Config.py.

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

◆ testSecSource()

def Config.TestModuleCommand.testSecSource (   self)

Definition at line 2764 of file Config.py.

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

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

◆ testSequence()

def Config.TestModuleCommand.testSequence (   self)

Definition at line 2840 of file Config.py.

References str.

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

◆ testSequence2()

def Config.TestModuleCommand.testSequence2 (   self)

Definition at line 2855 of file Config.py.

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

◆ testServiceInProcess()

def Config.TestModuleCommand.testServiceInProcess (   self)

Definition at line 2865 of file Config.py.

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

◆ testSubProcess()

def Config.TestModuleCommand.testSubProcess (   self)

Definition at line 3709 of file Config.py.

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

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

◆ testSwitchProducer()

def Config.TestModuleCommand.testSwitchProducer (   self)

Definition at line 3760 of file Config.py.

References jetUpdater_cfi.sort.

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

◆ testTask()

def Config.TestModuleCommand.testTask (   self)

Definition at line 2878 of file Config.py.

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

◆ testTaskPlaceholder()

def Config.TestModuleCommand.testTaskPlaceholder (   self)

Definition at line 4031 of file Config.py.

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

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

◆ testTypedParameterizable()

def Config.TestModuleCommand.testTypedParameterizable (   self)

Definition at line 2322 of file Config.py.

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

◆ testUsing()

def Config.TestModuleCommand.testUsing (   self)

Definition at line 3595 of file Config.py.

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

Member Data Documentation

◆ a

Config.TestModuleCommand.a
static

Definition at line 2628 of file Config.py.

◆ b

Config.TestModuleCommand.b
static

Definition at line 2645 of file Config.py.

◆ c

Config.TestModuleCommand.c
static

Definition at line 2646 of file Config.py.

◆ d

Config.TestModuleCommand.d
static

Definition at line 2634 of file Config.py.

◆ e

Config.TestModuleCommand.e
static

Definition at line 2648 of file Config.py.

◆ f

Config.TestModuleCommand.f
static

Definition at line 2649 of file Config.py.

◆ g

Config.TestModuleCommand.g
static

Definition at line 2650 of file Config.py.

◆ maxDiff

Config.TestModuleCommand.maxDiff

Definition at line 2450 of file Config.py.

Referenced by Config.TestModuleCommand.testProcessAccelerator().

◆ p

Config.TestModuleCommand.p
static

Definition at line 2627 of file Config.py.

Referenced by Electron.Electron.ptErr().

◆ p2

Config.TestModuleCommand.p2
static

Definition at line 2632 of file Config.py.

◆ proc_mod_

Config.TestModuleCommand.proc_mod_

Definition at line 4325 of file Config.py.

◆ process

Config.TestModuleCommand.process
static

◆ r

Config.TestModuleCommand.r
static

Definition at line 2631 of file Config.py.

◆ s

Config.TestModuleCommand.s
static

Definition at line 2630 of file Config.py.

◆ s1

Config.TestModuleCommand.s1
static

Definition at line 2751 of file Config.py.

◆ s2

Config.TestModuleCommand.s2
static

Definition at line 2741 of file Config.py.

◆ s3

Config.TestModuleCommand.s3
static

Definition at line 2753 of file Config.py.

◆ schedule

Config.TestModuleCommand.schedule
static

Definition at line 2633 of file Config.py.

◆ task1

Config.TestModuleCommand.task1
static

Definition at line 2655 of file Config.py.

◆ task2

Config.TestModuleCommand.task2
static

Definition at line 2653 of file Config.py.

◆ task3

Config.TestModuleCommand.task3
static

Definition at line 2652 of file Config.py.

◆ task4

Config.TestModuleCommand.task4
static

Definition at line 2654 of file Config.py.

◆ task5

Config.TestModuleCommand.task5
static

Definition at line 2651 of file Config.py.

◆ tasks

Config.TestModuleCommand.tasks
static

Definition at line 2661 of file Config.py.