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 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 testTask (self)
 
def testTypedParameterizable (self)
 
def testUsing (self)
 

Public Attributes

 a
 
 proc_mod_
 

Detailed Description

Definition at line 1504 of file Config.py.

Member Function Documentation

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

Definition at line 1505 of file Config.py.

1505  def setUp(self):
1506  """Nothing to do """
1507  None
def Config.TestModuleCommand.testCloneSequence (   self)

Definition at line 2226 of file Config.py.

References hcalTTPDigis_cfi.id, and harvestTrackValidationPlots.str.

2227  p = Process("test")
2228  a = EDAnalyzer("MyAnalyzer")
2229  p.a = a
2230  a.setLabel("a")
2231  b = EDAnalyzer("YOurAnalyzer")
2232  p.b = b
2233  b.setLabel("b")
2234  path = Path(a * b)
2235  p.path = Path(p.a*p.b)
2236  lookuptable = {id(a): p.a, id(b): p.b}
2237  #self.assertEqual(str(path),str(path._postProcessFixup(lookuptable)))
2238  #lookuptable = p._cloneToObjectDict
2239  #self.assertEqual(str(path),str(path._postProcessFixup(lookuptable)))
2240  self.assertEqual(str(path),str(p.path))
2241 
def testCloneSequence(self)
Definition: Config.py:2226
def Config.TestModuleCommand.testDelete (   self)

Definition at line 2633 of file Config.py.

References ConfigBuilder.dumpPython().

2633  def testDelete(self):
2634  p = Process("test")
2635  p.a = EDAnalyzer("MyAnalyzer")
2636  p.b = EDAnalyzer("YourAnalyzer")
2637  p.c = EDAnalyzer("OurAnalyzer")
2638  p.d = EDAnalyzer("OurAnalyzer")
2639  p.e = EDAnalyzer("OurAnalyzer")
2640  p.f = EDAnalyzer("OurAnalyzer")
2641  p.g = EDProducer("OurProducer")
2642  p.h = EDProducer("YourProducer")
2643  p.t1 = Task(p.g, p.h)
2644  t2 = Task(p.g, p.h)
2645  t3 = Task(p.g, p.h)
2646  p.s = Sequence(p.d+p.e)
2647  p.path1 = Path(p.a+p.f+p.s,t2)
2648  p.endpath1 = EndPath(p.b+p.f)
2649  p.schedule = Schedule(tasks=[t3])
2650  self.assertTrue(hasattr(p, 'f'))
2651  self.assertTrue(hasattr(p, 'g'))
2652  del p.e
2653  del p.f
2654  del p.g
2655  self.assertFalse(hasattr(p, 'f'))
2656  self.assertFalse(hasattr(p, 'g'))
2657  self.assertTrue(p.t1.dumpPython(None) == 'cms.Task(process.h)\n')
2658  self.assertTrue(p.s.dumpPython(None) == 'cms.Sequence(process.d)\n')
2659  self.assertTrue(p.path1.dumpPython(None) == 'cms.Path(process.a+process.s, cms.Task(process.h))\n')
2660  self.assertTrue(p.endpath1.dumpPython(None) == 'cms.EndPath(process.b)\n')
2661  del p.s
2662  self.assertTrue(p.path1.dumpPython(None) == 'cms.Path(process.a+(process.d), cms.Task(process.h))\n')
2663  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 2410 of file Config.py.

2410  def testExamples(self):
2411  p = Process("Test")
2412  p.source = Source("PoolSource",fileNames = untracked(string("file:reco.root")))
2413  p.foos = EDProducer("FooProducer")
2414  p.bars = EDProducer("BarProducer", foos=InputTag("foos"))
2415  p.out = OutputModule("PoolOutputModule",fileName=untracked(string("file:foos.root")))
2416  p.bars.foos = 'Foosball'
2417  self.assertEqual(p.bars.foos, InputTag('Foosball'))
2418  p.p = Path(p.foos*p.bars)
2419  p.e = EndPath(p.out)
2420  p.add_(Service("MessageLogger"))
2421 
def testExamples(self)
Definition: Config.py:2410
def Config.TestModuleCommand.testFreeze (   self)

Definition at line 2476 of file Config.py.

2476  def testFreeze(self):
2477  process = Process("Freeze")
2478  m = EDProducer("M", p=PSet(i = int32(1)))
2479  m.p.i = 2
2480  process.m = m
2481  # should be frozen
2482  #self.assertRaises(ValueError, setattr, m.p, 'i', 3)
2483  #self.assertRaises(ValueError, setattr, m, 'p', PSet(i=int32(1)))
2484  #self.assertRaises(ValueError, setattr, m.p, 'j', 1)
2485  #self.assertRaises(ValueError, setattr, m, 'j', 1)
2486  # But OK to change through the process
2487  process.m.p.i = 4
2488  self.assertEqual(process.m.p.i.value(), 4)
2489  process.m.p = PSet(j=int32(1))
2490  # should work to clone it, though
2491  m2 = m.clone(p = PSet(i = int32(5)), j = int32(8))
2492  m2.p.i = 6
2493  m2.j = 8
def Config.TestModuleCommand.testGlobalReplace (   self)

Definition at line 1903 of file Config.py.

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

1904  p = Process('test')
1905  p.a = EDAnalyzer("MyAnalyzer")
1906  old = p.a
1907  p.b = EDAnalyzer("YourAnalyzer")
1908  p.c = EDAnalyzer("OurAnalyzer")
1909  p.d = EDProducer("MyProducer")
1910  old2 = p.d
1911  p.t1 = Task(p.d)
1912  t2 = Task(p.d)
1913  t3 = Task(p.d)
1914  t4 = Task(p.d)
1915  t5 = Task(p.d)
1916  t6 = Task(p.d)
1917  s = Sequence(p.a*p.b)
1918  p.s4 = Sequence(p.a*p.b)
1919  s.associate(t2)
1920  p.s4.associate(t2)
1921  p.p = Path(p.c+s+p.a)
1922  p.e3 = EndPath(p.c+s+p.a)
1923  new = EDAnalyzer("NewAnalyzer")
1924  new2 = EDProducer("NewProducer")
1925  visitor1 = NodeVisitor()
1926  p.p.visit(visitor1)
1927  self.assertTrue(visitor1.modules == set([old,old2,p.b,p.c]))
1928  p.schedule = Schedule(tasks=[t6])
1929  p.globalReplace("a",new)
1930  p.globalReplace("d",new2)
1931  visitor2 = NodeVisitor()
1932  p.p.visit(visitor2)
1933  self.assertTrue(visitor2.modules == set([new,new2,p.b,p.c]))
1934  visitor3 = NodeVisitor()
1935  p.e3.visit(visitor3)
1936  self.assertTrue(visitor3.modules == set([new,new2,p.b,p.c]))
1937  visitor4 = NodeVisitor()
1938  p.s4.visit(visitor4)
1939  self.assertTrue(visitor4.modules == set([new,new2,p.b]))
1940  visitor5 = NodeVisitor()
1941  p.t1.visit(visitor5)
1942  self.assertTrue(visitor5.modules == set([new2]))
1943  visitor6 = NodeVisitor()
1944  listOfTasks = list(p.schedule._tasks)
1945  listOfTasks[0].visit(visitor6)
1946  self.assertTrue(visitor6.modules == set([new2]))
1947 
def visit(visitdir)
Retrieve data from a perf suite output (sub) directory, only examines TimeSize at the moment...
def testGlobalReplace(self)
Definition: Config.py:1903
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 2347 of file Config.py.

