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

Public Attributes

 a
 
 proc_mod_
 

Detailed Description

Definition at line 1508 of file Config.py.

Member Function Documentation

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

Definition at line 1509 of file Config.py.

1509  def setUp(self):
1510  """Nothing to do """
1511  None
def Config.TestModuleCommand.testCloneSequence (   self)

Definition at line 2230 of file Config.py.

References triggerObjects_cff.id, and harvestTrackValidationPlots.str.

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

Definition at line 2796 of file Config.py.

References ConfigBuilder.dumpPython().

2796  def testDelete(self):
2797  p = Process("test")
2798  p.a = EDAnalyzer("MyAnalyzer")
2799  p.b = EDAnalyzer("YourAnalyzer")
2800  p.c = EDAnalyzer("OurAnalyzer")
2801  p.d = EDAnalyzer("OurAnalyzer")
2802  p.e = EDAnalyzer("OurAnalyzer")
2803  p.f = EDAnalyzer("OurAnalyzer")
2804  p.g = EDProducer("OurProducer")
2805  p.h = EDProducer("YourProducer")
2806  p.t1 = Task(p.g, p.h)
2807  t2 = Task(p.g, p.h)
2808  t3 = Task(p.g, p.h)
2809  p.s = Sequence(p.d+p.e)
2810  p.path1 = Path(p.a+p.f+p.s,t2)
2811  p.endpath1 = EndPath(p.b+p.f)
2812  p.schedule = Schedule(tasks=[t3])
2813  self.assertTrue(hasattr(p, 'f'))
2814  self.assertTrue(hasattr(p, 'g'))
2815  del p.e
2816  del p.f
2817  del p.g
2818  self.assertFalse(hasattr(p, 'f'))
2819  self.assertFalse(hasattr(p, 'g'))
2820  self.assertTrue(p.t1.dumpPython(None) == 'cms.Task(process.h)\n')
2821  self.assertTrue(p.s.dumpPython(None) == 'cms.Sequence(process.d)\n')
2822  self.assertTrue(p.path1.dumpPython(None) == 'cms.Path(process.a+process.s, cms.Task(process.h))\n')
2823  self.assertTrue(p.endpath1.dumpPython(None) == 'cms.EndPath(process.b)\n')
2824  del p.s
2825  self.assertTrue(p.path1.dumpPython(None) == 'cms.Path(process.a+(process.d), cms.Task(process.h))\n')
2826  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 2414 of file Config.py.

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

Definition at line 2480 of file Config.py.

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

Definition at line 1907 of file Config.py.

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

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

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

Definition at line 2827 of file Config.py.

References cmsPerfStripChart.dict, and resolutioncreator_cfi.object.

