CMS 3D CMS Logo

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

Public Member Functions

def setUp (self)
 
def testCloneSequence (self)
 
def testContains (self)
 
def testDelete (self)
 
def testExamples (self)
 
def testFreeze (self)
 
def testGlobalReplace (self)
 
def testImplicitSchedule (self)
 
def testModifier (self)
 
def testOverride (self)
 
def testParameterizable (self)
 
def testPath (self)
 
def testPrefers (self)
 
def testProcessDumpPython (self)
 
def testProcessExtend (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

 a
 
 proc_mod_
 

Detailed Description

Definition at line 1603 of file Config.py.

Member Function Documentation

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

Definition at line 1604 of file Config.py.

1604  def setUp(self):
1605  """Nothing to do """
1606  None
def Config.TestModuleCommand.testCloneSequence (   self)

Definition at line 2324 of file Config.py.

References triggerObjects_cff.id, and str.

2325  p = Process("test")
2326  a = EDAnalyzer("MyAnalyzer")
2327  p.a = a
2328  a.setLabel("a")
2329  b = EDAnalyzer("YOurAnalyzer")
2330  p.b = b
2331  b.setLabel("b")
2332  path = Path(a * b)
2333  p.path = Path(p.a*p.b)
2334  lookuptable = {id(a): p.a, id(b): p.b}
2335  #self.assertEqual(str(path),str(path._postProcessFixup(lookuptable)))
2336  #lookuptable = p._cloneToObjectDict
2337  #self.assertEqual(str(path),str(path._postProcessFixup(lookuptable)))
2338  self.assertEqual(str(path),str(p.path))
2339 
def testCloneSequence(self)
Definition: Config.py:2324
#define str(s)
def Config.TestModuleCommand.testContains (   self)

Definition at line 2340 of file Config.py.

2340  def testContains(self):
2341 
2342  a = EDProducer("a")
2343  b = EDProducer("b")
2344  c = EDProducer("c")
2345  d = EDProducer("d")
2346  e = EDProducer("e")
2347  f = EDProducer("f")
2348  g = EDProducer("g")
2349  h = EDProducer("h")
2350  i = EDProducer("i")
2351  j = EDProducer("j")
2352  k = EDProducer("k")
2353  l = EDProducer("l")
2354  m = EDProducer("m")
2355  n = EDProducer("n")
2356 
2357  seq1 = Sequence(e)
2358  task1 = Task(g)
2359  path = Path(a * c * seq1, task1)
2360 
2361  self.assertTrue(path.contains(a))
2362  self.assertFalse(path.contains(b))
2363  self.assertTrue(path.contains(c))
2364  self.assertFalse(path.contains(d))
2365  self.assertTrue(path.contains(e))
2366  self.assertFalse(path.contains(f))
2367  self.assertTrue(path.contains(g))
2368 
2369  endpath = EndPath(h * i)
2370  self.assertFalse(endpath.contains(b))
2371  self.assertTrue(endpath.contains(i))
2372 
2373  seq = Sequence(a * c)
2374  self.assertFalse(seq.contains(b))
2375  self.assertTrue(seq.contains(c))
2376 
2377  task2 = Task(l)
2378  task = Task(j, k, task2)
2379  self.assertFalse(task.contains(b))
2380  self.assertTrue(task.contains(j))
2381  self.assertTrue(task.contains(k))
2382  self.assertTrue(task.contains(l))
2383 
2384  task3 = Task(m)
2385  path2 = Path(n)
2386  sch = Schedule(path, path2, tasks=[task,task3])
2387  self.assertFalse(sch.contains(b))
2388  self.assertTrue(sch.contains(a))
2389  self.assertTrue(sch.contains(c))
2390  self.assertTrue(sch.contains(e))
2391  self.assertTrue(sch.contains(g))
2392  self.assertTrue(sch.contains(n))
2393  self.assertTrue(sch.contains(j))
2394  self.assertTrue(sch.contains(k))
2395  self.assertTrue(sch.contains(l))
2396  self.assertTrue(sch.contains(m))
2397 
def testContains(self)
Definition: Config.py:2340
def Config.TestModuleCommand.testDelete (   self)

Definition at line 3028 of file Config.py.

References ConfigBuilder.dumpPython().

3028  def testDelete(self):
3029  p = Process("test")
3030  p.a = EDAnalyzer("MyAnalyzer")
3031  p.b = EDAnalyzer("YourAnalyzer")
3032  p.c = EDAnalyzer("OurAnalyzer")
3033  p.d = EDAnalyzer("OurAnalyzer")
3034  p.e = EDAnalyzer("OurAnalyzer")
3035  p.f = EDAnalyzer("OurAnalyzer")
3036  p.g = EDProducer("OurProducer")
3037  p.h = EDProducer("YourProducer")
3038  p.t1 = Task(p.g, p.h)
3039  t2 = Task(p.g, p.h)
3040  t3 = Task(p.g, p.h)
3041  p.s = Sequence(p.d+p.e)
3042  p.path1 = Path(p.a+p.f+p.s,t2)
3043  p.endpath1 = EndPath(p.b+p.f)
3044  p.schedule = Schedule(tasks=[t3])
3045  self.assertTrue(hasattr(p, 'f'))
3046  self.assertTrue(hasattr(p, 'g'))
3047  del p.e
3048  del p.f
3049  del p.g
3050  self.assertFalse(hasattr(p, 'f'))
3051  self.assertFalse(hasattr(p, 'g'))
3052  self.assertTrue(p.t1.dumpPython(None) == 'cms.Task(process.h)\n')
3053  self.assertTrue(p.s.dumpPython(None) == 'cms.Sequence(process.d)\n')
3054  self.assertTrue(p.path1.dumpPython(None) == 'cms.Path(process.a+process.s, cms.Task(process.h))\n')
3055  self.assertTrue(p.endpath1.dumpPython(None) == 'cms.EndPath(process.b)\n')
3056  del p.s
3057  self.assertTrue(p.path1.dumpPython(None) == 'cms.Path(process.a+(process.d), cms.Task(process.h))\n')
3058  self.assertTrue(p.schedule_().dumpPython(None) == 'cms.Schedule(tasks=[cms.Task(process.h)])\n')
def dumpPython(process, name)
def Config.TestModuleCommand.testExamples (   self)

Definition at line 2566 of file Config.py.

2566  def testExamples(self):
2567  p = Process("Test")
2568  p.source = Source("PoolSource",fileNames = untracked(string("file:reco.root")))
2569  p.foos = EDProducer("FooProducer")
2570  p.bars = EDProducer("BarProducer", foos=InputTag("foos"))
2571  p.out = OutputModule("PoolOutputModule",fileName=untracked(string("file:foos.root")))
2572  p.bars.foos = 'Foosball'
2573  self.assertEqual(p.bars.foos, InputTag('Foosball'))
2574  p.p = Path(p.foos*p.bars)
2575  p.e = EndPath(p.out)
2576  p.add_(Service("MessageLogger"))
2577 
def testExamples(self)
Definition: Config.py:2566
def Config.TestModuleCommand.testFreeze (   self)

Definition at line 2632 of file Config.py.

2632  def testFreeze(self):
2633  process = Process("Freeze")
2634  m = EDProducer("M", p=PSet(i = int32(1)))
2635  m.p.i = 2
2636  process.m = m
2637  # should be frozen
2638  #self.assertRaises(ValueError, setattr, m.p, 'i', 3)
2639  #self.assertRaises(ValueError, setattr, m, 'p', PSet(i=int32(1)))
2640  #self.assertRaises(ValueError, setattr, m.p, 'j', 1)
2641  #self.assertRaises(ValueError, setattr, m, 'j', 1)
2642  # But OK to change through the process
2643  process.m.p.i = 4
2644  self.assertEqual(process.m.p.i.value(), 4)
2645  process.m.p = PSet(j=int32(1))
2646  # should work to clone it, though
2647  m2 = m.clone(p = PSet(i = int32(5)), j = int32(8))
2648  m2.p.i = 6
2649  m2.j = 8
def Config.TestModuleCommand.testGlobalReplace (   self)

Definition at line 2002 of file Config.py.

References list(), and cmsPerfHarvest.visit().

2003  p = Process('test')
2004  p.a = EDAnalyzer("MyAnalyzer")
2005  old = p.a
2006  p.b = EDAnalyzer("YourAnalyzer")
2007  p.c = EDAnalyzer("OurAnalyzer")
2008  p.d = EDProducer("MyProducer")
2009  old2 = p.d
2010  p.t1 = Task(p.d)
2011  t2 = Task(p.d)
2012  t3 = Task(p.d)
2013  t4 = Task(p.d)
2014  t5 = Task(p.d)
2015  t6 = Task(p.d)
2016  s = Sequence(p.a*p.b)
2017  p.s4 = Sequence(p.a*p.b)
2018  s.associate(t2)
2019  p.s4.associate(t2)
2020  p.p = Path(p.c+s+p.a)
2021  p.e3 = EndPath(p.c+s+p.a)
2022  new = EDAnalyzer("NewAnalyzer")
2023  new2 = EDProducer("NewProducer")
2024  visitor1 = NodeVisitor()
2025  p.p.visit(visitor1)
2026  self.assertTrue(visitor1.modules == set([old,old2,p.b,p.c]))
2027  p.schedule = Schedule(tasks=[t6])
2028  p.globalReplace("a",new)
2029  p.globalReplace("d",new2)
2030  visitor2 = NodeVisitor()
2031  p.p.visit(visitor2)
2032  self.assertTrue(visitor2.modules == set([new,new2,p.b,p.c]))
2033  visitor3 = NodeVisitor()
2034  p.e3.visit(visitor3)
2035  self.assertTrue(visitor3.modules == set([new,new2,p.b,p.c]))
2036  visitor4 = NodeVisitor()
2037  p.s4.visit(visitor4)
2038  self.assertTrue(visitor4.modules == set([new,new2,p.b]))
2039  visitor5 = NodeVisitor()
2040  p.t1.visit(visitor5)
2041  self.assertTrue(visitor5.modules == set([new2]))
2042  visitor6 = NodeVisitor()
2043  listOfTasks = list(p.schedule._tasks)
2044  listOfTasks[0].visit(visitor6)
2045  self.assertTrue(visitor6.modules == set([new2]))
2046 
def visit(visitdir)
Retrieve data from a perf suite output (sub) directory, only examines TimeSize at the moment...
def testGlobalReplace(self)
Definition: Config.py:2002
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run
def Config.TestModuleCommand.testImplicitSchedule (   self)

Definition at line 2503 of file Config.py.

2504  p = Process("test")
2505  p.a = EDAnalyzer("MyAnalyzer")
2506  p.b = EDAnalyzer("YourAnalyzer")
2507  p.c = EDAnalyzer("OurAnalyzer")
2508  p.path1 = Path(p.a)
2509  p.path2 = Path(p.b)
2510  self.assert_(p.schedule is None)
2511  pths = p.paths
2512  keys = pths.keys()
2513  self.assertEqual(pths[keys[0]],p.path1)
2514  self.assertEqual(pths[keys[1]],p.path2)
2515  p.prune()
2516  self.assert_(hasattr(p, 'a'))
2517  self.assert_(hasattr(p, 'b'))
2518  self.assert_(not hasattr(p, 'c'))
2519  self.assert_(hasattr(p, 'path1'))
2520  self.assert_(hasattr(p, 'path2'))
2521 
2522 
2523  p = Process("test")
2524  p.a = EDAnalyzer("MyAnalyzer")
2525  p.b = EDAnalyzer("YourAnalyzer")
2526  p.c = EDAnalyzer("OurAnalyzer")
2527  p.path2 = Path(p.b)
2528  p.path1 = Path(p.a)
2529  self.assert_(p.schedule is None)
2530  pths = p.paths
2531  keys = pths.keys()
2532  self.assertEqual(pths[keys[1]],p.path1)
2533  self.assertEqual(pths[keys[0]],p.path2)
2534 
2535 
def testImplicitSchedule(self)
Definition: Config.py:2503
def Config.TestModuleCommand.testModifier (   self)

Definition at line 3059 of file Config.py.

References cmsPerfStripChart.dict, and resolutioncreator_cfi.object.

3059  def testModifier(self):
3060  m1 = Modifier()
3061  p = Process("test",m1)
3062  p.a = EDAnalyzer("MyAnalyzer", fred = int32(1))
3063  def _mod_fred(obj):
3064  obj.fred = 2
3065  m1.toModify(p.a,_mod_fred)
3066  self.assertEqual(p.a.fred.value(),2)
3067  p.b = EDAnalyzer("YourAnalyzer", wilma = int32(1))
3068  m1.toModify(p.b, wilma = 2)
3069  self.assertEqual(p.b.wilma.value(),2)
3070  self.assert_(p.isUsingModifier(m1))
3071  #check that Modifier not attached to a process doesn't run
3072  m1 = Modifier()
3073  p = Process("test")
3074  p.a = EDAnalyzer("MyAnalyzer", fred = int32(1))
3075  m1.toModify(p.a,_mod_fred)
3076  p.b = EDAnalyzer("YourAnalyzer", wilma = int32(1))
3077  m1.toModify(p.b, wilma = 2)
3078  self.assertEqual(p.a.fred.value(),1)
3079  self.assertEqual(p.b.wilma.value(),1)
3080  self.assertEqual(p.isUsingModifier(m1),False)
3081  #make sure clones get the changes
3082  m1 = Modifier()
3083  p = Process("test",m1)
3084  p.a = EDAnalyzer("MyAnalyzer", fred = int32(1), wilma = int32(1))
3085  m1.toModify(p.a, fred = int32(2))
3086  p.b = p.a.clone(wilma = int32(3))
3087  self.assertEqual(p.a.fred.value(),2)
3088  self.assertEqual(p.a.wilma.value(),1)
3089  self.assertEqual(p.b.fred.value(),2)
3090  self.assertEqual(p.b.wilma.value(),3)
3091  #test removal of parameter
3092  m1 = Modifier()
3093  p = Process("test",m1)
3094  p.a = EDAnalyzer("MyAnalyzer", fred = int32(1), wilma = int32(1), fintstones = PSet(fred = int32(1)))
3095  m1.toModify(p.a, fred = None, fintstones = dict(fred = None))
3096  self.assertEqual(hasattr(p.a, "fred"), False)
3097  self.assertEqual(hasattr(p.a.fintstones, "fred"), False)
3098  self.assertEqual(p.a.wilma.value(),1)
3099  #test adding a parameter
3100  m1 = Modifier()
3101  p = Process("test",m1)
3102  p.a = EDAnalyzer("MyAnalyzer", fred = int32(1))
3103  m1.toModify(p.a, wilma = int32(2))
3104  self.assertEqual(p.a.fred.value(), 1)
3105  self.assertEqual(p.a.wilma.value(),2)
3106  #test setting of value in PSet
3107  m1 = Modifier()
3108  p = Process("test",m1)
3109  p.a = EDAnalyzer("MyAnalyzer", flintstones = PSet(fred = int32(1), wilma = int32(1)))
3110  m1.toModify(p.a, flintstones = dict(fred = int32(2)))
3111  self.assertEqual(p.a.flintstones.fred.value(),2)
3112  self.assertEqual(p.a.flintstones.wilma.value(),1)
3113  #test proper exception from nonexisting parameter name
3114  m1 = Modifier()
3115  p = Process("test",m1)
3116  p.a = EDAnalyzer("MyAnalyzer", flintstones = PSet(fred = PSet(wilma = int32(1))))
3117  self.assertRaises(KeyError, lambda: m1.toModify(p.a, flintstones = dict(imnothere = dict(wilma=2))))
3118  self.assertRaises(KeyError, lambda: m1.toModify(p.a, foo = 1))
3119  #test setting a value in a VPSet
3120  m1 = Modifier()
3121  p = Process("test",m1)
3122  p.a = EDAnalyzer("MyAnalyzer", flintstones = VPSet(PSet(fred = int32(1)), PSet(wilma = int32(1))))
3123  m1.toModify(p.a, flintstones = {1:dict(wilma = int32(2))})
3124  self.assertEqual(p.a.flintstones[0].fred.value(),1)
3125  self.assertEqual(p.a.flintstones[1].wilma.value(),2)
3126  #test setting a value in a list of values
3127  m1 = Modifier()
3128  p = Process("test",m1)
3129  p.a = EDAnalyzer("MyAnalyzer", fred = vuint32(1,2,3))
3130  m1.toModify(p.a, fred = {1:7})
3131  self.assertEqual(p.a.fred[0],1)
3132  self.assertEqual(p.a.fred[1],7)
3133  self.assertEqual(p.a.fred[2],3)
3134  #test IndexError setting a value in a list to an item key not in the list
3135  m1 = Modifier()
3136  p = Process("test",m1)
3137  p.a = EDAnalyzer("MyAnalyzer", fred = vuint32(1,2,3))
3138  raised = False
3139  try: m1.toModify(p.a, fred = {5:7})
3140  except IndexError as e: raised = True
3141  self.assertEqual(raised, True)
3142  #test TypeError setting a value in a list using a key that is not an int
3143  m1 = Modifier()
3144  p = Process("test",m1)
3145  p.a = EDAnalyzer("MyAnalyzer", flintstones = VPSet(PSet(fred = int32(1)), PSet(wilma = int32(1))))
3146  raised = False
3147  try: m1.toModify(p.a, flintstones = dict(bogus = int32(37)))
3148  except TypeError as e: raised = True
3149  self.assertEqual(raised, True)
3150  #test that load causes process wide methods to run
3151  def _rem_a(proc):
3152  del proc.a
3153  class ProcModifierMod(object):
3154  def __init__(self,modifier,func):
3155  self.proc_mod_ = modifier.makeProcessModifier(func)
3156  class DummyMod(object):
3157  def __init__(self):
3158  self.a = EDAnalyzer("Dummy")
3159  testMod = DummyMod()
3160  p.extend(testMod)
3161  self.assert_(hasattr(p,"a"))
3162  m1 = Modifier()
3163  p = Process("test",m1)
3164  testProcMod = ProcModifierMod(m1,_rem_a)
3165  p.extend(testMod)
3166  p.extend(testProcMod)
3167  self.assert_(not hasattr(p,"a"))
3168  #test ModifierChain
3169  m1 = Modifier()
3170  mc = ModifierChain(m1)
3171  p = Process("test",mc)
3172  self.assert_(p.isUsingModifier(m1))
3173  self.assert_(p.isUsingModifier(mc))
3174  testMod = DummyMod()
3175  p.b = EDAnalyzer("Dummy2", fred = int32(1))
3176  m1.toModify(p.b, fred = int32(3))
3177  p.extend(testMod)
3178  testProcMod = ProcModifierMod(m1,_rem_a)
3179  p.extend(testProcMod)
3180  self.assert_(not hasattr(p,"a"))
3181  self.assertEqual(p.b.fred.value(),3)
3182  #check cloneAndExclude
3183  m1 = Modifier()
3184  m2 = Modifier()
3185  mc = ModifierChain(m1,m2)
3186  mclone = mc.copyAndExclude([m2])
3187  self.assert_(not mclone._isOrContains(m2))
3188  self.assert_(mclone._isOrContains(m1))
3189  m3 = Modifier()
3190  mc2 = ModifierChain(mc,m3)
3191  mclone = mc2.copyAndExclude([m2])
3192  self.assert_(not mclone._isOrContains(m2))
3193  self.assert_(mclone._isOrContains(m1))
3194  self.assert_(mclone._isOrContains(m3))
3195  #check combining
3196  m1 = Modifier()
3197  m2 = Modifier()
3198  p = Process("test",m1)
3199  p.a = EDAnalyzer("MyAnalyzer", fred = int32(1), wilma = int32(1))
3200  (m1 & m2).toModify(p.a, fred = int32(2))
3201  self.assertRaises(TypeError, lambda: (m1 & m2).toModify(p.a, 1, wilma=2))
3202  self.assertEqual(p.a.fred, 1)
3203  m1 = Modifier()
3204  m2 = Modifier()
3205  p = Process("test",m1,m2)
3206  p.a = EDAnalyzer("MyAnalyzer", fred = int32(1), wilma = int32(1))
3207  (m1 & m2).toModify(p.a, fred = int32(2))
3208  self.assertEqual(p.a.fred, 2)
3209  m1 = Modifier()
3210  m2 = Modifier()
3211  m3 = Modifier()
3212  p = Process("test",m1,m2,m3)
3213  p.a = EDAnalyzer("MyAnalyzer", fred = int32(1), wilma = int32(1))
3214  (m1 & m2 & m3).toModify(p.a, fred = int32(2))
3215  self.assertEqual(p.a.fred, 2)
3216  (m1 & (m2 & m3)).toModify(p.a, fred = int32(3))
3217  self.assertEqual(p.a.fred, 3)
3218  ((m1 & m2) & m3).toModify(p.a, fred = int32(4))
3219  self.assertEqual(p.a.fred, 4)
3220  #check inverse
3221  m1 = Modifier()
3222  m2 = Modifier()
3223  p = Process("test", m1)
3224  p.a = EDAnalyzer("MyAnalyzer", fred = int32(1), wilma = int32(1))
3225  (~m1).toModify(p.a, fred=2)
3226  self.assertEqual(p.a.fred, 1)
3227  (~m2).toModify(p.a, wilma=2)
3228  self.assertEqual(p.a.wilma, 2)
3229  self.assertRaises(TypeError, lambda: (~m1).toModify(p.a, 1, wilma=2))
3230  self.assertRaises(TypeError, lambda: (~m2).toModify(p.a, 1, wilma=2))
3231  # check or
3232  m1 = Modifier()
3233  m2 = Modifier()
3234  m3 = Modifier()
3235  p = Process("test", m1)
3236  p.a = EDAnalyzer("MyAnalyzer", fred = int32(1), wilma = int32(1))
3237  (m1 | m2).toModify(p.a, fred=2)
3238  self.assertEqual(p.a.fred, 2)
3239  (m1 | m2 | m3).toModify(p.a, fred=3)
3240  self.assertEqual(p.a.fred, 3)
3241  (m3 | m2 | m1).toModify(p.a, fred=4)
3242  self.assertEqual(p.a.fred, 4)
3243  ((m1 | m2) | m3).toModify(p.a, fred=5)
3244  self.assertEqual(p.a.fred, 5)
3245  (m1 | (m2 | m3)).toModify(p.a, fred=6)
3246  self.assertEqual(p.a.fred, 6)
3247  (m2 | m3).toModify(p.a, fred=7)
3248  self.assertEqual(p.a.fred, 6)
3249  self.assertRaises(TypeError, lambda: (m1 | m2).toModify(p.a, 1, wilma=2))
3250  self.assertRaises(TypeError, lambda: (m2 | m3).toModify(p.a, 1, wilma=2))
3251  # check combinations
3252  m1 = Modifier()
3253  m2 = Modifier()
3254  m3 = Modifier()
3255  m4 = Modifier()
3256  p = Process("test", m1, m2)
3257  p.a = EDAnalyzer("MyAnalyzer", fred = int32(1), wilma = int32(1))
3258  (m1 & ~m2).toModify(p.a, fred=2)
3259  self.assertEqual(p.a.fred, 1)
3260  (m1 & ~m3).toModify(p.a, fred=2)
3261  self.assertEqual(p.a.fred, 2)
3262  (m1 | ~m2).toModify(p.a, fred=3)
3263  self.assertEqual(p.a.fred, 3)
3264  (~m1 | ~m2).toModify(p.a, fred=4)
3265  self.assertEqual(p.a.fred, 3)
3266  (~m3 & ~m4).toModify(p.a, fred=4)
3267  self.assertEqual(p.a.fred, 4)
3268  ((m1 & m3) | ~m4).toModify(p.a, fred=5)
3269  self.assertEqual(p.a.fred, 5)
3270  #check toReplaceWith
3271  m1 = Modifier()
3272  p = Process("test",m1)
3273  p.a =EDAnalyzer("MyAnalyzer", fred = int32(1))
3274  m1.toReplaceWith(p.a, EDAnalyzer("YourAnalyzer", wilma = int32(3)))
3275  self.assertRaises(TypeError, lambda: m1.toReplaceWith(p.a, EDProducer("YourProducer")))
3276  p.b =EDAnalyzer("BAn")
3277  p.c =EDProducer("c")
3278  p.d =EDProducer("d")
3279  p.tc = Task(p.c)
3280  p.td = Task(p.d)
3281  p.s = Sequence(p.a, p.tc)
3282  m1.toReplaceWith(p.s, Sequence(p.a+p.b, p.td))
3283  self.assertEqual(p.a.wilma.value(),3)
3284  self.assertEqual(p.a.type_(),"YourAnalyzer")
3285  self.assertEqual(hasattr(p,"fred"),False)
3286  self.assertTrue(p.s.dumpPython("") == "cms.Sequence(process.a+process.b, process.td)\n")
3287  p.e =EDProducer("e")
3288  m1.toReplaceWith(p.td, Task(p.e))
3289  self.assertTrue(p.td._collection == OrderedSet([p.e]))
3290  #check toReplaceWith doesn't activate not chosen
3291  m1 = Modifier()
3292  p = Process("test")
3293  p.a =EDAnalyzer("MyAnalyzer", fred = int32(1))
3294  m1.toReplaceWith(p.a, EDAnalyzer("YourAnalyzer", wilma = int32(3)))
3295  self.assertEqual(p.a.type_(),"MyAnalyzer")
3296  #check toReplaceWith and and/not/or combinations
3297  m1 = Modifier()
3298  m2 = Modifier()
3299  m3 = Modifier()
3300  m4 = Modifier()
3301  p = Process("test", m1, m2)
3302  p.a = EDAnalyzer("MyAnalyzer", fred = int32(1), wilma = int32(1))
3303  self.assertRaises(TypeError, lambda: (m1 & m2).toReplaceWith(p.a, EDProducer("YourProducer")))
3304  self.assertRaises(TypeError, lambda: (m3 & m4).toReplaceWith(p.a, EDProducer("YourProducer")))
3305  self.assertRaises(TypeError, lambda: (~m3).toReplaceWith(p.a, EDProducer("YourProducer")))
3306  self.assertRaises(TypeError, lambda: (~m1).toReplaceWith(p.a, EDProducer("YourProducer")))
3307  self.assertRaises(TypeError, lambda: (m1 | m3).toReplaceWith(p.a, EDProducer("YourProducer")))
3308  self.assertRaises(TypeError, lambda: (m3 | m4).toReplaceWith(p.a, EDProducer("YourProducer")))
3309  (m1 & m2).toReplaceWith(p.a, EDAnalyzer("YourAnalyzer1"))
3310  self.assertEqual(p.a.type_(), "YourAnalyzer1")
3311  (m1 & m3).toReplaceWith(p.a, EDAnalyzer("YourAnalyzer2"))
3312  self.assertEqual(p.a.type_(), "YourAnalyzer1")
3313  (~m1).toReplaceWith(p.a, EDAnalyzer("YourAnalyzer2"))
3314  self.assertEqual(p.a.type_(), "YourAnalyzer1")
3315  (~m3).toReplaceWith(p.a, EDAnalyzer("YourAnalyzer2"))
3316  self.assertEqual(p.a.type_(), "YourAnalyzer2")
3317  (m1 | m3).toReplaceWith(p.a, EDAnalyzer("YourAnalyzer3"))
3318  self.assertEqual(p.a.type_(), "YourAnalyzer3")
3319  (m3 | m4).toReplaceWith(p.a, EDAnalyzer("YourAnalyzer4"))
3320  self.assertEqual(p.a.type_(), "YourAnalyzer3")
3321 
3322  # EDAlias
3323  a = EDAlias(foo2 = VPSet(PSet(type = string("Foo2"))))
3324  m = Modifier()
3325  m._setChosen()
3326  # Modify parameters
3327  m.toModify(a, foo2 = {0: dict(type = "Foo3")})
3328  self.assertEqual(a.foo2[0].type, "Foo3")
3329  # Add an alias
3330  m.toModify(a, foo4 = VPSet(PSet(type = string("Foo4"))))
3331  self.assertEqual(a.foo2[0].type, "Foo3")
3332  self.assertEqual(a.foo4[0].type, "Foo4")
3333  # Remove an alias
3334  m.toModify(a, foo2 = None)
3335  self.assertFalse(hasattr(a, "foo2"))
3336  self.assertEqual(a.foo4[0].type, "Foo4")
3337  # Replace (doesn't work out of the box because EDAlias is not _Parameterizable
3338  m.toReplaceWith(a, EDAlias(bar = VPSet(PSet(type = string("Bar")))))
3339  self.assertFalse(hasattr(a, "foo2"))
3340  self.assertFalse(hasattr(a, "foo4"))
3341  self.assertTrue(hasattr(a, "bar"))
3342  self.assertEqual(a.bar[0].type, "Bar")
3343 
3344  # SwitchProducer
3345  sp = SwitchProducerTest(test1 = EDProducer("Foo",
3346  a = int32(1),
3347  b = PSet(c = int32(2))),
3348  test2 = EDProducer("Bar",
3349  aa = int32(11),
3350  bb = PSet(cc = int32(12))))
3351  m = Modifier()
3352  m._setChosen()
3353  # Modify parameters
3354  m.toModify(sp,
3355  test1 = dict(a = 4, b = dict(c = None)),
3356  test2 = dict(aa = 15, bb = dict(cc = 45, dd = string("foo"))))
3357  self.assertEqual(sp.test1.a.value(), 4)
3358  self.assertEqual(sp.test1.b.hasParameter("c"), False)
3359  self.assertEqual(sp.test2.aa.value(), 15)
3360  self.assertEqual(sp.test2.bb.cc.value(), 45)
3361  self.assertEqual(sp.test2.bb.dd.value(), "foo")
3362  # Replace a producer
3363  m.toReplaceWith(sp.test1, EDProducer("Fred", x = int32(42)))
3364  self.assertEqual(sp.test1.type_(), "Fred")
3365  self.assertEqual(sp.test1.x.value(), 42)
3366  self.assertRaises(TypeError, lambda: m.toReplaceWith(sp.test1, EDAnalyzer("Foo")))
3367  # Alternative way (only to be allow same syntax to be used as for adding)
3368  m.toModify(sp, test2 = EDProducer("Xyzzy", x = int32(24)))
3369  self.assertEqual(sp.test2.type_(), "Xyzzy")
3370  self.assertEqual(sp.test2.x.value(), 24)
3371  self.assertRaises(TypeError, lambda: m.toModify(sp, test2 = EDAnalyzer("Foo")))
3372  # Add a producer
3373  m.toModify(sp, test3 = EDProducer("Wilma", y = int32(24)))
3374  self.assertEqual(sp.test3.type_(), "Wilma")
3375  self.assertEqual(sp.test3.y.value(), 24)
3376  self.assertRaises(TypeError, lambda: m.toModify(sp, test4 = EDAnalyzer("Foo")))
3377  # Remove a producer
3378  m.toModify(sp, test2 = None)
3379  self.assertEqual(hasattr(sp, "test2"), False)
3380  # Add an alias
3381  m.toModify(sp, test2 = EDAlias(foo = VPSet(PSet(type = string("int")))))
3382  self.assertTrue(hasattr(sp.test2, "foo"))
3383  # Replace an alias
3384  m.toReplaceWith(sp.test2, EDAlias(bar = VPSet(PSet(type = string("int")))))
3385  self.assertTrue(hasattr(sp.test2, "bar"))
3386  # Alternative way
3387  m.toModify(sp, test2 = EDAlias(xyzzy = VPSet(PSet(type = string("int")))))
3388  self.assertTrue(hasattr(sp.test2, "xyzzy"))
3389  # Replace an alias with EDProducer
3390  self.assertRaises(TypeError, lambda: m.toReplaceWith(sp.test2, EDProducer("Foo")))
3391  m.toModify(sp, test2 = EDProducer("Foo"))
3392 
3393 
3394  unittest.main()
def testModifier(self)
Definition: Config.py:3059
def Config.TestModuleCommand.testOverride (   self)

Definition at line 2543 of file Config.py.

2543  def testOverride(self):
2544  p = Process('test')
2545  a = EDProducer("A", a1=int32(0))
2546  self.assert_(not a.isModified())
2547  a.a1 = 1
2548  self.assert_(a.isModified())
2549  p.a = a
2550  self.assertEqual(p.a.a1.value(), 1)
2551  # try adding an unmodified module.
2552  # should accept it
2553  p.a = EDProducer("A", a1=int32(2))
2554  self.assertEqual(p.a.a1.value(), 2)
2555  # try adding a modified module. Should throw
2556  # no longer, since the same (modified) say, geometry
2557  # could come from more than one cff
2558  b = EDProducer("A", a1=int32(3))
2559  b.a1 = 4
2560  #self.assertRaises(RuntimeError, setattr, *(p,'a',b))
2561  ps1 = PSet(a = int32(1))
2562  ps2 = PSet(a = int32(2))
2563  self.assertRaises(ValueError, EDProducer, 'C', ps1, ps2)
2564  self.assertRaises(ValueError, EDProducer, 'C', ps1, a=int32(3))
2565 
def testOverride(self)
Definition: Config.py:2543
def Config.TestModuleCommand.testParameterizable (   self)

Definition at line 1607 of file Config.py.

1608  p = _Parameterizable()
1609  self.assertEqual(len(p.parameterNames_()),0)
1610  p.a = int32(1)
1611  self.assert_('a' in p.parameterNames_())
1612  self.assertEqual(p.a.value(), 1)
1613  p.a = 10
1614  self.assertEqual(p.a.value(), 10)
1615  p.a = untracked(int32(1))
1616  self.assertEqual(p.a.value(), 1)
1617  self.failIf(p.a.isTracked())
1618  p.a = untracked.int32(1)
1619  self.assertEqual(p.a.value(), 1)
1620  self.failIf(p.a.isTracked())
1621  p = _Parameterizable(foo=int32(10), bar = untracked(double(1.0)))
1622  self.assertEqual(p.foo.value(), 10)
1623  self.assertEqual(p.bar.value(),1.0)
1624  self.failIf(p.bar.isTracked())
1625  self.assertRaises(TypeError,setattr,(p,'c',1))
1626  p = _Parameterizable(a=PSet(foo=int32(10), bar = untracked(double(1.0))))
1627  self.assertEqual(p.a.foo.value(),10)
1628  self.assertEqual(p.a.bar.value(),1.0)
1629  p.b = untracked(PSet(fii = int32(1)))
1630  self.assertEqual(p.b.fii.value(),1)
1631  self.failIf(p.b.isTracked())
1632  #test the fact that values can be shared
1633  v = int32(10)
1634  p=_Parameterizable(a=v)
1635  v.setValue(11)
1636  self.assertEqual(p.a.value(),11)
1637  p.a = 12
1638  self.assertEqual(p.a.value(),12)
1639  self.assertEqual(v.value(),12)
def testParameterizable(self)
Definition: Config.py:1607
def Config.TestModuleCommand.testPath (   self)

Definition at line 2284 of file Config.py.

References SequenceTypes.ignore(), and str.

2284  def testPath(self):
2285  p = Process("test")
2286  p.a = EDAnalyzer("MyAnalyzer")
2287  p.b = EDAnalyzer("YourAnalyzer")
2288  p.c = EDAnalyzer("OurAnalyzer")
2289  path = Path(p.a)
2290  path *= p.b
2291  path += p.c
2292  self.assertEqual(str(path),'a+b+c')
2293  path = Path(p.a*p.b+p.c)
2294  self.assertEqual(str(path),'a+b+c')
2295 # path = Path(p.a)*p.b+p.c #This leads to problems with sequences
2296 # self.assertEqual(str(path),'((a*b)+c)')
2297  path = Path(p.a+ p.b*p.c)
2298  self.assertEqual(str(path),'a+b+c')
2299  path = Path(p.a*(p.b+p.c))
2300  self.assertEqual(str(path),'a+b+c')
2301  path = Path(p.a*(p.b+~p.c))
2302  pathx = Path(p.a*(p.b+ignore(p.c)))
2303  self.assertEqual(str(path),'a+b+~c')
2304  p.es = ESProducer("AnESProducer")
2305  self.assertRaises(TypeError,Path,p.es)
2306 
2307  t = Path()
2308  self.assertTrue(t.dumpPython(PrintOptions()) == 'cms.Path()\n')
2309 
2310  t = Path(p.a)
2311  self.assertTrue(t.dumpPython(PrintOptions()) == 'cms.Path(process.a)\n')
2312 
2313  t = Path(Task())
2314  self.assertTrue(t.dumpPython(PrintOptions()) == 'cms.Path(cms.Task())\n')
2315 
2316  t = Path(p.a, Task())
2317  self.assertTrue(t.dumpPython(PrintOptions()) == 'cms.Path(process.a, cms.Task())\n')
2318 
2319  p.prod = EDProducer("prodName")
2320  p.t1 = Task(p.prod)
2321  t = Path(p.a, p.t1, Task(), p.t1)
2322  self.assertTrue(t.dumpPython(PrintOptions()) == 'cms.Path(process.a, cms.Task(), process.t1)\n')
2323 
def ignore(seq)
#define str(s)
def Config.TestModuleCommand.testPrefers (   self)

Definition at line 2578 of file Config.py.

2578  def testPrefers(self):
2579  p = Process("Test")
2580  p.add_(ESSource("ForceSource"))
2581  p.juicer = ESProducer("JuicerProducer")
2582  p.prefer("ForceSource")
2583  p.prefer("juicer")
2584  self.assertEqual(p.dumpConfig(),
2585 """process Test = {
2586  es_module juicer = JuicerProducer {
2587  }
2588  es_source = ForceSource {
2589  }
2590  es_prefer = ForceSource {
2591  }
2592  es_prefer juicer = JuicerProducer {
2593  }
2594 }
2595 """)
2596  p.prefer("juicer",fooRcd=vstring("Foo"))
2597  self.assertEqual(p.dumpConfig(),
2598 """process Test = {
2599  es_module juicer = JuicerProducer {
2600  }
2601  es_source = ForceSource {
2602  }
2603  es_prefer = ForceSource {
2604  }
2605  es_prefer juicer = JuicerProducer {
2606  vstring fooRcd = {
2607  'Foo'
2608  }
2609 
2610  }
2611 }
2612 """)
2613  self.assertEqual(p.dumpPython(),
2614 """import FWCore.ParameterSet.Config as cms
2615 
2616 process = cms.Process("Test")
2617 
2618 process.juicer = cms.ESProducer("JuicerProducer")
2619 
2620 
2621 process.ForceSource = cms.ESSource("ForceSource")
2622 
2623 
2624 process.prefer("ForceSource")
2625 
2626 process.prefer("juicer",
2627  fooRcd = cms.vstring('Foo')
2628 )
2629 
2630 """)
2631 
def Config.TestModuleCommand.testProcessDumpPython (   self)

Definition at line 1742 of file Config.py.

1743  p = Process("test")
1744  p.a = EDAnalyzer("MyAnalyzer")
1745  p.p = Path(p.a)
1746  p.s = Sequence(p.a)
1747  p.r = Sequence(p.s)
1748  p.p2 = Path(p.s)
1749  p.schedule = Schedule(p.p2,p.p)
1750  d=p.dumpPython()
1751  self.assertEqual(d,
1752 """import FWCore.ParameterSet.Config as cms
1753 
1754 process = cms.Process("test")
1755 
1756 process.a = cms.EDAnalyzer("MyAnalyzer")
1757 
1758 
1759 process.s = cms.Sequence(process.a)
1760 
1761 
1762 process.r = cms.Sequence(process.s)
1763 
1764 
1765 process.p = cms.Path(process.a)
1766 
1767 
1768 process.p2 = cms.Path(process.s)
1769 
1770 
1771 process.schedule = cms.Schedule(*[ process.p2, process.p ])
1772 """)
1773  #Reverse order of 'r' and 's'
1774  p = Process("test")
1775  p.a = EDAnalyzer("MyAnalyzer")
1776  p.p = Path(p.a)
1777  p.r = Sequence(p.a)
1778  p.s = Sequence(p.r)
1779  p.p2 = Path(p.r)
1780  p.schedule = Schedule(p.p2,p.p)
1781  p.b = EDAnalyzer("YourAnalyzer")
1782  d=p.dumpPython()
1783  self.assertEqual(d,
1784 """import FWCore.ParameterSet.Config as cms
1785 
1786 process = cms.Process("test")
1787 
1788 process.a = cms.EDAnalyzer("MyAnalyzer")
1789 
1790 
1791 process.b = cms.EDAnalyzer("YourAnalyzer")
1792 
1793 
1794 process.r = cms.Sequence(process.a)
1795 
1796 
1797 process.s = cms.Sequence(process.r)
1798 
1799 
1800 process.p = cms.Path(process.a)
1801 
1802 
1803 process.p2 = cms.Path(process.r)
1804 
1805 
1806 process.schedule = cms.Schedule(*[ process.p2, process.p ])
1807 """)
def testProcessDumpPython(self)
Definition: Config.py:1742
def Config.TestModuleCommand.testProcessExtend (   self)

Definition at line 1672 of file Config.py.

References resolutioncreator_cfi.object, and str.

1673  class FromArg(object):
1674  def __init__(self,*arg,**args):
1675  for name in six.iterkeys(args):
1676  self.__dict__[name]=args[name]
1677 
1678  a=EDAnalyzer("MyAnalyzer")
1679  t=EDAnalyzer("MyAnalyzer")
1680  t.setLabel("foo")
1681  s1 = Sequence(a)
1682  s2 = Sequence(s1)
1683  s3 = Sequence(s2)
1684  d = FromArg(
1685  a=a,
1686  b=Service("Full"),
1687  c=Path(a),
1688  d=s2,
1689  e=s1,
1690  f=s3,
1691  g=Sequence(s1+s2+s3)
1692  )
1693  p = Process("Test")
1694  p.extend(d)
1695  self.assertEqual(p.a.type_(),"MyAnalyzer")
1696  self.assertEqual(p.a.label_(),"a")
1697  self.assertRaises(AttributeError,getattr,p,'b')
1698  self.assertEqual(p.Full.type_(),"Full")
1699  self.assertEqual(str(p.c),'a')
1700  self.assertEqual(str(p.d),'a')
1701 
1702  z1 = FromArg(
1703  a=a,
1704  b=Service("Full"),
1705  c=Path(a),
1706  d=s2,
1707  e=s1,
1708  f=s3,
1709  s4=s3,
1710  g=Sequence(s1+s2+s3)
1711  )
1712 
1713  p1 = Process("Test")
1714  #p1.extend(z1)
1715  self.assertRaises(ValueError, p1.extend, z1)
1716 
1717  z2 = FromArg(
1718  a=a,
1719  b=Service("Full"),
1720  c=Path(a),
1721  d=s2,
1722  e=s1,
1723  f=s3,
1724  aaa=copy.deepcopy(a),
1725  s4=copy.deepcopy(s3),
1726  g=Sequence(s1+s2+s3),
1727  t=t
1728  )
1729  p2 = Process("Test")
1730  p2.extend(z2)
1731  #self.assertRaises(ValueError, p2.extend, z2)
1732  self.assertEqual(p2.s4.label_(),"s4")
1733  #p2.s4.setLabel("foo")
1734  self.assertRaises(ValueError, p2.s4.setLabel, "foo")
1735  p2.s4.setLabel("s4")
1736  p2.s4.setLabel(None)
1737  p2.s4.setLabel("foo")
1738  p2._Process__setObjectLabel(p2.s4, "foo")
1739  p2._Process__setObjectLabel(p2.s4, None)
1740  p2._Process__setObjectLabel(p2.s4, "bar")
1741 
def testProcessExtend(self)
Definition: Config.py:1672
#define str(s)
def Config.TestModuleCommand.testProcessInsertion (   self)

Definition at line 1647 of file Config.py.

1648  p = Process("test")
1649  p.a = EDAnalyzer("MyAnalyzer")
1650  self.assert_( 'a' in p.analyzers_() )
1651  self.assert_( 'a' in p.analyzers)
1652  p.add_(Service("MessageLogger"))
1653  self.assert_('MessageLogger' in p.services_())
1654  self.assertEqual(p.MessageLogger.type_(), "MessageLogger")
1655  p.Tracer = Service("Tracer")
1656  self.assert_('Tracer' in p.services_())
1657  self.assertRaises(TypeError, setattr, *(p,'b',"this should fail"))
1658  self.assertRaises(TypeError, setattr, *(p,'bad',Service("MessageLogger")))
1659  self.assertRaises(ValueError, setattr, *(p,'bad',Source("PoolSource")))
1660  p.out = OutputModule("Outer")
1661  self.assertEqual(p.out.type_(), 'Outer')
1662  self.assert_( 'out' in p.outputModules_() )
1663 
1664  p.geom = ESSource("GeomProd")
1665  self.assert_('geom' in p.es_sources_())
1666  p.add_(ESSource("ConfigDB"))
1667  self.assert_('ConfigDB' in p.es_sources_())
1668 
1669  p.aliasfoo1 = EDAlias(foo1 = VPSet(PSet(type = string("Foo1"))))
1670  self.assert_('aliasfoo1' in p.aliases_())
1671 
def testProcessInsertion(self)
Definition: Config.py:1647
def Config.TestModuleCommand.testPrune (   self)

Definition at line 2786 of file Config.py.

2786  def testPrune(self):
2787  p = Process("test")
2788  p.a = EDAnalyzer("MyAnalyzer")
2789  p.b = EDAnalyzer("YourAnalyzer")
2790  p.c = EDAnalyzer("OurAnalyzer")
2791  p.d = EDAnalyzer("OurAnalyzer")
2792  p.s = Sequence(p.d)
2793  p.path1 = Path(p.a)
2794  p.path2 = Path(p.b)
2795  self.assert_(p.schedule is None)
2796  pths = p.paths
2797  keys = pths.keys()
2798  self.assertEqual(pths[keys[0]],p.path1)
2799  self.assertEqual(pths[keys[1]],p.path2)
2800  p.pset1 = PSet(parA = string("pset1"))
2801  p.pset2 = untracked.PSet(parA = string("pset2"))
2802  p.vpset1 = VPSet()
2803  p.vpset2 = untracked.VPSet()
2804  p.prune()
2805  self.assert_(hasattr(p, 'a'))
2806  self.assert_(hasattr(p, 'b'))
2807  self.assert_(not hasattr(p, 'c'))
2808  self.assert_(not hasattr(p, 'd'))
2809  self.assert_(not hasattr(p, 's'))
2810  self.assert_(hasattr(p, 'path1'))
2811  self.assert_(hasattr(p, 'path2'))
2812 # self.assert_(not hasattr(p, 'pset1'))
2813 # self.assert_(hasattr(p, 'pset2'))
2814 # self.assert_(not hasattr(p, 'vpset1'))
2815 # self.assert_(not hasattr(p, 'vpset2'))
2816 
2817  p = Process("test")
2818  p.a = EDAnalyzer("MyAnalyzer")
2819  p.b = EDAnalyzer("YourAnalyzer")
2820  p.c = EDAnalyzer("OurAnalyzer")
2821  p.d = EDAnalyzer("OurAnalyzer")
2822  p.e = EDAnalyzer("OurAnalyzer")
2823  p.s = Sequence(p.d)
2824  p.s2 = Sequence(p.b)
2825  p.s3 = Sequence(p.e)
2826  p.path1 = Path(p.a)
2827  p.path2 = Path(p.b)
2828  p.path3 = Path(p.b+p.s2)
2829  p.path4 = Path(p.b+p.s3)
2830  p.schedule = Schedule(p.path1,p.path2,p.path3)
2831  pths = p.paths
2832  keys = pths.keys()
2833  self.assertEqual(pths[keys[0]],p.path1)
2834  self.assertEqual(pths[keys[1]],p.path2)
2835  p.prune()
2836  self.assert_(hasattr(p, 'a'))
2837  self.assert_(hasattr(p, 'b'))
2838  self.assert_(not hasattr(p, 'c'))
2839  self.assert_(not hasattr(p, 'd'))
2840  self.assert_(not hasattr(p, 'e'))
2841  self.assert_(not hasattr(p, 's'))
2842  self.assert_(hasattr(p, 's2'))
2843  self.assert_(not hasattr(p, 's3'))
2844  self.assert_(hasattr(p, 'path1'))
2845  self.assert_(hasattr(p, 'path2'))
2846  self.assert_(hasattr(p, 'path3'))
2847  self.assert_(not hasattr(p, 'path4'))
2848  #test SequencePlaceholder
2849  p = Process("test")
2850  p.a = EDAnalyzer("MyAnalyzer")
2851  p.b = EDAnalyzer("YourAnalyzer")
2852  p.s = Sequence(SequencePlaceholder("a")+p.b)
2853  p.pth = Path(p.s)
2854  p.prune()
2855  self.assert_(hasattr(p, 'a'))
2856  self.assert_(hasattr(p, 'b'))
2857  self.assert_(hasattr(p, 's'))
2858  self.assert_(hasattr(p, 'pth'))
2859  #test unresolved SequencePlaceholder
2860  p = Process("test")
2861  p.b = EDAnalyzer("YourAnalyzer")
2862  p.s = Sequence(SequencePlaceholder("a")+p.b)
2863  p.pth = Path(p.s)
2864  p.prune(keepUnresolvedSequencePlaceholders=True)
2865  self.assert_(hasattr(p, 'b'))
2866  self.assert_(hasattr(p, 's'))
2867  self.assert_(hasattr(p, 'pth'))
2868  self.assertEqual(p.s.dumpPython(''),'cms.Sequence(cms.SequencePlaceholder("a")+process.b)\n')
def Config.TestModuleCommand.testRefToPSet (   self)

Definition at line 2690 of file Config.py.

2690  def testRefToPSet(self):
2691  proc = Process("test")
2692  proc.top = PSet(a = int32(1))
2693  proc.ref = PSet(refToPSet_ = string("top"))
2694  proc.ref2 = PSet( a = int32(1), b = PSet( refToPSet_ = string("top")))
2695  proc.ref3 = PSet(refToPSet_ = string("ref"))
2696  proc.ref4 = VPSet(PSet(refToPSet_ = string("top")),
2697  PSet(refToPSet_ = string("ref2")))
2698  p = TestMakePSet()
2699  proc.fillProcessDesc(p)
2700  self.assertEqual((True,1),p.values["ref"][1].values["a"])
2701  self.assertEqual((True,1),p.values["ref3"][1].values["a"])
2702  self.assertEqual((True,1),p.values["ref2"][1].values["a"])
2703  self.assertEqual((True,1),p.values["ref2"][1].values["b"][1].values["a"])
2704  self.assertEqual((True,1),p.values["ref4"][1][0].values["a"])
2705  self.assertEqual((True,1),p.values["ref4"][1][1].values["a"])
def testRefToPSet(self)
Definition: Config.py:2690
def Config.TestModuleCommand.testSchedule (   self)

Definition at line 2398 of file Config.py.

References list().

2398  def testSchedule(self):
2399  p = Process("test")
2400  p.a = EDAnalyzer("MyAnalyzer")
2401  p.b = EDAnalyzer("YourAnalyzer")
2402  p.c = EDAnalyzer("OurAnalyzer")
2403  p.d = EDAnalyzer("OurAnalyzer")
2404  p.path1 = Path(p.a)
2405  p.path2 = Path(p.b)
2406  p.path3 = Path(p.d)
2407 
2408  s = Schedule(p.path1,p.path2)
2409  self.assertEqual(s[0],p.path1)
2410  self.assertEqual(s[1],p.path2)
2411  p.schedule = s
2412  self.assert_('b' in p.schedule.moduleNames())
2413  self.assert_(hasattr(p, 'b'))
2414  self.assert_(hasattr(p, 'c'))
2415  self.assert_(hasattr(p, 'd'))
2416  self.assert_(hasattr(p, 'path1'))
2417  self.assert_(hasattr(p, 'path2'))
2418  self.assert_(hasattr(p, 'path3'))
2419  p.prune()
2420  self.assert_('b' in p.schedule.moduleNames())
2421  self.assert_(hasattr(p, 'b'))
2422  self.assert_(not hasattr(p, 'c'))
2423  self.assert_(not hasattr(p, 'd'))
2424  self.assert_(hasattr(p, 'path1'))
2425  self.assert_(hasattr(p, 'path2'))
2426  self.assert_(not hasattr(p, 'path3'))
2427 
2428  self.assertTrue(len(p.schedule._tasks) == 0)
2429 
2430  p = Process("test")
2431  p.a = EDAnalyzer("MyAnalyzer")
2432  p.b = EDAnalyzer("YourAnalyzer")
2433  p.c = EDAnalyzer("OurAnalyzer")
2434  p.d = EDAnalyzer("dAnalyzer")
2435  p.e = EDProducer("eProducer")
2436  p.f = EDProducer("fProducer")
2437  p.Tracer = Service("Tracer")
2438  p.path1 = Path(p.a)
2439  p.path2 = Path(p.b)
2440  p.path3 = Path(p.d)
2441  p.task1 = Task(p.e)
2442  p.task2 = Task(p.f, p.Tracer)
2443  s = Schedule(p.path1,p.path2,tasks=[p.task1,p.task2,p.task1])
2444  self.assertEqual(s[0],p.path1)
2445  self.assertEqual(s[1],p.path2)
2446  self.assertTrue(len(s._tasks) == 2)
2447  self.assertTrue(p.task1 in s._tasks)
2448  self.assertTrue(p.task2 in s._tasks)
2449  listOfTasks = list(s._tasks)
2450  self.assertTrue(len(listOfTasks) == 2)
2451  self.assertTrue(p.task1 == listOfTasks[0])
2452  self.assertTrue(p.task2 == listOfTasks[1])
2453  p.schedule = s
2454  self.assert_('b' in p.schedule.moduleNames())
2455 
2456  process2 = Process("test")
2457  process2.a = EDAnalyzer("MyAnalyzer")
2458  process2.e = EDProducer("eProducer")
2459  process2.path1 = Path(process2.a)
2460  process2.task1 = Task(process2.e)
2461  process2.schedule = Schedule(process2.path1,tasks=process2.task1)
2462  listOfTasks = list(process2.schedule._tasks)
2463  self.assertTrue(listOfTasks[0] == process2.task1)
2464 
2465  # test Schedule copy
2466  s2 = s.copy()
2467  self.assertEqual(s2[0],p.path1)
2468  self.assertEqual(s2[1],p.path2)
2469  self.assertTrue(len(s2._tasks) == 2)
2470  self.assertTrue(p.task1 in s2._tasks)
2471  self.assertTrue(p.task2 in s2._tasks)
2472  listOfTasks = list(s2._tasks)
2473  self.assertTrue(len(listOfTasks) == 2)
2474  self.assertTrue(p.task1 == listOfTasks[0])
2475  self.assertTrue(p.task2 == listOfTasks[1])
2476 
2477  names = s.moduleNames()
2478  self.assertTrue(names == set(['a', 'b', 'e', 'Tracer', 'f']))
2479  #adding a path not attached to the Process should cause an exception
2480  p = Process("test")
2481  p.a = EDAnalyzer("MyAnalyzer")
2482  path1 = Path(p.a)
2483  s = Schedule(path1)
2484  self.assertRaises(RuntimeError, lambda : p.setSchedule_(s) )
2485 
2486  #make sure anonymous sequences work
2487  p = Process("test")
2488  p.a = EDAnalyzer("MyAnalyzer")
2489  p.b = EDAnalyzer("MyOtherAnalyzer")
2490  p.c = EDProducer("MyProd")
2491  path1 = Path(p.c*Sequence(p.a+p.b))
2492  s = Schedule(path1)
2493  self.assert_('a' in s.moduleNames())
2494  self.assert_('b' in s.moduleNames())
2495  self.assert_('c' in s.moduleNames())
2496  p.path1 = path1
2497  p.schedule = s
2498  p.prune()
2499  self.assert_('a' in s.moduleNames())
2500  self.assert_('b' in s.moduleNames())
2501  self.assert_('c' in s.moduleNames())
2502 
def testSchedule(self)
Definition: Config.py:2398
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run
def Config.TestModuleCommand.testSecSource (   self)

Definition at line 1997 of file Config.py.

References python.rootplot.root2matplotlib.replace().

1997  def testSecSource(self):
1998  p = Process('test')
1999  p.a = SecSource("MySecSource")
2000  self.assertEqual(p.dumpPython().replace('\n',''),'import FWCore.ParameterSet.Config as cmsprocess = cms.Process("test")process.a = cms.SecSource("MySecSource")')
2001 
def replace(string, replacements)
def testSecSource(self)
Definition: Config.py:1997
def Config.TestModuleCommand.testSequence (   self)

Definition at line 2047 of file Config.py.

References str.

2047  def testSequence(self):
2048  p = Process('test')
2049  p.a = EDAnalyzer("MyAnalyzer")
2050  p.b = EDAnalyzer("YourAnalyzer")
2051  p.c = EDAnalyzer("OurAnalyzer")
2052  p.s = Sequence(p.a*p.b)
2053  self.assertEqual(str(p.s),'a+b')
2054  self.assertEqual(p.s.label_(),'s')
2055  path = Path(p.c+p.s)
2056  self.assertEqual(str(path),'c+a+b')
2057  p._validateSequence(path, 'p1')
2058  notInProcess = EDAnalyzer('NotInProcess')
2059  p2 = Path(p.c+p.s*notInProcess)
2060  self.assertRaises(RuntimeError, p._validateSequence, p2, 'p2')
2061 
def testSequence(self)
Definition: Config.py:2047
#define str(s)
def Config.TestModuleCommand.testSequence2 (   self)

Definition at line 2062 of file Config.py.

2062  def testSequence2(self):
2063  p = Process('test')
2064  p.a = EDAnalyzer("MyAnalyzer")
2065  p.b = EDAnalyzer("YourAnalyzer")
2066  p.c = EDAnalyzer("OurAnalyzer")
2067  testseq = Sequence(p.a*p.b)
2068  p.s = testseq
2069  #p.y = testseq
2070  self.assertRaises(ValueError, p.__setattr__, "y", testseq)
2071 
def testSequence2(self)
Definition: Config.py:2062
def Config.TestModuleCommand.testServiceInProcess (   self)

Definition at line 2072 of file Config.py.

2073  service = Service("d")
2074  self.assertFalse(service._inProcess)
2075  process = Process("test")
2076  process.d = service
2077  self.assertTrue(service._inProcess)
2078  service2 = Service("d")
2079  process.d = service2
2080  self.assertFalse(service._inProcess)
2081  self.assertTrue(service2._inProcess)
2082  del process.d
2083  self.assertFalse(service2._inProcess)
2084 
def testServiceInProcess(self)
Definition: Config.py:2072
def Config.TestModuleCommand.testSubProcess (   self)

Definition at line 2650 of file Config.py.

References cond.hash, and str.

2650  def testSubProcess(self):
2651  process = Process("Parent")
2652  subProcess = Process("Child")
2653  subProcess.a = EDProducer("A")
2654  subProcess.p = Path(subProcess.a)
2655  subProcess.add_(Service("Foo"))
2656  process.addSubProcess(SubProcess(subProcess))
2657  d = process.dumpPython()
2658  equalD ="""import FWCore.ParameterSet.Config as cms
2659 
2660 process = cms.Process("Parent")
2661 
2662 parentProcess = process
2663 import FWCore.ParameterSet.Config as cms
2664 
2665 process = cms.Process("Child")
2666 
2667 process.a = cms.EDProducer("A")
2668 
2669 
2670 process.Foo = cms.Service("Foo")
2671 
2672 
2673 process.p = cms.Path(process.a)
2674 
2675 
2676 childProcess = process
2677 process = parentProcess
2678 process.addSubProcess(cms.SubProcess(process = childProcess, SelectEvents = cms.untracked.PSet(
2679 
2680 ), outputCommands = cms.untracked.vstring()))
2681 
2682 """
2683  equalD = equalD.replace("parentProcess","parentProcess"+str(hash(process.subProcesses_()[0])))
2684  self.assertEqual(d,equalD)
2685  p = TestMakePSet()
2686  process.fillProcessDesc(p)
2687  self.assertEqual((True,['a']),p.values["subProcesses"][1][0].values["process"][1].values['@all_modules'])
2688  self.assertEqual((True,['p']),p.values["subProcesses"][1][0].values["process"][1].values['@paths'])
2689  self.assertEqual({'@service_type':(True,'Foo')}, p.values["subProcesses"][1][0].values["process"][1].values["services"][1][0].values)
def testSubProcess(self)
Definition: Config.py:2650
#define str(s)
def Config.TestModuleCommand.testSwitchProducer (   self)

Definition at line 2706 of file Config.py.

2707  proc = Process("test")
2708  proc.sp = SwitchProducerTest(test2 = EDProducer("Foo",
2709  a = int32(1),
2710  b = PSet(c = int32(2))),
2711  test1 = EDProducer("Bar",
2712  aa = int32(11),
2713  bb = PSet(cc = int32(12))))
2714  proc.a = EDProducer("A")
2715  proc.s = Sequence(proc.a + proc.sp)
2716  proc.t = Task(proc.a, proc.sp)
2717  proc.p = Path()
2718  proc.p.associate(proc.t)
2719  p = TestMakePSet()
2720  proc.fillProcessDesc(p)
2721  self.assertEqual((True,"EDProducer"), p.values["sp"][1].values["@module_edm_type"])
2722  self.assertEqual((True, "SwitchProducer"), p.values["sp"][1].values["@module_type"])
2723  self.assertEqual((True, "sp"), p.values["sp"][1].values["@module_label"])
2724  self.assertEqual((True, ["sp@test1", "sp@test2"]), p.values["sp"][1].values["@all_cases"])
2725  self.assertEqual((False, "sp@test2"), p.values["sp"][1].values["@chosen_case"])
2726  self.assertEqual(["a", "sp", "sp@test1", "sp@test2"], p.values["@all_modules"][1])
2727  self.assertEqual((True,"EDProducer"), p.values["sp@test1"][1].values["@module_edm_type"])
2728  self.assertEqual((True,"Bar"), p.values["sp@test1"][1].values["@module_type"])
2729  self.assertEqual((True,"EDProducer"), p.values["sp@test2"][1].values["@module_edm_type"])
2730  self.assertEqual((True,"Foo"), p.values["sp@test2"][1].values["@module_type"])
2731  dump = proc.dumpPython()
2732  self.assertEqual(dump.find('@'), -1)
2733  self.assertEqual(specialImportRegistry.getSpecialImports(), ["from test import SwitchProducerTest"])
2734  self.assertTrue(dump.find("\nfrom test import SwitchProducerTest\n") != -1)
2735 
2736  # EDAlias as non-chosen case
2737  proc = Process("test")
2738  proc.sp = SwitchProducerTest(test2 = EDProducer("Foo",
2739  a = int32(1),
2740  b = PSet(c = int32(2))),
2741  test1 = EDAlias(a = VPSet(PSet(type = string("Bar")))))
2742  proc.a = EDProducer("A")
2743  proc.s = Sequence(proc.a + proc.sp)
2744  proc.t = Task(proc.a, proc.sp)
2745  proc.p = Path()
2746  proc.p.associate(proc.t)
2747  p = TestMakePSet()
2748  proc.fillProcessDesc(p)
2749  self.assertEqual((True,"EDProducer"), p.values["sp"][1].values["@module_edm_type"])
2750  self.assertEqual((True, "SwitchProducer"), p.values["sp"][1].values["@module_type"])
2751  self.assertEqual((True, "sp"), p.values["sp"][1].values["@module_label"])
2752  self.assertEqual((True, ["sp@test1", "sp@test2"]), p.values["sp"][1].values["@all_cases"])
2753  self.assertEqual((False, "sp@test2"), p.values["sp"][1].values["@chosen_case"])
2754  self.assertEqual(["a", "sp", "sp@test2"], p.values["@all_modules"][1])
2755  self.assertEqual(["sp@test1"], p.values["@all_aliases"][1])
2756  self.assertEqual((True,"EDProducer"), p.values["sp@test2"][1].values["@module_edm_type"])
2757  self.assertEqual((True,"Foo"), p.values["sp@test2"][1].values["@module_type"])
2758  self.assertEqual((True,"EDAlias"), p.values["sp@test1"][1].values["@module_edm_type"])
2759  self.assertEqual((True,"Bar"), p.values["sp@test1"][1].values["a"][1][0].values["type"])
2760 
2761  # EDAlias as chosen case
2762  proc = Process("test")
2763  proc.sp = SwitchProducerTest(test1 = EDProducer("Foo",
2764  a = int32(1),
2765  b = PSet(c = int32(2))),
2766  test2 = EDAlias(a = VPSet(PSet(type = string("Bar")))))
2767  proc.a = EDProducer("A")
2768  proc.s = Sequence(proc.a + proc.sp)
2769  proc.t = Task(proc.a, proc.sp)
2770  proc.p = Path()
2771  proc.p.associate(proc.t)
2772  p = TestMakePSet()
2773  proc.fillProcessDesc(p)
2774  self.assertEqual((True,"EDProducer"), p.values["sp"][1].values["@module_edm_type"])
2775  self.assertEqual((True, "SwitchProducer"), p.values["sp"][1].values["@module_type"])
2776  self.assertEqual((True, "sp"), p.values["sp"][1].values["@module_label"])
2777  self.assertEqual((True, ["sp@test1", "sp@test2"]), p.values["sp"][1].values["@all_cases"])
2778  self.assertEqual((False, "sp@test2"), p.values["sp"][1].values["@chosen_case"])
2779  self.assertEqual(["a", "sp", "sp@test1"], p.values["@all_modules"][1])
2780  self.assertEqual(["sp@test2"], p.values["@all_aliases"][1])
2781  self.assertEqual((True,"EDProducer"), p.values["sp@test1"][1].values["@module_edm_type"])
2782  self.assertEqual((True,"Foo"), p.values["sp@test1"][1].values["@module_type"])
2783  self.assertEqual((True,"EDAlias"), p.values["sp@test2"][1].values["@module_edm_type"])
2784  self.assertEqual((True,"Bar"), p.values["sp@test2"][1].values["a"][1][0].values["type"])
2785 
def testSwitchProducer(self)
Definition: Config.py:2706
def Config.TestModuleCommand.testTask (   self)

Definition at line 2085 of file Config.py.

References list().

2085  def testTask(self):
2086 
2087  # create some objects to use in tests
2088  edanalyzer = EDAnalyzer("a")
2089  edproducer = EDProducer("b")
2090  edproducer2 = EDProducer("b2")
2091  edproducer3 = EDProducer("b3")
2092  edproducer4 = EDProducer("b4")
2093  edproducer8 = EDProducer("b8")
2094  edproducer9 = EDProducer("b9")
2095  edfilter = EDFilter("c")
2096  service = Service("d")
2097  service3 = Service("d")
2098  essource = ESSource("e")
2099  esproducer = ESProducer("f")
2100  testTask2 = Task()
2101 
2102  # test adding things to Tasks
2103  testTask1 = Task(edproducer, edfilter)
2104  self.assertRaises(RuntimeError, testTask1.add, edanalyzer)
2105  testTask1.add(essource, service)
2106  testTask1.add(essource, esproducer)
2107  testTask1.add(testTask2)
2108  coll = testTask1._collection
2109  self.assertTrue(edproducer in coll)
2110  self.assertTrue(edfilter in coll)
2111  self.assertTrue(service in coll)
2112  self.assertTrue(essource in coll)
2113  self.assertTrue(esproducer in coll)
2114  self.assertTrue(testTask2 in coll)
2115  self.assertTrue(len(coll) == 6)
2116  self.assertTrue(len(testTask2._collection) == 0)
2117 
2118  taskContents = []
2119  for i in testTask1:
2120  taskContents.append(i)
2121  self.assertTrue(taskContents == [edproducer, edfilter, essource, service, esproducer, testTask2])
2122 
2123  # test attaching Task to Process
2124  process = Process("test")
2125 
2126  process.mproducer = edproducer
2127  process.mproducer2 = edproducer2
2128  process.mfilter = edfilter
2129  process.messource = essource
2130  process.mesproducer = esproducer
2131  process.d = service
2132 
2133  testTask3 = Task(edproducer, edproducer2)
2134  testTask1.add(testTask3)
2135  process.myTask1 = testTask1
2136 
2137  # test the validation that occurs when attaching a Task to a Process
2138  # first a case that passes, then one the fails on an EDProducer
2139  # then one that fails on a service
2140  l = set()
2141  visitor = NodeNameVisitor(l)
2142  testTask1.visit(visitor)
2143  self.assertTrue(l == set(['mesproducer', 'mproducer', 'mproducer2', 'mfilter', 'd', 'messource']))
2144  l2 = testTask1.moduleNames
2145  self.assertTrue(l == set(['mesproducer', 'mproducer', 'mproducer2', 'mfilter', 'd', 'messource']))
2146 
2147  testTask4 = Task(edproducer3)
2148  l.clear()
2149  self.assertRaises(RuntimeError, testTask4.visit, visitor)
2150  try:
2151  process.myTask4 = testTask4
2152  self.assertTrue(False)
2153  except RuntimeError:
2154  pass
2155 
2156  testTask5 = Task(service3)
2157  l.clear()
2158  self.assertRaises(RuntimeError, testTask5.visit, visitor)
2159  try:
2160  process.myTask5 = testTask5
2161  self.assertTrue(False)
2162  except RuntimeError:
2163  pass
2164 
2165  process.d = service3
2166  process.myTask5 = testTask5
2167 
2168  # test placement into the Process and the tasks property
2169  expectedDict = { 'myTask1' : testTask1, 'myTask5' : testTask5 }
2170  expectedFixedDict = DictTypes.FixedKeysDict(expectedDict);
2171  self.assertTrue(process.tasks == expectedFixedDict)
2172  self.assertTrue(process.tasks['myTask1'] == testTask1)
2173  self.assertTrue(process.myTask1 == testTask1)
2174 
2175  # test replacing an EDProducer in a Task when calling __settattr__
2176  # for the EDProducer on the Process.
2177  process.mproducer2 = edproducer4
2178  process.d = service
2179  l = list()
2180  visitor1 = ModuleNodeVisitor(l)
2181  testTask1.visit(visitor1)
2182  l.sort()
2183  expectedList = sorted([edproducer,essource,esproducer,service,edfilter,edproducer,edproducer4])
2184  self.assertTrue(expectedList == l)
2185 
2186  process.myTask6 = Task()
2187  process.myTask7 = Task()
2188  process.mproducer8 = edproducer8
2189  process.myTask8 = Task(process.mproducer8)
2190  process.myTask6.add(process.myTask7)
2191  process.myTask7.add(process.myTask8)
2192  process.myTask1.add(process.myTask6)
2193  process.myTask8.add(process.myTask5)
2194 
2195  testDict = process._itemsInDependencyOrder(process.tasks)
2196  expectedLabels = ["myTask5", "myTask8", "myTask7", "myTask6", "myTask1"]
2197  expectedTasks = [process.myTask5, process.myTask8, process.myTask7, process.myTask6, process.myTask1]
2198  index = 0
2199  for testLabel, testTask in testDict.items():
2200  self.assertTrue(testLabel == expectedLabels[index])
2201  self.assertTrue(testTask == expectedTasks[index])
2202  index += 1
2203 
2204  pythonDump = testTask1.dumpPython(PrintOptions())
2205 
2206 
2207  expectedPythonDump = 'cms.Task(process.d, process.mesproducer, process.messource, process.mfilter, process.mproducer, process.mproducer2, process.myTask6)\n'
2208  self.assertTrue(pythonDump == expectedPythonDump)
2209 
2210  process.myTask5 = Task()
2211  process.myTask100 = Task()
2212  process.mproducer9 = edproducer9
2213  sequence1 = Sequence(process.mproducer8, process.myTask1, process.myTask5, testTask2, testTask3)
2214  sequence2 = Sequence(process.mproducer8 + process.mproducer9)
2215  process.sequence3 = Sequence((process.mproducer8 + process.mfilter))
2216  sequence4 = Sequence()
2217  process.path1 = Path(process.mproducer+process.mproducer8+sequence1+sequence2+process.sequence3+sequence4)
2218  process.path1.associate(process.myTask1, process.myTask5, testTask2, testTask3)
2219  process.path11 = Path(process.mproducer+process.mproducer8+sequence1+sequence2+process.sequence3+ sequence4,process.myTask1, process.myTask5, testTask2, testTask3, process.myTask100)
2220  process.path2 = Path(process.mproducer)
2221  process.path3 = Path(process.mproducer9+process.mproducer8,testTask2)
2222 
2223  self.assertTrue(process.path1.dumpPython(PrintOptions()) == 'cms.Path(process.mproducer+process.mproducer8+cms.Sequence(process.mproducer8, cms.Task(), cms.Task(process.None, process.mproducer), process.myTask1, process.myTask5)+(process.mproducer8+process.mproducer9)+process.sequence3, cms.Task(), cms.Task(process.None, process.mproducer), process.myTask1, process.myTask5)\n')
2224 
2225  self.assertTrue(process.path11.dumpPython(PrintOptions()) == 'cms.Path(process.mproducer+process.mproducer8+cms.Sequence(process.mproducer8, cms.Task(), cms.Task(process.None, process.mproducer), process.myTask1, process.myTask5)+(process.mproducer8+process.mproducer9)+process.sequence3, cms.Task(), cms.Task(process.None, process.mproducer), process.myTask1, process.myTask100, process.myTask5)\n')
2226 
2227  # test NodeNameVisitor and moduleNames
2228  l = set()
2229  nameVisitor = NodeNameVisitor(l)
2230  process.path1.visit(nameVisitor)
2231  self.assertTrue(l == set(['mproducer', 'd', 'mesproducer', None, 'mproducer9', 'mproducer8', 'messource', 'mproducer2', 'mfilter']))
2232  self.assertTrue(process.path1.moduleNames() == set(['mproducer', 'd', 'mesproducer', None, 'mproducer9', 'mproducer8', 'messource', 'mproducer2', 'mfilter']))
2233 
2234  # test copy
2235  process.mproducer10 = EDProducer("b10")
2236  process.path21 = process.path11.copy()
2237  process.path21.replace(process.mproducer, process.mproducer10)
2238 
2239  self.assertTrue(process.path11.dumpPython(PrintOptions()) == 'cms.Path(process.mproducer+process.mproducer8+cms.Sequence(process.mproducer8, cms.Task(), cms.Task(process.None, process.mproducer), process.myTask1, process.myTask5)+(process.mproducer8+process.mproducer9)+process.sequence3, cms.Task(), cms.Task(process.None, process.mproducer), process.myTask1, process.myTask100, process.myTask5)\n')
2240 
2241  # Some peculiarities of the way things work show up here. dumpPython sorts tasks and
2242  # removes duplication at the level of strings. The Task and Sequence objects themselves
2243  # remove duplicate tasks in their contents if the instances are the same (exact same python
2244  # object id which is not the same as the string representation being the same).
2245  # Also note that the mutating visitor replaces sequences and tasks that have
2246  # modified contents with their modified contents, it does not modify the sequence
2247  # or task itself.
2248  self.assertTrue(process.path21.dumpPython(PrintOptions()) == 'cms.Path(process.mproducer10+process.mproducer8+process.mproducer8+(process.mproducer8+process.mproducer9)+process.sequence3, cms.Task(), cms.Task(process.None, process.mproducer10), cms.Task(process.d, process.mesproducer, process.messource, process.mfilter, process.mproducer10, process.mproducer2, process.myTask6), process.myTask100, process.myTask5)\n')
2249 
2250  process.path22 = process.path21.copyAndExclude([process.d, process.mesproducer, process.mfilter])
2251  self.assertTrue(process.path22.dumpPython(PrintOptions()) == 'cms.Path(process.mproducer10+process.mproducer8+process.mproducer8+(process.mproducer8+process.mproducer9)+process.mproducer8, cms.Task(), cms.Task(process.None, process.mproducer10), cms.Task(process.messource, process.mproducer10, process.mproducer2, process.myTask6), process.myTask100, process.myTask5)\n')
2252 
2253  process.path23 = process.path22.copyAndExclude([process.messource, process.mproducer10])
2254  self.assertTrue(process.path23.dumpPython(PrintOptions()) == 'cms.Path(process.mproducer8+process.mproducer8+(process.mproducer8+process.mproducer9)+process.mproducer8, cms.Task(), cms.Task(process.None), cms.Task(process.mproducer2, process.myTask6), process.myTask100, process.myTask5)\n')
2255 
2256  process.a = EDAnalyzer("MyAnalyzer")
2257  process.b = OutputModule("MyOutputModule")
2258  process.c = EDFilter("MyFilter")
2259  process.d = EDProducer("MyProducer")
2260  process.e = ESProducer("MyESProducer")
2261  process.f = ESSource("MyESSource")
2262  process.g = ESProducer("g")
2263  process.path24 = Path(process.a+process.b+process.c+process.d)
2264  process.path25 = process.path24.copyAndExclude([process.a,process.b,process.c])
2265  self.assertTrue(process.path25.dumpPython(None) == 'cms.Path(process.d)\n')
2266  #print process.path3
2267  #print process.dumpPython()
2268 
2269  process.path200 = EndPath(Sequence(process.c,Task(process.e)))
2270  process.path200.replace(process.c,process.b)
2271  process.path200.replace(process.e,process.f)
2272  self.assertEqual(process.path200.dumpPython(None), "cms.EndPath(process.b, cms.Task(process.f))\n")
2273  process.path200.replace(process.b,process.c)
2274  process.path200.replace(process.f,process.e)
2275  self.assertEqual(process.path200.dumpPython(None), "cms.EndPath(process.c, cms.Task(process.e))\n")
2276  process.path200.replace(process.c,process.a)
2277  process.path200.replace(process.e,process.g)
2278  self.assertEqual(process.path200.dumpPython(None), "cms.EndPath(process.a, cms.Task(process.g))\n")
2279  process.path200.replace(process.a,process.c)
2280  process.path200.replace(process.g,process.e)
2281  self.assertEqual(process.path200.dumpPython(None), "cms.EndPath(process.c, cms.Task(process.e))\n")
2282 
2283 
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run
def Config.TestModuleCommand.testTaskPlaceholder (   self)

Definition at line 2869 of file Config.py.

2870  p = Process("test")
2871  p.a = EDProducer("ma")
2872  p.b = EDAnalyzer("mb")
2873  p.t1 = Task(TaskPlaceholder("c"))
2874  p.t2 = Task(p.a, TaskPlaceholder("d"), p.t1)
2875  p.t3 = Task(TaskPlaceholder("e"))
2876  p.path1 = Path(p.b, p.t2, p.t3)
2877  p.t5 = Task(p.a, TaskPlaceholder("g"), TaskPlaceholder("t4"))
2878  p.t4 = Task(TaskPlaceholder("f"))
2879  p.endpath1 = EndPath(p.b, p.t5)
2880  p.t6 = Task(TaskPlaceholder("h"))
2881  p.t7 = Task(p.a, TaskPlaceholder("i"), p.t6)
2882  p.t8 = Task(TaskPlaceholder("j"))
2883  p.schedule = Schedule(p.path1, p.endpath1,tasks=[p.t7,p.t8])
2884  p.c = EDProducer("mc")
2885  p.d = EDProducer("md")
2886  p.e = EDProducer("me")
2887  p.f = EDProducer("mf")
2888  p.g = EDProducer("mg")
2889  p.h = EDProducer("mh")
2890  p.i = EDProducer("mi")
2891  p.j = EDProducer("mj")
2892  self.assertEqual(p.dumpPython(),
2893 """import FWCore.ParameterSet.Config as cms
2894 
2895 process = cms.Process("test")
2896 
2897 process.a = cms.EDProducer("ma")
2898 
2899 
2900 process.c = cms.EDProducer("mc")
2901 
2902 
2903 process.d = cms.EDProducer("md")
2904 
2905 
2906 process.e = cms.EDProducer("me")
2907 
2908 
2909 process.f = cms.EDProducer("mf")
2910 
2911 
2912 process.g = cms.EDProducer("mg")
2913 
2914 
2915 process.h = cms.EDProducer("mh")
2916 
2917 
2918 process.i = cms.EDProducer("mi")
2919 
2920 
2921 process.j = cms.EDProducer("mj")
2922 
2923 
2924 process.b = cms.EDAnalyzer("mb")
2925 
2926 
2927 process.t8 = cms.Task(cms.TaskPlaceholder("j"))
2928 
2929 
2930 process.t6 = cms.Task(cms.TaskPlaceholder("h"))
2931 
2932 
2933 process.t7 = cms.Task(cms.TaskPlaceholder("i"), process.a, process.t6)
2934 
2935 
2936 process.t4 = cms.Task(cms.TaskPlaceholder("f"))
2937 
2938 
2939 process.t5 = cms.Task(cms.TaskPlaceholder("g"), cms.TaskPlaceholder("t4"), process.a)
2940 
2941 
2942 process.t3 = cms.Task(cms.TaskPlaceholder("e"))
2943 
2944 
2945 process.t1 = cms.Task(cms.TaskPlaceholder("c"))
2946 
2947 
2948 process.t2 = cms.Task(cms.TaskPlaceholder("d"), process.a, process.t1)
2949 
2950 
2951 process.path1 = cms.Path(process.b, process.t2, process.t3)
2952 
2953 
2954 process.endpath1 = cms.EndPath(process.b, process.t5)
2955 
2956 
2957 process.schedule = cms.Schedule(*[ process.path1, process.endpath1 ], tasks=[process.t7, process.t8])
2958 """)
2959  p.resolve()
2960  self.assertEqual(p.dumpPython(),
2961 """import FWCore.ParameterSet.Config as cms
2962 
2963 process = cms.Process("test")
2964 
2965 process.a = cms.EDProducer("ma")
2966 
2967 
2968 process.c = cms.EDProducer("mc")
2969 
2970 
2971 process.d = cms.EDProducer("md")
2972 
2973 
2974 process.e = cms.EDProducer("me")
2975 
2976 
2977 process.f = cms.EDProducer("mf")
2978 
2979 
2980 process.g = cms.EDProducer("mg")
2981 
2982 
2983 process.h = cms.EDProducer("mh")
2984 
2985 
2986 process.i = cms.EDProducer("mi")
2987 
2988 
2989 process.j = cms.EDProducer("mj")
2990 
2991 
2992 process.b = cms.EDAnalyzer("mb")
2993 
2994 
2995 process.t8 = cms.Task(process.j)
2996 
2997 
2998 process.t6 = cms.Task(process.h)
2999 
3000 
3001 process.t7 = cms.Task(process.a, process.i, process.t6)
3002 
3003 
3004 process.t4 = cms.Task(process.f)
3005 
3006 
3007 process.t5 = cms.Task(process.a, process.g, process.t4)
3008 
3009 
3010 process.t3 = cms.Task(process.e)
3011 
3012 
3013 process.t1 = cms.Task(process.c)
3014 
3015 
3016 process.t2 = cms.Task(process.a, process.d, process.t1)
3017 
3018 
3019 process.path1 = cms.Path(process.b, process.t2, process.t3)
3020 
3021 
3022 process.endpath1 = cms.EndPath(process.b, process.t5)
3023 
3024 
3025 process.schedule = cms.Schedule(*[ process.path1, process.endpath1 ], tasks=[process.t7, process.t8])
3026 """)
3027 
def testTaskPlaceholder(self)
Definition: Config.py:2869
def Config.TestModuleCommand.testTypedParameterizable (   self)

Definition at line 1640 of file Config.py.

1641  p = _TypedParameterizable("blah", b=int32(1))
1642  #see if copy works deeply
1643  other = p.copy()
1644  other.b = 2
1645  self.assertNotEqual(p.b,other.b)
1646 
def testTypedParameterizable(self)
Definition: Config.py:1640
def Config.TestModuleCommand.testUsing (   self)

Definition at line 2536 of file Config.py.

2536  def testUsing(self):
2537  p = Process('test')
2538  p.block = PSet(a = int32(1))
2539  p.modu = EDAnalyzer('Analyzer', p.block, b = int32(2))
2540  self.assertEqual(p.modu.a.value(),1)
2541  self.assertEqual(p.modu.b.value(),2)
2542 

Member Data Documentation

Config.TestModuleCommand.a

Definition at line 3158 of file Config.py.

Config.TestModuleCommand.proc_mod_

Definition at line 3155 of file Config.py.