2348  p = Process("test")
2349  p.a = EDAnalyzer("MyAnalyzer")
2350  p.b = EDAnalyzer("YourAnalyzer")
2351  p.c = EDAnalyzer("OurAnalyzer")
2352  p.path1 = Path(p.a)
2353  p.path2 = Path(p.b)
2354  self.assert_(p.schedule is None)
2355  pths = p.paths
2356  keys = pths.keys()
2357  self.assertEqual(pths[keys[0]],p.path1)
2358  self.assertEqual(pths[keys[1]],p.path2)
2359  p.prune()
2360  self.assert_(hasattr(p, 'a'))
2361  self.assert_(hasattr(p, 'b'))
2362  self.assert_(not hasattr(p, 'c'))
2363  self.assert_(hasattr(p, 'path1'))
2364  self.assert_(hasattr(p, 'path2'))
2365 
2366 
2367  p = Process("test")
2368  p.a = EDAnalyzer("MyAnalyzer")
2369  p.b = EDAnalyzer("YourAnalyzer")
2370  p.c = EDAnalyzer("OurAnalyzer")
2371  p.path2 = Path(p.b)
2372  p.path1 = Path(p.a)
2373  self.assert_(p.schedule is None)
2374  pths = p.paths
2375  keys = pths.keys()
2376  self.assertEqual(pths[keys[1]],p.path1)
2377  self.assertEqual(pths[keys[0]],p.path2)
2378 
2379 
def testImplicitSchedule(self)
Definition: Config.py:2347
def Config.TestModuleCommand.testModifier (   self)

Definition at line 2664 of file Config.py.

References cmsPerfStripChart.dict, and resolutioncreator_cfi.object.

2664  def testModifier(self):
2665  m1 = Modifier()
2666  p = Process("test",m1)
2667  p.a = EDAnalyzer("MyAnalyzer", fred = int32(1))
2668  def _mod_fred(obj):
2669  obj.fred = 2
2670  m1.toModify(p.a,_mod_fred)
2671  self.assertEqual(p.a.fred.value(),2)
2672  p.b = EDAnalyzer("YourAnalyzer", wilma = int32(1))
2673  m1.toModify(p.b, wilma = 2)
2674  self.assertEqual(p.b.wilma.value(),2)
2675  self.assert_(p.isUsingModifier(m1))
2676  #check that Modifier not attached to a process doesn't run
2677  m1 = Modifier()
2678  p = Process("test")
2679  p.a = EDAnalyzer("MyAnalyzer", fred = int32(1))
2680  m1.toModify(p.a,_mod_fred)
2681  p.b = EDAnalyzer("YourAnalyzer", wilma = int32(1))
2682  m1.toModify(p.b, wilma = 2)
2683  self.assertEqual(p.a.fred.value(),1)
2684  self.assertEqual(p.b.wilma.value(),1)
2685  self.assertEqual(p.isUsingModifier(m1),False)
2686  #make sure clones get the changes
2687  m1 = Modifier()
2688  p = Process("test",m1)
2689  p.a = EDAnalyzer("MyAnalyzer", fred = int32(1), wilma = int32(1))
2690  m1.toModify(p.a, fred = int32(2))
2691  p.b = p.a.clone(wilma = int32(3))
2692  self.assertEqual(p.a.fred.value(),2)
2693  self.assertEqual(p.a.wilma.value(),1)
2694  self.assertEqual(p.b.fred.value(),2)
2695  self.assertEqual(p.b.wilma.value(),3)
2696  #test removal of parameter
2697  m1 = Modifier()
2698  p = Process("test",m1)
2699  p.a = EDAnalyzer("MyAnalyzer", fred = int32(1), wilma = int32(1))
2700  m1.toModify(p.a, fred = None)
2701  self.assertEqual(hasattr(p.a, "fred"), False)
2702  self.assertEqual(p.a.wilma.value(),1)
2703  #test adding a parameter
2704  m1 = Modifier()
2705  p = Process("test",m1)
2706  p.a = EDAnalyzer("MyAnalyzer", fred = int32(1))
2707  m1.toModify(p.a, wilma = int32(2))
2708  self.assertEqual(p.a.fred.value(), 1)
2709  self.assertEqual(p.a.wilma.value(),2)
2710  #test setting of value in PSet
2711  m1 = Modifier()
2712  p = Process("test",m1)
2713  p.a = EDAnalyzer("MyAnalyzer", flintstones = PSet(fred = int32(1), wilma = int32(1)))
2714  m1.toModify(p.a, flintstones = dict(fred = int32(2)))
2715  self.assertEqual(p.a.flintstones.fred.value(),2)
2716  self.assertEqual(p.a.flintstones.wilma.value(),1)
2717  #test proper exception from nonexisting parameter name
2718  m1 = Modifier()
2719  p = Process("test",m1)
2720  p.a = EDAnalyzer("MyAnalyzer", flintstones = PSet(fred = PSet(wilma = int32(1))))
2721  self.assertRaises(KeyError, lambda: m1.toModify(p.a, flintstones = dict(imnothere = dict(wilma=2))))
2722  self.assertRaises(KeyError, lambda: m1.toModify(p.a, foo = 1))
2723  #test setting a value in a VPSet
2724  m1 = Modifier()
2725  p = Process("test",m1)
2726  p.a = EDAnalyzer("MyAnalyzer", flintstones = VPSet(PSet(fred = int32(1)), PSet(wilma = int32(1))))
2727  m1.toModify(p.a, flintstones = {1:dict(wilma = int32(2))})
2728  self.assertEqual(p.a.flintstones[0].fred.value(),1)
2729  self.assertEqual(p.a.flintstones[1].wilma.value(),2)
2730  #test setting a value in a list of values
2731  m1 = Modifier()
2732  p = Process("test",m1)
2733  p.a = EDAnalyzer("MyAnalyzer", fred = vuint32(1,2,3))
2734  m1.toModify(p.a, fred = {1:7})
2735  self.assertEqual(p.a.fred[0],1)
2736  self.assertEqual(p.a.fred[1],7)
2737  self.assertEqual(p.a.fred[2],3)
2738  #test IndexError setting a value in a list to an item key not in the list
2739  m1 = Modifier()
2740  p = Process("test",m1)
2741  p.a = EDAnalyzer("MyAnalyzer", fred = vuint32(1,2,3))
2742  raised = False
2743  try: m1.toModify(p.a, fred = {5:7})
2744  except IndexError as e: raised = True
2745  self.assertEqual(raised, True)
2746  #test TypeError setting a value in a list using a key that is not an int
2747  m1 = Modifier()
2748  p = Process("test",m1)
2749  p.a = EDAnalyzer("MyAnalyzer", flintstones = VPSet(PSet(fred = int32(1)), PSet(wilma = int32(1))))
2750  raised = False
2751  try: m1.toModify(p.a, flintstones = dict(bogus = int32(37)))
2752  except TypeError as e: raised = True
2753  self.assertEqual(raised, True)
2754  #test that load causes process wide methods to run
2755  def _rem_a(proc):
2756  del proc.a
2757  class ProcModifierMod(object):
2758  def __init__(self,modifier,func):
2759  self.proc_mod_ = modifier.makeProcessModifier(func)
2760  class DummyMod(object):
2761  def __init__(self):
2762  self.a = EDAnalyzer("Dummy")
2763  testMod = DummyMod()
2764  p.extend(testMod)
2765  self.assert_(hasattr(p,"a"))
2766  m1 = Modifier()
2767  p = Process("test",m1)
2768  testProcMod = ProcModifierMod(m1,_rem_a)
2769  p.extend(testMod)
2770  p.extend(testProcMod)
2771  self.assert_(not hasattr(p,"a"))
2772  #test ModifierChain
2773  m1 = Modifier()
2774  mc = ModifierChain(m1)
2775  p = Process("test",mc)
2776  self.assert_(p.isUsingModifier(m1))
2777  self.assert_(p.isUsingModifier(mc))
2778  testMod = DummyMod()
2779  p.b = EDAnalyzer("Dummy2", fred = int32(1))
2780  m1.toModify(p.b, fred = int32(3))
2781  p.extend(testMod)
2782  testProcMod = ProcModifierMod(m1,_rem_a)
2783  p.extend(testProcMod)
2784  self.assert_(not hasattr(p,"a"))
2785  self.assertEqual(p.b.fred.value(),3)
2786  #check cloneAndExclude
2787  m1 = Modifier()
2788  m2 = Modifier()
2789  mc = ModifierChain(m1,m2)
2790  mclone = mc.copyAndExclude([m2])
2791  self.assert_(not mclone._isOrContains(m2))
2792  self.assert_(mclone._isOrContains(m1))
2793  m3 = Modifier()
2794  mc2 = ModifierChain(mc,m3)
2795  mclone = mc2.copyAndExclude([m2])
2796  self.assert_(not mclone._isOrContains(m2))
2797  self.assert_(mclone._isOrContains(m1))
2798  self.assert_(mclone._isOrContains(m3))
2799  #check combining
2800  m1 = Modifier()
2801  m2 = Modifier()
2802  p = Process("test",m1)
2803  p.a = EDAnalyzer("MyAnalyzer", fred = int32(1), wilma = int32(1))
2804  (m1 & m2).toModify(p.a, fred = int32(2))
2805  self.assertEqual(p.a.fred, 1)
2806  m1 = Modifier()
2807  m2 = Modifier()
2808  p = Process("test",m1,m2)
2809  p.a = EDAnalyzer("MyAnalyzer", fred = int32(1), wilma = int32(1))
2810  (m1 & m2).toModify(p.a, fred = int32(2))
2811  self.assertEqual(p.a.fred, 2)
2812  m1 = Modifier()
2813  m2 = Modifier()
2814  m3 = Modifier()
2815  p = Process("test",m1,m2,m3)
2816  p.a = EDAnalyzer("MyAnalyzer", fred = int32(1), wilma = int32(1))
2817  (m1 & m2 & m3).toModify(p.a, fred = int32(2))
2818  self.assertEqual(p.a.fred, 2)
2819  #check toReplaceWith
2820  m1 = Modifier()
2821  p = Process("test",m1)
2822  p.a =EDAnalyzer("MyAnalyzer", fred = int32(1))
2823  m1.toReplaceWith(p.a, EDAnalyzer("YourAnalyzer", wilma = int32(3)))
2824  p.b =EDAnalyzer("BAn")
2825  p.c =EDProducer("c")
2826  p.d =EDProducer("d")
2827  p.tc = Task(p.c)
2828  p.td = Task(p.d)
2829  p.s = Sequence(p.a, p.tc)
2830  m1.toReplaceWith(p.s, Sequence(p.a+p.b, p.td))
2831  self.assertEqual(p.a.wilma.value(),3)
2832  self.assertEqual(p.a.type_(),"YourAnalyzer")
2833  self.assertEqual(hasattr(p,"fred"),False)
2834  self.assertTrue(p.s.dumpPython("") == "cms.Sequence(process.a+process.b, process.td)\n")
2835  p.e =EDProducer("e")
2836  m1.toReplaceWith(p.td, Task(p.e))
2837  self.assertTrue(p.td._collection == OrderedSet([p.e]))
2838  #check toReplaceWith doesn't activate not chosen
2839  m1 = Modifier()
2840  p = Process("test")
2841  p.a =EDAnalyzer("MyAnalyzer", fred = int32(1))
2842  m1.toReplaceWith(p.a, EDAnalyzer("YourAnalyzer", wilma = int32(3)))
2843  self.assertEqual(p.a.type_(),"MyAnalyzer")
2844  unittest.main()
def testModifier(self)
Definition: Config.py:2664
def Config.TestModuleCommand.testOverride (   self)