2827  def testModifier(self):
2828  m1 = Modifier()
2829  p = Process("test",m1)
2830  p.a = EDAnalyzer("MyAnalyzer", fred = int32(1))
2831  def _mod_fred(obj):
2832  obj.fred = 2
2833  m1.toModify(p.a,_mod_fred)
2834  self.assertEqual(p.a.fred.value(),2)
2835  p.b = EDAnalyzer("YourAnalyzer", wilma = int32(1))
2836  m1.toModify(p.b, wilma = 2)
2837  self.assertEqual(p.b.wilma.value(),2)
2838  self.assert_(p.isUsingModifier(m1))
2839  #check that Modifier not attached to a process doesn't run
2840  m1 = Modifier()
2841  p = Process("test")
2842  p.a = EDAnalyzer("MyAnalyzer", fred = int32(1))
2843  m1.toModify(p.a,_mod_fred)
2844  p.b = EDAnalyzer("YourAnalyzer", wilma = int32(1))
2845  m1.toModify(p.b, wilma = 2)
2846  self.assertEqual(p.a.fred.value(),1)
2847  self.assertEqual(p.b.wilma.value(),1)
2848  self.assertEqual(p.isUsingModifier(m1),False)
2849  #make sure clones get the changes
2850  m1 = Modifier()
2851  p = Process("test",m1)
2852  p.a = EDAnalyzer("MyAnalyzer", fred = int32(1), wilma = int32(1))
2853  m1.toModify(p.a, fred = int32(2))
2854  p.b = p.a.clone(wilma = int32(3))
2855  self.assertEqual(p.a.fred.value(),2)
2856  self.assertEqual(p.a.wilma.value(),1)
2857  self.assertEqual(p.b.fred.value(),2)
2858  self.assertEqual(p.b.wilma.value(),3)
2859  #test removal of parameter
2860  m1 = Modifier()
2861  p = Process("test",m1)
2862  p.a = EDAnalyzer("MyAnalyzer", fred = int32(1), wilma = int32(1))
2863  m1.toModify(p.a, fred = None)
2864  self.assertEqual(hasattr(p.a, "fred"), False)
2865  self.assertEqual(p.a.wilma.value(),1)
2866  #test adding a parameter
2867  m1 = Modifier()
2868  p = Process("test",m1)
2869  p.a = EDAnalyzer("MyAnalyzer", fred = int32(1))
2870  m1.toModify(p.a, wilma = int32(2))
2871  self.assertEqual(p.a.fred.value(), 1)
2872  self.assertEqual(p.a.wilma.value(),2)
2873  #test setting of value in PSet
2874  m1 = Modifier()
2875  p = Process("test",m1)
2876  p.a = EDAnalyzer("MyAnalyzer", flintstones = PSet(fred = int32(1), wilma = int32(1)))
2877  m1.toModify(p.a, flintstones = dict(fred = int32(2)))
2878  self.assertEqual(p.a.flintstones.fred.value(),2)
2879  self.assertEqual(p.a.flintstones.wilma.value(),1)
2880  #test proper exception from nonexisting parameter name
2881  m1 = Modifier()
2882  p = Process("test",m1)
2883  p.a = EDAnalyzer("MyAnalyzer", flintstones = PSet(fred = PSet(wilma = int32(1))))
2884  self.assertRaises(KeyError, lambda: m1.toModify(p.a, flintstones = dict(imnothere = dict(wilma=2))))
2885  self.assertRaises(KeyError, lambda: m1.toModify(p.a, foo = 1))
2886  #test setting a value in a VPSet
2887  m1 = Modifier()
2888  p = Process("test",m1)
2889  p.a = EDAnalyzer("MyAnalyzer", flintstones = VPSet(PSet(fred = int32(1)), PSet(wilma = int32(1))))
2890  m1.toModify(p.a, flintstones = {1:dict(wilma = int32(2))})
2891  self.assertEqual(p.a.flintstones[0].fred.value(),1)
2892  self.assertEqual(p.a.flintstones[1].wilma.value(),2)
2893  #test setting a value in a list of values
2894  m1 = Modifier()
2895  p = Process("test",m1)
2896  p.a = EDAnalyzer("MyAnalyzer", fred = vuint32(1,2,3))
2897  m1.toModify(p.a, fred = {1:7})
2898  self.assertEqual(p.a.fred[0],1)
2899  self.assertEqual(p.a.fred[1],7)
2900  self.assertEqual(p.a.fred[2],3)
2901  #test IndexError setting a value in a list to an item key not in the list
2902  m1 = Modifier()
2903  p = Process("test",m1)
2904  p.a = EDAnalyzer("MyAnalyzer", fred = vuint32(1,2,3))
2905  raised = False
2906  try: m1.toModify(p.a, fred = {5:7})
2907  except IndexError as e: raised = True
2908  self.assertEqual(raised, True)
2909  #test TypeError setting a value in a list using a key that is not an int
2910  m1 = Modifier()
2911  p = Process("test",m1)
2912  p.a = EDAnalyzer("MyAnalyzer", flintstones = VPSet(PSet(fred = int32(1)), PSet(wilma = int32(1))))
2913  raised = False
2914  try: m1.toModify(p.a, flintstones = dict(bogus = int32(37)))
2915  except TypeError as e: raised = True
2916  self.assertEqual(raised, True)
2917  #test that load causes process wide methods to run
2918  def _rem_a(proc):
2919  del proc.a
2920  class ProcModifierMod(object):
2921  def __init__(self,modifier,func):
2922  self.proc_mod_ = modifier.makeProcessModifier(func)
2923  class DummyMod(object):
2924  def __init__(self):
2925  self.a = EDAnalyzer("Dummy")
2926  testMod = DummyMod()
2927  p.extend(testMod)
2928  self.assert_(hasattr(p,"a"))
2929  m1 = Modifier()
2930  p = Process("test",m1)
2931  testProcMod = ProcModifierMod(m1,_rem_a)
2932  p.extend(testMod)
2933  p.extend(testProcMod)
2934  self.assert_(not hasattr(p,"a"))
2935  #test ModifierChain
2936  m1 = Modifier()
2937  mc = ModifierChain(m1)
2938  p = Process("test",mc)
2939  self.assert_(p.isUsingModifier(m1))
2940  self.assert_(p.isUsingModifier(mc))
2941  testMod = DummyMod()
2942  p.b = EDAnalyzer("Dummy2", fred = int32(1))
2943  m1.toModify(p.b, fred = int32(3))
2944  p.extend(testMod)
2945  testProcMod = ProcModifierMod(m1,_rem_a)
2946  p.extend(testProcMod)
2947  self.assert_(not hasattr(p,"a"))
2948  self.assertEqual(p.b.fred.value(),3)
2949  #check cloneAndExclude
2950  m1 = Modifier()
2951  m2 = Modifier()
2952  mc = ModifierChain(m1,m2)
2953  mclone = mc.copyAndExclude([m2])
2954  self.assert_(not mclone._isOrContains(m2))
2955  self.assert_(mclone._isOrContains(m1))
2956  m3 = Modifier()
2957  mc2 = ModifierChain(mc,m3)
2958  mclone = mc2.copyAndExclude([m2])
2959  self.assert_(not mclone._isOrContains(m2))
2960  self.assert_(mclone._isOrContains(m1))
2961  self.assert_(mclone._isOrContains(m3))
2962  #check combining
2963  m1 = Modifier()
2964  m2 = Modifier()
2965  p = Process("test",m1)
2966  p.a = EDAnalyzer("MyAnalyzer", fred = int32(1), wilma = int32(1))
2967  (m1 & m2).toModify(p.a, fred = int32(2))
2968  self.assertEqual(p.a.fred, 1)
2969  m1 = Modifier()
2970  m2 = Modifier()
2971  p = Process("test",m1,m2)
2972  p.a = EDAnalyzer("MyAnalyzer", fred = int32(1), wilma = int32(1))
2973  (m1 & m2).toModify(p.a, fred = int32(2))
2974  self.assertEqual(p.a.fred, 2)
2975  m1 = Modifier()
2976  m2 = Modifier()
2977  m3 = Modifier()
2978  p = Process("test",m1,m2,m3)
2979  p.a = EDAnalyzer("MyAnalyzer", fred = int32(1), wilma = int32(1))
2980  (m1 & m2 & m3).toModify(p.a, fred = int32(2))
2981  self.assertEqual(p.a.fred, 2)
2982  #check toReplaceWith
2983  m1 = Modifier()
2984  p = Process("test",m1)
2985  p.a =EDAnalyzer("MyAnalyzer", fred = int32(1))
2986  m1.toReplaceWith(p.a, EDAnalyzer("YourAnalyzer", wilma = int32(3)))
2987  p.b =EDAnalyzer("BAn")
2988  p.c =EDProducer("c")
2989  p.d =EDProducer("d")
2990  p.tc = Task(p.c)
2991  p.td = Task(p.d)
2992  p.s = Sequence(p.a, p.tc)
2993  m1.toReplaceWith(p.s, Sequence(p.a+p.b, p.td))
2994  self.assertEqual(p.a.wilma.value(),3)
2995  self.assertEqual(p.a.type_(),"YourAnalyzer")
2996  self.assertEqual(hasattr(p,"fred"),False)
2997  self.assertTrue(p.s.dumpPython("") == "cms.Sequence(process.a+process.b, process.td)\n")
2998  p.e =EDProducer("e")
2999  m1.toReplaceWith(p.td, Task(p.e))
3000  self.assertTrue(p.td._collection == OrderedSet([p.e]))
3001  #check toReplaceWith doesn't activate not chosen
3002  m1 = Modifier()
3003  p = Process("test")
3004  p.a =EDAnalyzer("MyAnalyzer", fred = int32(1))
3005  m1.toReplaceWith(p.a, EDAnalyzer("YourAnalyzer", wilma = int32(3)))
3006  self.assertEqual(p.a.type_(),"MyAnalyzer")
3007  unittest.main()
def testModifier(self)
Definition: Config.py:2827
def Config.TestModuleCommand.testOverride (   self)