Definition at line 2387 of file Config.py.

2387  def testOverride(self):
2388  p = Process('test')
2389  a = EDProducer("A", a1=int32(0))
2390  self.assert_(not a.isModified())
2391  a.a1 = 1
2392  self.assert_(a.isModified())
2393  p.a = a
2394  self.assertEqual(p.a.a1.value(), 1)
2395  # try adding an unmodified module.
2396  # should accept it
2397  p.a = EDProducer("A", a1=int32(2))
2398  self.assertEqual(p.a.a1.value(), 2)
2399  # try adding a modified module. Should throw
2400  # no longer, since the same (modified) say, geometry
2401  # could come from more than one cff
2402  b = EDProducer("A", a1=int32(3))
2403  b.a1 = 4
2404  #self.assertRaises(RuntimeError, setattr, *(p,'a',b))
2405  ps1 = PSet(a = int32(1))
2406  ps2 = PSet(a = int32(2))
2407  self.assertRaises(ValueError, EDProducer, 'C', ps1, ps2)
2408  self.assertRaises(ValueError, EDProducer, 'C', ps1, a=int32(3))
2409 
def testOverride(self)
Definition: Config.py:2387
def Config.TestModuleCommand.testParameterizable (   self)

Definition at line 1508 of file Config.py.

1509  p = _Parameterizable()
1510  self.assertEqual(len(p.parameterNames_()),0)
1511  p.a = int32(1)
1512  self.assert_('a' in p.parameterNames_())
1513  self.assertEqual(p.a.value(), 1)
1514  p.a = 10
1515  self.assertEqual(p.a.value(), 10)
1516  p.a = untracked(int32(1))
1517  self.assertEqual(p.a.value(), 1)
1518  self.failIf(p.a.isTracked())
1519  p.a = untracked.int32(1)
1520  self.assertEqual(p.a.value(), 1)
1521  self.failIf(p.a.isTracked())
1522  p = _Parameterizable(foo=int32(10), bar = untracked(double(1.0)))
1523  self.assertEqual(p.foo.value(), 10)
1524  self.assertEqual(p.bar.value(),1.0)
1525  self.failIf(p.bar.isTracked())
1526  self.assertRaises(TypeError,setattr,(p,'c',1))
1527  p = _Parameterizable(a=PSet(foo=int32(10), bar = untracked(double(1.0))))
1528  self.assertEqual(p.a.foo.value(),10)
1529  self.assertEqual(p.a.bar.value(),1.0)
1530  p.b = untracked(PSet(fii = int32(1)))
1531  self.assertEqual(p.b.fii.value(),1)
1532  self.failIf(p.b.isTracked())
1533  #test the fact that values can be shared
1534  v = int32(10)
1535  p=_Parameterizable(a=v)
1536  v.setValue(11)
1537  self.assertEqual(p.a.value(),11)
1538  p.a = 12
1539  self.assertEqual(p.a.value(),12)
1540  self.assertEqual(v.value(),12)
def testParameterizable(self)
Definition: Config.py:1508
def Config.TestModuleCommand.testPath (   self)

Definition at line 2186 of file Config.py.

References SequenceTypes.ignore(), and harvestTrackValidationPlots.str.

2186  def testPath(self):
2187  p = Process("test")
2188  p.a = EDAnalyzer("MyAnalyzer")
2189  p.b = EDAnalyzer("YourAnalyzer")
2190  p.c = EDAnalyzer("OurAnalyzer")
2191  path = Path(p.a)
2192  path *= p.b
2193  path += p.c
2194  self.assertEqual(str(path),'a+b+c')
2195  path = Path(p.a*p.b+p.c)
2196  self.assertEqual(str(path),'a+b+c')
2197 # path = Path(p.a)*p.b+p.c #This leads to problems with sequences
2198 # self.assertEqual(str(path),'((a*b)+c)')
2199  path = Path(p.a+ p.b*p.c)
2200  self.assertEqual(str(path),'a+b+c')
2201  path = Path(p.a*(p.b+p.c))
2202  self.assertEqual(str(path),'a+b+c')
2203  path = Path(p.a*(p.b+~p.c))
2204  pathx = Path(p.a*(p.b+ignore(p.c)))
2205  self.assertEqual(str(path),'a+b+~c')
2206  p.es = ESProducer("AnESProducer")
2207  self.assertRaises(TypeError,Path,p.es)
2208 
2209  t = Path()
2210  self.assertTrue(t.dumpPython(PrintOptions()) == 'cms.Path()\n')
2211 
2212  t = Path(p.a)
2213  self.assertTrue(t.dumpPython(PrintOptions()) == 'cms.Path(process.a)\n')
2214 
2215  t = Path(Task())
2216  self.assertTrue(t.dumpPython(PrintOptions()) == 'cms.Path(cms.Task())\n')
2217 
2218  t = Path(p.a, Task())
2219  self.assertTrue(t.dumpPython(PrintOptions()) == 'cms.Path(process.a, cms.Task())\n')
2220 
2221  p.prod = EDProducer("prodName")
2222  p.t1 = Task(p.prod)
2223  t = Path(p.a, p.t1, Task(), p.t1)
2224  self.assertTrue(t.dumpPython(PrintOptions()) == 'cms.Path(process.a, cms.Task(), process.t1)\n')
2225 
def ignore(seq)
def Config.TestModuleCommand.testPrefers (   self)

Definition at line 2422 of file Config.py.

2422  def testPrefers(self):
2423  p = Process("Test")
2424  p.add_(ESSource("ForceSource"))
2425  p.juicer = ESProducer("JuicerProducer")
2426  p.prefer("ForceSource")
2427  p.prefer("juicer")
2428  self.assertEqual(p.dumpConfig(),
2429 """process Test = {
2430  es_module juicer = JuicerProducer {
2431  }
2432  es_source = ForceSource {
2433  }
2434  es_prefer = ForceSource {
2435  }
2436  es_prefer juicer = JuicerProducer {
2437  }
2438 }
2439 """)
2440  p.prefer("juicer",fooRcd=vstring("Foo"))
2441  self.assertEqual(p.dumpConfig(),
2442 """process Test = {
2443  es_module juicer = JuicerProducer {
2444  }
2445  es_source = ForceSource {
2446  }
2447  es_prefer = ForceSource {
2448  }
2449  es_prefer juicer = JuicerProducer {
2450  vstring fooRcd = {
2451  'Foo'
2452  }
2453 
2454  }
2455 }
2456 """)
2457  self.assertEqual(p.dumpPython(),
2458 """import FWCore.ParameterSet.Config as cms
2459 
2460 process = cms.Process("Test")
2461 
2462 process.juicer = cms.ESProducer("JuicerProducer")
2463 
2464 
2465 process.ForceSource = cms.ESSource("ForceSource")
2466 
2467 
2468 process.prefer("ForceSource")
2469 
2470 process.prefer("juicer",
2471  fooRcd = cms.vstring('Foo')
2472 )
2473 
2474 """)
2475 
def Config.TestModuleCommand.testProcessDumpPython (   self)

Definition at line 1643 of file Config.py.

1644  p = Process("test")
1645  p.a = EDAnalyzer("MyAnalyzer")
1646  p.p = Path(p.a)
1647  p.s = Sequence(p.a)
1648  p.r = Sequence(p.s)
1649  p.p2 = Path(p.s)
1650  p.schedule = Schedule(p.p2,p.p)
1651  d=p.dumpPython()
1652  self.assertEqual(d,
1653 """import FWCore.ParameterSet.Config as cms
1654 
1655 process = cms.Process("test")
1656 
1657 process.a = cms.EDAnalyzer("MyAnalyzer")
1658 
1659 
1660 process.s = cms.Sequence(process.a)
1661 
1662 
1663 process.r = cms.Sequence(process.s)
1664 
1665 
1666 process.p = cms.Path(process.a)
1667 
1668 
1669 process.p2 = cms.Path(process.s)
1670 
1671 
1672 process.schedule = cms.Schedule(*[ process.p2, process.p ])
1673 """)
1674  #Reverse order of 'r' and 's'
1675  p = Process("test")
1676  p.a = EDAnalyzer("MyAnalyzer")
1677  p.p = Path(p.a)
1678  p.r = Sequence(p.a)
1679  p.s = Sequence(p.r)
1680  p.p2 = Path(p.r)
1681  p.schedule = Schedule(p.p2,p.p)
1682  p.b = EDAnalyzer("YourAnalyzer")
1683  d=p.dumpPython()
1684  self.assertEqual(d,
1685 """import FWCore.ParameterSet.Config as cms
1686 
1687 process = cms.Process("test")
1688 
1689 process.a = cms.EDAnalyzer("MyAnalyzer")
1690 
1691 
1692 process.b = cms.EDAnalyzer("YourAnalyzer")
1693 
1694 
1695 process.r = cms.Sequence(process.a)
1696 
1697 
1698 process.s = cms.Sequence(process.r)
1699 
1700 
1701 process.p = cms.Path(process.a)
1702 
1703 
1704 process.p2 = cms.Path(process.r)
1705 
1706 
1707 process.schedule = cms.Schedule(*[ process.p2, process.p ])
1708 """)
def testProcessDumpPython(self)
Definition: Config.py:1643
def Config.TestModuleCommand.testProcessExtend (   self)

Definition at line 1573 of file Config.py.

References resolutioncreator_cfi.object, and harvestTrackValidationPlots.str.