Definition at line 2391 of file Config.py.

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

Definition at line 1512 of file Config.py.

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

Definition at line 2190 of file Config.py.

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

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

Definition at line 2426 of file Config.py.

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

Definition at line 1647 of file Config.py.

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

Definition at line 1577 of file Config.py.

References resolutioncreator_cfi.object, and harvestTrackValidationPlots.str.

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

Definition at line 1552 of file Config.py.

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

Definition at line 2554 of file Config.py.

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

Definition at line 2538 of file Config.py.

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

Definition at line 2246 of file Config.py.

References list().

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

References python.rootplot.root2matplotlib.replace().

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

Definition at line 1952 of file Config.py.

References harvestTrackValidationPlots.str.

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

Definition at line 1967 of file Config.py.

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

Definition at line 1977 of file Config.py.

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

Definition at line 2498 of file Config.py.

References cond.hash, and harvestTrackValidationPlots.str.

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

Definition at line 1990 of file Config.py.

References list().

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

2638  p = Process("test")
2639  p.a = EDProducer("ma")
2640  p.b = EDAnalyzer("mb")
2641  p.t1 = Task(TaskPlaceholder("c"))
2642  p.t2 = Task(p.a, TaskPlaceholder("d"), p.t1)
2643  p.t3 = Task(TaskPlaceholder("e"))
2644  p.path1 = Path(p.b, p.t2, p.t3)
2645  p.t5 = Task(p.a, TaskPlaceholder("g"), TaskPlaceholder("t4"))
2646  p.t4 = Task(TaskPlaceholder("f"))
2647  p.endpath1 = EndPath(p.b, p.t5)
2648  p.t6 = Task(TaskPlaceholder("h"))
2649  p.t7 = Task(p.a, TaskPlaceholder("i"), p.t6)
2650  p.t8 = Task(TaskPlaceholder("j"))
2651  p.schedule = Schedule(p.path1, p.endpath1,tasks=[p.t7,p.t8])
2652  p.c = EDProducer("mc")
2653  p.d = EDProducer("md")
2654  p.e = EDProducer("me")
2655  p.f = EDProducer("mf")
2656  p.g = EDProducer("mg")
2657  p.h = EDProducer("mh")
2658  p.i = EDProducer("mi")
2659  p.j = EDProducer("mj")
2660  self.assertEqual(p.dumpPython(),
2661 """import FWCore.ParameterSet.Config as cms
2662 
2663 process = cms.Process("test")
2664 
2665 process.a = cms.EDProducer("ma")
2666 
2667 
2668 process.c = cms.EDProducer("mc")
2669 
2670 
2671 process.d = cms.EDProducer("md")
2672 
2673 
2674 process.e = cms.EDProducer("me")
2675 
2676 
2677 process.f = cms.EDProducer("mf")
2678 
2679 
2680 process.g = cms.EDProducer("mg")
2681 
2682 
2683 process.h = cms.EDProducer("mh")
2684 
2685 
2686 process.i = cms.EDProducer("mi")
2687 
2688 
2689 process.j = cms.EDProducer("mj")
2690 
2691 
2692 process.b = cms.EDAnalyzer("mb")
2693 
2694 
2695 process.t8 = cms.Task(cms.TaskPlaceholder("j"))
2696 
2697 
2698 process.t6 = cms.Task(cms.TaskPlaceholder("h"))
2699 
2700 
2701 process.t7 = cms.Task(cms.TaskPlaceholder("i"), process.a, process.t6)
2702 
2703 
2704 process.t4 = cms.Task(cms.TaskPlaceholder("f"))
2705 
2706 
2707 process.t5 = cms.Task(cms.TaskPlaceholder("g"), cms.TaskPlaceholder("t4"), process.a)
2708 
2709 
2710 process.t3 = cms.Task(cms.TaskPlaceholder("e"))
2711 
2712 
2713 process.t1 = cms.Task(cms.TaskPlaceholder("c"))
2714 
2715 
2716 process.t2 = cms.Task(cms.TaskPlaceholder("d"), process.a, process.t1)
2717 
2718 
2719 process.path1 = cms.Path(process.b, process.t2, process.t3)
2720 
2721 
2722 process.endpath1 = cms.EndPath(process.b, process.t5)
2723 
2724 
2725 process.schedule = cms.Schedule(*[ process.path1, process.endpath1 ], tasks=[process.t7, process.t8])
2726 """)
2727  p.resolve()
2728  self.assertEqual(p.dumpPython(),
2729 """import FWCore.ParameterSet.Config as cms
2730 
2731 process = cms.Process("test")
2732 
2733 process.a = cms.EDProducer("ma")
2734 
2735 
2736 process.c = cms.EDProducer("mc")
2737 
2738 
2739 process.d = cms.EDProducer("md")
2740 
2741 
2742 process.e = cms.EDProducer("me")
2743 
2744 
2745 process.f = cms.EDProducer("mf")
2746 
2747 
2748 process.g = cms.EDProducer("mg")
2749 
2750 
2751 process.h = cms.EDProducer("mh")
2752 
2753 
2754 process.i = cms.EDProducer("mi")
2755 
2756 
2757 process.j = cms.EDProducer("mj")
2758 
2759 
2760 process.b = cms.EDAnalyzer("mb")
2761 
2762 
2763 process.t8 = cms.Task(process.j)
2764 
2765 
2766 process.t6 = cms.Task(process.h)
2767 
2768 
2769 process.t7 = cms.Task(process.a, process.i, process.t6)
2770 
2771 
2772 process.t4 = cms.Task(process.f)
2773 
2774 
2775 process.t5 = cms.Task(process.a, process.g, process.t4)
2776 
2777 
2778 process.t3 = cms.Task(process.e)
2779 
2780 
2781 process.t1 = cms.Task(process.c)
2782 
2783 
2784 process.t2 = cms.Task(process.a, process.d, process.t1)
2785 
2786 
2787 process.path1 = cms.Path(process.b, process.t2, process.t3)
2788 
2789 
2790 process.endpath1 = cms.EndPath(process.b, process.t5)
2791 
2792 
2793 process.schedule = cms.Schedule(*[ process.path1, process.endpath1 ], tasks=[process.t7, process.t8])
2794 """)
2795 
def testTaskPlaceholder(self)
Definition: Config.py:2637
def Config.TestModuleCommand.testTypedParameterizable (   self)

Definition at line 1545 of file Config.py.

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

Definition at line 2384 of file Config.py.

2384  def testUsing(self):
2385  p = Process('test')
2386  p.block = PSet(a = int32(1))
2387  p.modu = EDAnalyzer('Analyzer', p.block, b = int32(2))
2388  self.assertEqual(p.modu.a.value(),1)
2389  self.assertEqual(p.modu.b.value(),2)
2390 

Member Data Documentation

Config.TestModuleCommand.a

Definition at line 2925 of file Config.py.

Config.TestModuleCommand.proc_mod_

Definition at line 2922 of file Config.py.