1574  class FromArg(object):
1575  def __init__(self,*arg,**args):
1576  for name in args.iterkeys():
1577  self.__dict__[name]=args[name]
1578 
1579  a=EDAnalyzer("MyAnalyzer")
1580  t=EDAnalyzer("MyAnalyzer")
1581  t.setLabel("foo")
1582  s1 = Sequence(a)
1583  s2 = Sequence(s1)
1584  s3 = Sequence(s2)
1585  d = FromArg(
1586  a=a,
1587  b=Service("Full"),
1588  c=Path(a),
1589  d=s2,
1590  e=s1,
1591  f=s3,
1592  g=Sequence(s1+s2+s3)
1593  )
1594  p = Process("Test")
1595  p.extend(d)
1596  self.assertEqual(p.a.type_(),"MyAnalyzer")
1597  self.assertEqual(p.a.label_(),"a")
1598  self.assertRaises(AttributeError,getattr,p,'b')
1599  self.assertEqual(p.Full.type_(),"Full")
1600  self.assertEqual(str(p.c),'a')
1601  self.assertEqual(str(p.d),'a')
1602 
1603  z1 = FromArg(
1604  a=a,
1605  b=Service("Full"),
1606  c=Path(a),
1607  d=s2,
1608  e=s1,
1609  f=s3,
1610  s4=s3,
1611  g=Sequence(s1+s2+s3)
1612  )
1613 
1614  p1 = Process("Test")
1615  #p1.extend(z1)
1616  self.assertRaises(ValueError, p1.extend, z1)
1617 
1618  z2 = FromArg(
1619  a=a,
1620  b=Service("Full"),
1621  c=Path(a),
1622  d=s2,
1623  e=s1,
1624  f=s3,
1625  aaa=copy.deepcopy(a),
1626  s4=copy.deepcopy(s3),
1627  g=Sequence(s1+s2+s3),
1628  t=t
1629  )
1630  p2 = Process("Test")
1631  p2.extend(z2)
1632  #self.assertRaises(ValueError, p2.extend, z2)
1633  self.assertEqual(p2.s4.label_(),"s4")
1634  #p2.s4.setLabel("foo")
1635  self.assertRaises(ValueError, p2.s4.setLabel, "foo")
1636  p2.s4.setLabel("s4")
1637  p2.s4.setLabel(None)
1638  p2.s4.setLabel("foo")
1639  p2._Process__setObjectLabel(p2.s4, "foo")
1640  p2._Process__setObjectLabel(p2.s4, None)
1641  p2._Process__setObjectLabel(p2.s4, "bar")
1642 
def testProcessExtend(self)
Definition: Config.py:1573
def Config.TestModuleCommand.testProcessInsertion (   self)

Definition at line 1548 of file Config.py.

1549  p = Process("test")
1550  p.a = EDAnalyzer("MyAnalyzer")
1551  self.assert_( 'a' in p.analyzers_() )
1552  self.assert_( 'a' in p.analyzers)
1553  p.add_(Service("MessageLogger"))
1554  self.assert_('MessageLogger' in p.services_())
1555  self.assertEqual(p.MessageLogger.type_(), "MessageLogger")
1556  p.Tracer = Service("Tracer")
1557  self.assert_('Tracer' in p.services_())
1558  self.assertRaises(TypeError, setattr, *(p,'b',"this should fail"))
1559  self.assertRaises(TypeError, setattr, *(p,'bad',Service("MessageLogger")))
1560  self.assertRaises(ValueError, setattr, *(p,'bad',Source("PoolSource")))
1561  p.out = OutputModule("Outer")
1562  self.assertEqual(p.out.type_(), 'Outer')
1563  self.assert_( 'out' in p.outputModules_() )
1564 
1565  p.geom = ESSource("GeomProd")
1566  self.assert_('geom' in p.es_sources_())
1567  p.add_(ESSource("ConfigDB"))
1568  self.assert_('ConfigDB' in p.es_sources_())
1569 
1570  p.aliasfoo1 = EDAlias(foo1 = VPSet(PSet(type = string("Foo1"))))
1571  self.assert_('aliasfoo1' in p.aliases_())
1572 
def testProcessInsertion(self)
Definition: Config.py:1548
def Config.TestModuleCommand.testPrune (   self)

Definition at line 2550 of file Config.py.

2550  def testPrune(self):
2551  p = Process("test")
2552  p.a = EDAnalyzer("MyAnalyzer")
2553  p.b = EDAnalyzer("YourAnalyzer")
2554  p.c = EDAnalyzer("OurAnalyzer")
2555  p.d = EDAnalyzer("OurAnalyzer")
2556  p.s = Sequence(p.d)
2557  p.path1 = Path(p.a)
2558  p.path2 = Path(p.b)
2559  self.assert_(p.schedule is None)
2560  pths = p.paths
2561  keys = pths.keys()
2562  self.assertEqual(pths[keys[0]],p.path1)
2563  self.assertEqual(pths[keys[1]],p.path2)
2564  p.pset1 = PSet(parA = string("pset1"))
2565  p.pset2 = untracked.PSet(parA = string("pset2"))
2566  p.vpset1 = VPSet()
2567  p.vpset2 = untracked.VPSet()
2568  p.prune()
2569  self.assert_(hasattr(p, 'a'))
2570  self.assert_(hasattr(p, 'b'))
2571  self.assert_(not hasattr(p, 'c'))
2572  self.assert_(not hasattr(p, 'd'))
2573  self.assert_(not hasattr(p, 's'))
2574  self.assert_(hasattr(p, 'path1'))
2575  self.assert_(hasattr(p, 'path2'))
2576 # self.assert_(not hasattr(p, 'pset1'))
2577 # self.assert_(hasattr(p, 'pset2'))
2578 # self.assert_(not hasattr(p, 'vpset1'))
2579 # self.assert_(not hasattr(p, 'vpset2'))
2580 
2581  p = Process("test")
2582  p.a = EDAnalyzer("MyAnalyzer")
2583  p.b = EDAnalyzer("YourAnalyzer")
2584  p.c = EDAnalyzer("OurAnalyzer")
2585  p.d = EDAnalyzer("OurAnalyzer")
2586  p.e = EDAnalyzer("OurAnalyzer")
2587  p.s = Sequence(p.d)
2588  p.s2 = Sequence(p.b)
2589  p.s3 = Sequence(p.e)
2590  p.path1 = Path(p.a)
2591  p.path2 = Path(p.b)
2592  p.path3 = Path(p.b+p.s2)
2593  p.path4 = Path(p.b+p.s3)
2594  p.schedule = Schedule(p.path1,p.path2,p.path3)
2595  pths = p.paths
2596  keys = pths.keys()
2597  self.assertEqual(pths[keys[0]],p.path1)
2598  self.assertEqual(pths[keys[1]],p.path2)
2599  p.prune()
2600  self.assert_(hasattr(p, 'a'))
2601  self.assert_(hasattr(p, 'b'))
2602  self.assert_(not hasattr(p, 'c'))
2603  self.assert_(not hasattr(p, 'd'))
2604  self.assert_(not hasattr(p, 'e'))
2605  self.assert_(not hasattr(p, 's'))
2606  self.assert_(hasattr(p, 's2'))
2607  self.assert_(not hasattr(p, 's3'))
2608  self.assert_(hasattr(p, 'path1'))
2609  self.assert_(hasattr(p, 'path2'))
2610  self.assert_(hasattr(p, 'path3'))
2611  self.assert_(not hasattr(p, 'path4'))
2612  #test SequencePlaceholder
2613  p = Process("test")
2614  p.a = EDAnalyzer("MyAnalyzer")
2615  p.b = EDAnalyzer("YourAnalyzer")
2616  p.s = Sequence(SequencePlaceholder("a")+p.b)
2617  p.pth = Path(p.s)
2618  p.prune()
2619  self.assert_(hasattr(p, 'a'))
2620  self.assert_(hasattr(p, 'b'))
2621  self.assert_(hasattr(p, 's'))
2622  self.assert_(hasattr(p, 'pth'))
2623  #test unresolved SequencePlaceholder
2624  p = Process("test")
2625  p.b = EDAnalyzer("YourAnalyzer")
2626  p.s = Sequence(SequencePlaceholder("a")+p.b)
2627  p.pth = Path(p.s)
2628  p.prune(keepUnresolvedSequencePlaceholders=True)
2629  self.assert_(hasattr(p, 'b'))
2630  self.assert_(hasattr(p, 's'))
2631  self.assert_(hasattr(p, 'pth'))
2632  self.assertEqual(p.s.dumpPython(''),'cms.Sequence(cms.SequencePlaceholder("a")+process.b)\n')
def Config.TestModuleCommand.testRefToPSet (   self)

Definition at line 2534 of file Config.py.

2534  def testRefToPSet(self):
2535  proc = Process("test")
2536  proc.top = PSet(a = int32(1))
2537  proc.ref = PSet(refToPSet_ = string("top"))
2538  proc.ref2 = PSet( a = int32(1), b = PSet( refToPSet_ = string("top")))
2539  proc.ref3 = PSet(refToPSet_ = string("ref"))
2540  proc.ref4 = VPSet(PSet(refToPSet_ = string("top")),
2541  PSet(refToPSet_ = string("ref2")))
2542  p = TestMakePSet()
2543  proc.fillProcessDesc(p)
2544  self.assertEqual((True,1),p.values["ref"][1].values["a"])
2545  self.assertEqual((True,1),p.values["ref3"][1].values["a"])
2546  self.assertEqual((True,1),p.values["ref2"][1].values["a"])
2547  self.assertEqual((True,1),p.values["ref2"][1].values["b"][1].values["a"])
2548  self.assertEqual((True,1),p.values["ref4"][1][0].values["a"])
2549  self.assertEqual((True,1),p.values["ref4"][1][1].values["a"])
def testRefToPSet(self)
Definition: Config.py:2534
def Config.TestModuleCommand.testSchedule (   self)

Definition at line 2242 of file Config.py.

References list().

2242  def testSchedule(self):
2243  p = Process("test")
2244  p.a = EDAnalyzer("MyAnalyzer")
2245  p.b = EDAnalyzer("YourAnalyzer")
2246  p.c = EDAnalyzer("OurAnalyzer")
2247  p.d = EDAnalyzer("OurAnalyzer")
2248  p.path1 = Path(p.a)
2249  p.path2 = Path(p.b)
2250  p.path3 = Path(p.d)
2251 
2252  s = Schedule(p.path1,p.path2)
2253  self.assertEqual(s[0],p.path1)
2254  self.assertEqual(s[1],p.path2)
2255  p.schedule = s
2256  self.assert_('b' in p.schedule.moduleNames())
2257  self.assert_(hasattr(p, 'b'))
2258  self.assert_(hasattr(p, 'c'))
2259  self.assert_(hasattr(p, 'd'))
2260  self.assert_(hasattr(p, 'path1'))
2261  self.assert_(hasattr(p, 'path2'))
2262  self.assert_(hasattr(p, 'path3'))
2263  p.prune()
2264  self.assert_('b' in p.schedule.moduleNames())
2265  self.assert_(hasattr(p, 'b'))
2266  self.assert_(not hasattr(p, 'c'))
2267  self.assert_(not hasattr(p, 'd'))
2268  self.assert_(hasattr(p, 'path1'))
2269  self.assert_(hasattr(p, 'path2'))
2270  self.assert_(not hasattr(p, 'path3'))
2271 
2272  self.assertTrue(len(p.schedule._tasks) == 0)
2273 
2274  p = Process("test")
2275  p.a = EDAnalyzer("MyAnalyzer")
2276  p.b = EDAnalyzer("YourAnalyzer")
2277  p.c = EDAnalyzer("OurAnalyzer")
2278  p.d = EDAnalyzer("dAnalyzer")
2279  p.e = EDProducer("eProducer")
2280  p.f = EDProducer("fProducer")
2281  p.Tracer = Service("Tracer")
2282  p.path1 = Path(p.a)
2283  p.path2 = Path(p.b)
2284  p.path3 = Path(p.d)
2285  p.task1 = Task(p.e)
2286  p.task2 = Task(p.f, p.Tracer)
2287  s = Schedule(p.path1,p.path2,tasks=[p.task1,p.task2,p.task1])
2288  self.assertEqual(s[0],p.path1)
2289  self.assertEqual(s[1],p.path2)
2290  self.assertTrue(len(s._tasks) == 2)
2291  self.assertTrue(p.task1 in s._tasks)
2292  self.assertTrue(p.task2 in s._tasks)
2293  listOfTasks = list(s._tasks)
2294  self.assertTrue(len(listOfTasks) == 2)
2295  self.assertTrue(p.task1 == listOfTasks[0])
2296  self.assertTrue(p.task2 == listOfTasks[1])
2297  p.schedule = s
2298  self.assert_('b' in p.schedule.moduleNames())
2299 
2300  process2 = Process("test")
2301  process2.a = EDAnalyzer("MyAnalyzer")
2302  process2.e = EDProducer("eProducer")
2303  process2.path1 = Path(process2.a)
2304  process2.task1 = Task(process2.e)
2305  process2.schedule = Schedule(process2.path1,tasks=process2.task1)
2306  listOfTasks = list(process2.schedule._tasks)
2307  self.assertTrue(listOfTasks[0] == process2.task1)
2308 
2309  # test Schedule copy
2310  s2 = s.copy()
2311  self.assertEqual(s2[0],p.path1)
2312  self.assertEqual(s2[1],p.path2)
2313  self.assertTrue(len(s2._tasks) == 2)
2314  self.assertTrue(p.task1 in s2._tasks)
2315  self.assertTrue(p.task2 in s2._tasks)
2316  listOfTasks = list(s2._tasks)
2317  self.assertTrue(len(listOfTasks) == 2)
2318  self.assertTrue(p.task1 == listOfTasks[0])
2319  self.assertTrue(p.task2 == listOfTasks[1])
2320 
2321  names = s.moduleNames()
2322  self.assertTrue(names == set(['a', 'b', 'e', 'Tracer', 'f']))
2323  #adding a path not attached to the Process should cause an exception
2324  p = Process("test")
2325  p.a = EDAnalyzer("MyAnalyzer")
2326  path1 = Path(p.a)
2327  s = Schedule(path1)
2328  self.assertRaises(RuntimeError, lambda : p.setSchedule_(s) )
2329 
2330  #make sure anonymous sequences work
2331  p = Process("test")
2332  p.a = EDAnalyzer("MyAnalyzer")
2333  p.b = EDAnalyzer("MyOtherAnalyzer")
2334  p.c = EDProducer("MyProd")
2335  path1 = Path(p.c*Sequence(p.a+p.b))
2336  s = Schedule(path1)
2337  self.assert_('a' in s.moduleNames())
2338  self.assert_('b' in s.moduleNames())
2339  self.assert_('c' in s.moduleNames())
2340  p.path1 = path1
2341  p.schedule = s
2342  p.prune()
2343  self.assert_('a' in s.moduleNames())
2344  self.assert_('b' in s.moduleNames())
2345  self.assert_('c' in s.moduleNames())
2346 
def testSchedule(self)
Definition: Config.py:2242
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 1898 of file Config.py.

References python.rootplot.root2matplotlib.replace().

1898  def testSecSource(self):
1899  p = Process('test')
1900  p.a = SecSource("MySecSource")
1901  self.assertEqual(p.dumpPython().replace('\n',''),'import FWCore.ParameterSet.Config as cmsprocess = cms.Process("test")process.a = cms.SecSource("MySecSource")')
1902 
def replace(string, replacements)
def testSecSource(self)
Definition: Config.py:1898
def Config.TestModuleCommand.testSequence (   self)

Definition at line 1948 of file Config.py.

References harvestTrackValidationPlots.str.

1948  def testSequence(self):
1949  p = Process('test')
1950  p.a = EDAnalyzer("MyAnalyzer")
1951  p.b = EDAnalyzer("YourAnalyzer")
1952  p.c = EDAnalyzer("OurAnalyzer")
1953  p.s = Sequence(p.a*p.b)
1954  self.assertEqual(str(p.s),'a+b')
1955  self.assertEqual(p.s.label_(),'s')
1956  path = Path(p.c+p.s)
1957  self.assertEqual(str(path),'c+a+b')
1958  p._validateSequence(path, 'p1')
1959  notInProcess = EDAnalyzer('NotInProcess')
1960  p2 = Path(p.c+p.s*notInProcess)
1961  self.assertRaises(RuntimeError, p._validateSequence, p2, 'p2')
1962 
def testSequence(self)
Definition: Config.py:1948
def Config.TestModuleCommand.testSequence2 (   self)

Definition at line 1963 of file Config.py.

1963  def testSequence2(self):
1964  p = Process('test')
1965  p.a = EDAnalyzer("MyAnalyzer")
1966  p.b = EDAnalyzer("YourAnalyzer")
1967  p.c = EDAnalyzer("OurAnalyzer")
1968  testseq = Sequence(p.a*p.b)
1969  p.s = testseq
1970  #p.y = testseq
1971  self.assertRaises(ValueError, p.__setattr__, "y", testseq)
1972 
def testSequence2(self)
Definition: Config.py:1963
def Config.TestModuleCommand.testServiceInProcess (   self)

Definition at line 1973 of file Config.py.

1974  service = Service("d")
1975  self.assertFalse(service._inProcess)
1976  process = Process("test")
1977  process.d = service
1978  self.assertTrue(service._inProcess)
1979  service2 = Service("d")
1980  process.d = service2
1981  self.assertFalse(service._inProcess)
1982  self.assertTrue(service2._inProcess)
1983  del process.d
1984  self.assertFalse(service2._inProcess)
1985 
def testServiceInProcess(self)
Definition: Config.py:1973
def Config.TestModuleCommand.testSubProcess (   self)

Definition at line 2494 of file Config.py.

References cond.hash, and harvestTrackValidationPlots.str.

2494  def testSubProcess(self):
2495  process = Process("Parent")
2496  subProcess = Process("Child")
2497  subProcess.a = EDProducer("A")
2498  subProcess.p = Path(subProcess.a)
2499  subProcess.add_(Service("Foo"))
2500  process.addSubProcess(SubProcess(subProcess))
2501  d = process.dumpPython()
2502  equalD ="""import FWCore.ParameterSet.Config as cms
2503 
2504 process = cms.Process("Parent")
2505 
2506 parentProcess = process
2507 import FWCore.ParameterSet.Config as cms
2508 
2509 process = cms.Process("Child")
2510 
2511 process.a = cms.EDProducer("A")
2512 
2513 
2514 process.Foo = cms.Service("Foo")
2515 
2516 
2517 process.p = cms.Path(process.a)
2518 
2519 
2520 childProcess = process
2521 process = parentProcess
2522 process.addSubProcess(cms.SubProcess(process = childProcess, SelectEvents = cms.untracked.PSet(
2523 
2524 ), outputCommands = cms.untracked.vstring()))
2525 
2526 """
2527  equalD = equalD.replace("parentProcess","parentProcess"+str(hash(process.subProcesses_()[0])))
2528  self.assertEqual(d,equalD)
2529  p = TestMakePSet()
2530  process.fillProcessDesc(p)
2531  self.assertEqual((True,['a']),p.values["subProcesses"][1][0].values["process"][1].values['@all_modules'])
2532  self.assertEqual((True,['p']),p.values["subProcesses"][1][0].values["process"][1].values['@paths'])
2533  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:2494
def Config.TestModuleCommand.testTask (   self)

Definition at line 1986 of file Config.py.

References list().

1986  def testTask(self):
1987 
1988  # create some objects to use in tests
1989  edanalyzer = EDAnalyzer("a")
1990  edproducer = EDProducer("b")
1991  edproducer2 = EDProducer("b2")
1992  edproducer3 = EDProducer("b3")
1993  edproducer4 = EDProducer("b4")
1994  edproducer8 = EDProducer("b8")
1995  edproducer9 = EDProducer("b9")
1996  edfilter = EDFilter("c")
1997  service = Service("d")
1998  service3 = Service("d")
1999  essource = ESSource("e")
2000  esproducer = ESProducer("f")
2001  testTask2 = Task()
2002 
2003  # test adding things to Tasks
2004  testTask1 = Task(edproducer, edfilter)
2005  self.assertRaises(RuntimeError, testTask1.add, edanalyzer)
2006  testTask1.add(essource, service)
2007  testTask1.add(essource, esproducer)
2008  testTask1.add(testTask2)
2009  coll = testTask1._collection
2010  self.assertTrue(edproducer in coll)
2011  self.assertTrue(edfilter in coll)
2012  self.assertTrue(service in coll)
2013  self.assertTrue(essource in coll)
2014  self.assertTrue(esproducer in coll)
2015  self.assertTrue(testTask2 in coll)
2016  self.assertTrue(len(coll) == 6)
2017  self.assertTrue(len(testTask2._collection) == 0)
2018 
2019  taskContents = []
2020  for i in testTask1:
2021  taskContents.append(i)
2022  self.assertTrue(taskContents == [edproducer, edfilter, essource, service, esproducer, testTask2])
2023 
2024  # test attaching Task to Process
2025  process = Process("test")
2026 
2027  process.mproducer = edproducer
2028  process.mproducer2 = edproducer2
2029  process.mfilter = edfilter
2030  process.messource = essource
2031  process.mesproducer = esproducer
2032  process.d = service
2033 
2034  testTask3 = Task(edproducer, edproducer2)
2035  testTask1.add(testTask3)
2036  process.myTask1 = testTask1
2037 
2038  # test the validation that occurs when attaching a Task to a Process
2039  # first a case that passes, then one the fails on an EDProducer
2040  # then one that fails on a service
2041  l = set()
2042  visitor = NodeNameVisitor(l)
2043  testTask1.visit(visitor)
2044  self.assertTrue(l == set(['mesproducer', 'mproducer', 'mproducer2', 'mfilter', 'd', 'messource']))
2045  l2 = testTask1.moduleNames
2046  self.assertTrue(l == set(['mesproducer', 'mproducer', 'mproducer2', 'mfilter', 'd', 'messource']))
2047 
2048  testTask4 = Task(edproducer3)
2049  l.clear()
2050  self.assertRaises(RuntimeError, testTask4.visit, visitor)
2051  try:
2052  process.myTask4 = testTask4
2053  self.assertTrue(False)
2054  except RuntimeError:
2055  pass
2056 
2057  testTask5 = Task(service3)
2058  l.clear()
2059  self.assertRaises(RuntimeError, testTask5.visit, visitor)
2060  try:
2061  process.myTask5 = testTask5
2062  self.assertTrue(False)
2063  except RuntimeError:
2064  pass
2065 
2066  process.d = service3
2067  process.myTask5 = testTask5
2068 
2069  # test placement into the Process and the tasks property
2070  expectedDict = { 'myTask1' : testTask1, 'myTask5' : testTask5 }
2071  expectedFixedDict = DictTypes.FixedKeysDict(expectedDict);
2072  self.assertTrue(process.tasks == expectedFixedDict)
2073  self.assertTrue(process.tasks['myTask1'] == testTask1)
2074  self.assertTrue(process.myTask1 == testTask1)
2075 
2076  # test replacing an EDProducer in a Task when calling __settattr__
2077  # for the EDProducer on the Process.
2078  process.mproducer2 = edproducer4
2079  process.d = service
2080  l = list()
2081  visitor1 = ModuleNodeVisitor(l)
2082  testTask1.visit(visitor1)
2083  l.sort()
2084  expectedList = [edproducer,essource,esproducer,service,edfilter,edproducer,edproducer4]
2085  expectedList.sort()
2086  self.assertTrue(expectedList == l)
2087 
2088  process.myTask6 = Task()
2089  process.myTask7 = Task()
2090  process.mproducer8 = edproducer8
2091  process.myTask8 = Task(process.mproducer8)
2092  process.myTask6.add(process.myTask7)
2093  process.myTask7.add(process.myTask8)
2094  process.myTask1.add(process.myTask6)
2095  process.myTask8.add(process.myTask5)
2096 
2097  testDict = process._itemsInDependencyOrder(process.tasks)
2098  expectedLabels = ["myTask5", "myTask8", "myTask7", "myTask6", "myTask1"]
2099  expectedTasks = [process.myTask5, process.myTask8, process.myTask7, process.myTask6, process.myTask1]
2100  index = 0
2101  for testLabel, testTask in testDict.items():
2102  self.assertTrue(testLabel == expectedLabels[index])
2103  self.assertTrue(testTask == expectedTasks[index])
2104  index += 1
2105 
2106  pythonDump = testTask1.dumpPython(PrintOptions())
2107 
2108 
2109  expectedPythonDump = 'cms.Task(process.d, process.mesproducer, process.messource, process.mfilter, process.mproducer, process.mproducer2, process.myTask6)\n'
2110  self.assertTrue(pythonDump == expectedPythonDump)
2111 
2112  process.myTask5 = Task()
2113  process.myTask100 = Task()
2114  process.mproducer9 = edproducer9
2115  sequence1 = Sequence(process.mproducer8, process.myTask1, process.myTask5, testTask2, testTask3)
2116  sequence2 = Sequence(process.mproducer8 + process.mproducer9)
2117  process.sequence3 = Sequence((process.mproducer8 + process.mfilter))
2118  sequence4 = Sequence()
2119  process.path1 = Path(process.mproducer+process.mproducer8+sequence1+sequence2+process.sequence3+sequence4)
2120  process.path1.associate(process.myTask1, process.myTask5, testTask2, testTask3)
2121  process.path11 = Path(process.mproducer+process.mproducer8+sequence1+sequence2+process.sequence3+ sequence4,process.myTask1, process.myTask5, testTask2, testTask3, process.myTask100)
2122  process.path2 = Path(process.mproducer)
2123  process.path3 = Path(process.mproducer9+process.mproducer8,testTask2)
2124 
2125  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')
2126 
2127  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')
2128 
2129  # test NodeNameVisitor and moduleNames
2130  l = set()
2131  nameVisitor = NodeNameVisitor(l)
2132  process.path1.visit(nameVisitor)
2133  self.assertTrue(l == set(['mproducer', 'd', 'mesproducer', None, 'mproducer9', 'mproducer8', 'messource', 'mproducer2', 'mfilter']))
2134  self.assertTrue(process.path1.moduleNames() == set(['mproducer', 'd', 'mesproducer', None, 'mproducer9', 'mproducer8', 'messource', 'mproducer2', 'mfilter']))
2135 
2136  # test copy
2137  process.mproducer10 = EDProducer("b10")
2138  process.path21 = process.path11.copy()
2139  process.path21.replace(process.mproducer, process.mproducer10)
2140 
2141  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')
2142 
2143  # Some peculiarities of the way things work show up here. dumpPython sorts tasks and
2144  # removes duplication at the level of strings. The Task and Sequence objects themselves
2145  # remove duplicate tasks in their contents if the instances are the same (exact same python
2146  # object id which is not the same as the string representation being the same).
2147  # Also note that the mutating visitor replaces sequences and tasks that have
2148  # modified contents with their modified contents, it does not modify the sequence
2149  # or task itself.
2150  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')
2151 
2152  process.path22 = process.path21.copyAndExclude([process.d, process.mesproducer, process.mfilter])
2153  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')
2154 
2155  process.path23 = process.path22.copyAndExclude([process.messource, process.mproducer10])
2156  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')
2157 
2158  process.a = EDAnalyzer("MyAnalyzer")
2159  process.b = OutputModule("MyOutputModule")
2160  process.c = EDFilter("MyFilter")
2161  process.d = EDProducer("MyProducer")
2162  process.e = ESProducer("MyESProducer")
2163  process.f = ESSource("MyESSource")
2164  process.g = ESProducer("g")
2165  process.path24 = Path(process.a+process.b+process.c+process.d)
2166  process.path25 = process.path24.copyAndExclude([process.a,process.b,process.c])
2167  self.assertTrue(process.path25.dumpPython(None) == 'cms.Path(process.d)\n')
2168  #print process.path3
2169  #print process.dumpPython()
2170 
2171  process.path200 = EndPath(Sequence(process.c,Task(process.e)))
2172  process.path200.replace(process.c,process.b)
2173  process.path200.replace(process.e,process.f)
2174  self.assertEqual(process.path200.dumpPython(None), "cms.EndPath(process.b, cms.Task(process.f))\n")
2175  process.path200.replace(process.b,process.c)
2176  process.path200.replace(process.f,process.e)
2177  self.assertEqual(process.path200.dumpPython(None), "cms.EndPath(process.c, cms.Task(process.e))\n")
2178  process.path200.replace(process.c,process.a)
2179  process.path200.replace(process.e,process.g)
2180  self.assertEqual(process.path200.dumpPython(None), "cms.EndPath(process.a, cms.Task(process.g))\n")
2181  process.path200.replace(process.a,process.c)
2182  process.path200.replace(process.g,process.e)
2183  self.assertEqual(process.path200.dumpPython(None), "cms.EndPath(process.c, cms.Task(process.e))\n")
2184 
2185 
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.testTypedParameterizable (   self)

Definition at line 1541 of file Config.py.

1542  p = _TypedParameterizable("blah", b=int32(1))
1543  #see if copy works deeply
1544  other = p.copy()
1545  other.b = 2
1546  self.assertNotEqual(p.b,other.b)
1547 
def testTypedParameterizable(self)
Definition: Config.py:1541
def Config.TestModuleCommand.testUsing (   self)

Definition at line 2380 of file Config.py.

2380  def testUsing(self):
2381  p = Process('test')
2382  p.block = PSet(a = int32(1))
2383  p.modu = EDAnalyzer('Analyzer', p.block, b = int32(2))
2384  self.assertEqual(p.modu.a.value(),1)
2385  self.assertEqual(p.modu.b.value(),2)
2386 

Member Data Documentation

Config.TestModuleCommand.a

Definition at line 2762 of file Config.py.

Config.TestModuleCommand.proc_mod_

Definition at line 2759 of file Config.py.