CMS 3D CMS Logo

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

Public Member Functions

def setUp (self)
 
def testCloneSequence (self)
 
def testContains (self)
 
def testDelete (self)
 
def testExamples (self)
 
def testFreeze (self)
 
def testGlobalReplace (self)
 
def testImplicitSchedule (self)
 
def testModifier (self)
 
def testOverride (self)
 
def testParameterizable (self)
 
def testPath (self)
 
def testPrefers (self)
 
def testProcessDumpPython (self)
 
def testProcessExtend (self)
 
def testProcessInsertion (self)
 
def testPrune (self)
 
def testRefToPSet (self)
 
def testSchedule (self)
 
def testSecSource (self)
 
def testSequence (self)
 
def testSequence2 (self)
 
def testServiceInProcess (self)
 
def testSubProcess (self)
 
def 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.testContains (   self)

Definition at line 2246 of file Config.py.

2246  def testContains(self):
2247 
2248  a = EDProducer("a")
2249  b = EDProducer("b")
2250  c = EDProducer("c")
2251  d = EDProducer("d")
2252  e = EDProducer("e")
2253  f = EDProducer("f")
2254  g = EDProducer("g")
2255  h = EDProducer("h")
2256  i = EDProducer("i")
2257  j = EDProducer("j")
2258  k = EDProducer("k")
2259  l = EDProducer("l")
2260  m = EDProducer("m")
2261  n = EDProducer("n")
2262 
2263  seq1 = Sequence(e)
2264  task1 = Task(g)
2265  path = Path(a * c * seq1, task1)
2266 
2267  self.assertTrue(path.contains(a))
2268  self.assertFalse(path.contains(b))
2269  self.assertTrue(path.contains(c))
2270  self.assertFalse(path.contains(d))
2271  self.assertTrue(path.contains(e))
2272  self.assertFalse(path.contains(f))
2273  self.assertTrue(path.contains(g))
2274 
2275  endpath = EndPath(h * i)
2276  self.assertFalse(endpath.contains(b))
2277  self.assertTrue(endpath.contains(i))
2278 
2279  seq = Sequence(a * c)
2280  self.assertFalse(seq.contains(b))
2281  self.assertTrue(seq.contains(c))
2282 
2283  task2 = Task(l)
2284  task = Task(j, k, task2)
2285  self.assertFalse(task.contains(b))
2286  self.assertTrue(task.contains(j))
2287  self.assertTrue(task.contains(k))
2288  self.assertTrue(task.contains(l))
2289 
2290  task3 = Task(m)
2291  path2 = Path(n)
2292  sch = Schedule(path, path2, tasks=[task,task3])
2293  self.assertFalse(sch.contains(b))
2294  self.assertTrue(sch.contains(a))
2295  self.assertTrue(sch.contains(c))
2296  self.assertTrue(sch.contains(e))
2297  self.assertTrue(sch.contains(g))
2298  self.assertTrue(sch.contains(n))
2299  self.assertTrue(sch.contains(j))
2300  self.assertTrue(sch.contains(k))
2301  self.assertTrue(sch.contains(l))
2302  self.assertTrue(sch.contains(m))
2303 
def testContains(self)
Definition: Config.py:2246
def Config.TestModuleCommand.testDelete (   self)

Definition at line 2854 of file Config.py.

References ConfigBuilder.dumpPython().

2854  def testDelete(self):
2855  p = Process("test")
2856  p.a = EDAnalyzer("MyAnalyzer")
2857  p.b = EDAnalyzer("YourAnalyzer")
2858  p.c = EDAnalyzer("OurAnalyzer")
2859  p.d = EDAnalyzer("OurAnalyzer")
2860  p.e = EDAnalyzer("OurAnalyzer")
2861  p.f = EDAnalyzer("OurAnalyzer")
2862  p.g = EDProducer("OurProducer")
2863  p.h = EDProducer("YourProducer")
2864  p.t1 = Task(p.g, p.h)
2865  t2 = Task(p.g, p.h)
2866  t3 = Task(p.g, p.h)
2867  p.s = Sequence(p.d+p.e)
2868  p.path1 = Path(p.a+p.f+p.s,t2)
2869  p.endpath1 = EndPath(p.b+p.f)
2870  p.schedule = Schedule(tasks=[t3])
2871  self.assertTrue(hasattr(p, 'f'))
2872  self.assertTrue(hasattr(p, 'g'))
2873  del p.e
2874  del p.f
2875  del p.g
2876  self.assertFalse(hasattr(p, 'f'))
2877  self.assertFalse(hasattr(p, 'g'))
2878  self.assertTrue(p.t1.dumpPython(None) == 'cms.Task(process.h)\n')
2879  self.assertTrue(p.s.dumpPython(None) == 'cms.Sequence(process.d)\n')
2880  self.assertTrue(p.path1.dumpPython(None) == 'cms.Path(process.a+process.s, cms.Task(process.h))\n')
2881  self.assertTrue(p.endpath1.dumpPython(None) == 'cms.EndPath(process.b)\n')
2882  del p.s
2883  self.assertTrue(p.path1.dumpPython(None) == 'cms.Path(process.a+(process.d), cms.Task(process.h))\n')
2884  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 2472 of file Config.py.

2472  def testExamples(self):
2473  p = Process("Test")
2474  p.source = Source("PoolSource",fileNames = untracked(string("file:reco.root")))
2475  p.foos = EDProducer("FooProducer")
2476  p.bars = EDProducer("BarProducer", foos=InputTag("foos"))
2477  p.out = OutputModule("PoolOutputModule",fileName=untracked(string("file:foos.root")))
2478  p.bars.foos = 'Foosball'
2479  self.assertEqual(p.bars.foos, InputTag('Foosball'))
2480  p.p = Path(p.foos*p.bars)
2481  p.e = EndPath(p.out)
2482  p.add_(Service("MessageLogger"))
2483 
def testExamples(self)
Definition: Config.py:2472
def Config.TestModuleCommand.testFreeze (   self)

Definition at line 2538 of file Config.py.

2538  def testFreeze(self):
2539  process = Process("Freeze")
2540  m = EDProducer("M", p=PSet(i = int32(1)))
2541  m.p.i = 2
2542  process.m = m
2543  # should be frozen
2544  #self.assertRaises(ValueError, setattr, m.p, 'i', 3)
2545  #self.assertRaises(ValueError, setattr, m, 'p', PSet(i=int32(1)))
2546  #self.assertRaises(ValueError, setattr, m.p, 'j', 1)
2547  #self.assertRaises(ValueError, setattr, m, 'j', 1)
2548  # But OK to change through the process
2549  process.m.p.i = 4
2550  self.assertEqual(process.m.p.i.value(), 4)
2551  process.m.p = PSet(j=int32(1))
2552  # should work to clone it, though
2553  m2 = m.clone(p = PSet(i = int32(5)), j = int32(8))
2554  m2.p.i = 6
2555  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 2409 of file Config.py.

2410  p = Process("test")
2411  p.a = EDAnalyzer("MyAnalyzer")
2412  p.b = EDAnalyzer("YourAnalyzer")
2413  p.c = EDAnalyzer("OurAnalyzer")
2414  p.path1 = Path(p.a)
2415  p.path2 = Path(p.b)
2416  self.assert_(p.schedule is None)
2417  pths = p.paths
2418  keys = pths.keys()
2419  self.assertEqual(pths[keys[0]],p.path1)
2420  self.assertEqual(pths[keys[1]],p.path2)
2421  p.prune()
2422  self.assert_(hasattr(p, 'a'))
2423  self.assert_(hasattr(p, 'b'))
2424  self.assert_(not hasattr(p, 'c'))
2425  self.assert_(hasattr(p, 'path1'))
2426  self.assert_(hasattr(p, 'path2'))
2427 
2428 
2429  p = Process("test")
2430  p.a = EDAnalyzer("MyAnalyzer")
2431  p.b = EDAnalyzer("YourAnalyzer")
2432  p.c = EDAnalyzer("OurAnalyzer")
2433  p.path2 = Path(p.b)
2434  p.path1 = Path(p.a)
2435  self.assert_(p.schedule is None)
2436  pths = p.paths
2437  keys = pths.keys()
2438  self.assertEqual(pths[keys[1]],p.path1)
2439  self.assertEqual(pths[keys[0]],p.path2)
2440 
2441 
def testImplicitSchedule(self)
Definition: Config.py:2409
def Config.TestModuleCommand.testModifier (   self)

Definition at line 2885 of file Config.py.

References cmsPerfStripChart.dict, and resolutioncreator_cfi.object.

2885  def testModifier(self):
2886  m1 = Modifier()
2887  p = Process("test",m1)
2888  p.a = EDAnalyzer("MyAnalyzer", fred = int32(1))
2889  def _mod_fred(obj):
2890  obj.fred = 2
2891  m1.toModify(p.a,_mod_fred)
2892  self.assertEqual(p.a.fred.value(),2)
2893  p.b = EDAnalyzer("YourAnalyzer", wilma = int32(1))
2894  m1.toModify(p.b, wilma = 2)
2895  self.assertEqual(p.b.wilma.value(),2)
2896  self.assert_(p.isUsingModifier(m1))
2897  #check that Modifier not attached to a process doesn't run
2898  m1 = Modifier()
2899  p = Process("test")
2900  p.a = EDAnalyzer("MyAnalyzer", fred = int32(1))
2901  m1.toModify(p.a,_mod_fred)
2902  p.b = EDAnalyzer("YourAnalyzer", wilma = int32(1))
2903  m1.toModify(p.b, wilma = 2)
2904  self.assertEqual(p.a.fred.value(),1)
2905  self.assertEqual(p.b.wilma.value(),1)
2906  self.assertEqual(p.isUsingModifier(m1),False)
2907  #make sure clones get the changes
2908  m1 = Modifier()
2909  p = Process("test",m1)
2910  p.a = EDAnalyzer("MyAnalyzer", fred = int32(1), wilma = int32(1))
2911  m1.toModify(p.a, fred = int32(2))
2912  p.b = p.a.clone(wilma = int32(3))
2913  self.assertEqual(p.a.fred.value(),2)
2914  self.assertEqual(p.a.wilma.value(),1)
2915  self.assertEqual(p.b.fred.value(),2)
2916  self.assertEqual(p.b.wilma.value(),3)
2917  #test removal of parameter
2918  m1 = Modifier()
2919  p = Process("test",m1)
2920  p.a = EDAnalyzer("MyAnalyzer", fred = int32(1), wilma = int32(1))
2921  m1.toModify(p.a, fred = None)
2922  self.assertEqual(hasattr(p.a, "fred"), False)
2923  self.assertEqual(p.a.wilma.value(),1)
2924  #test adding a parameter
2925  m1 = Modifier()
2926  p = Process("test",m1)
2927  p.a = EDAnalyzer("MyAnalyzer", fred = int32(1))
2928  m1.toModify(p.a, wilma = int32(2))
2929  self.assertEqual(p.a.fred.value(), 1)
2930  self.assertEqual(p.a.wilma.value(),2)
2931  #test setting of value in PSet
2932  m1 = Modifier()
2933  p = Process("test",m1)
2934  p.a = EDAnalyzer("MyAnalyzer", flintstones = PSet(fred = int32(1), wilma = int32(1)))
2935  m1.toModify(p.a, flintstones = dict(fred = int32(2)))
2936  self.assertEqual(p.a.flintstones.fred.value(),2)
2937  self.assertEqual(p.a.flintstones.wilma.value(),1)
2938  #test proper exception from nonexisting parameter name
2939  m1 = Modifier()
2940  p = Process("test",m1)
2941  p.a = EDAnalyzer("MyAnalyzer", flintstones = PSet(fred = PSet(wilma = int32(1))))
2942  self.assertRaises(KeyError, lambda: m1.toModify(p.a, flintstones = dict(imnothere = dict(wilma=2))))
2943  self.assertRaises(KeyError, lambda: m1.toModify(p.a, foo = 1))
2944  #test setting a value in a VPSet
2945  m1 = Modifier()
2946  p = Process("test",m1)
2947  p.a = EDAnalyzer("MyAnalyzer", flintstones = VPSet(PSet(fred = int32(1)), PSet(wilma = int32(1))))
2948  m1.toModify(p.a, flintstones = {1:dict(wilma = int32(2))})
2949  self.assertEqual(p.a.flintstones[0].fred.value(),1)
2950  self.assertEqual(p.a.flintstones[1].wilma.value(),2)
2951  #test setting a value in a list of values
2952  m1 = Modifier()
2953  p = Process("test",m1)
2954  p.a = EDAnalyzer("MyAnalyzer", fred = vuint32(1,2,3))
2955  m1.toModify(p.a, fred = {1:7})
2956  self.assertEqual(p.a.fred[0],1)
2957  self.assertEqual(p.a.fred[1],7)
2958  self.assertEqual(p.a.fred[2],3)
2959  #test IndexError setting a value in a list to an item key not in the list
2960  m1 = Modifier()
2961  p = Process("test",m1)
2962  p.a = EDAnalyzer("MyAnalyzer", fred = vuint32(1,2,3))
2963  raised = False
2964  try: m1.toModify(p.a, fred = {5:7})
2965  except IndexError as e: raised = True
2966  self.assertEqual(raised, True)
2967  #test TypeError setting a value in a list using a key that is not an int
2968  m1 = Modifier()
2969  p = Process("test",m1)
2970  p.a = EDAnalyzer("MyAnalyzer", flintstones = VPSet(PSet(fred = int32(1)), PSet(wilma = int32(1))))
2971  raised = False
2972  try: m1.toModify(p.a, flintstones = dict(bogus = int32(37)))
2973  except TypeError as e: raised = True
2974  self.assertEqual(raised, True)
2975  #test that load causes process wide methods to run
2976  def _rem_a(proc):
2977  del proc.a
2978  class ProcModifierMod(object):
2979  def __init__(self,modifier,func):
2980  self.proc_mod_ = modifier.makeProcessModifier(func)
2981  class DummyMod(object):
2982  def __init__(self):
2983  self.a = EDAnalyzer("Dummy")
2984  testMod = DummyMod()
2985  p.extend(testMod)
2986  self.assert_(hasattr(p,"a"))
2987  m1 = Modifier()
2988  p = Process("test",m1)
2989  testProcMod = ProcModifierMod(m1,_rem_a)
2990  p.extend(testMod)
2991  p.extend(testProcMod)
2992  self.assert_(not hasattr(p,"a"))
2993  #test ModifierChain
2994  m1 = Modifier()
2995  mc = ModifierChain(m1)
2996  p = Process("test",mc)
2997  self.assert_(p.isUsingModifier(m1))
2998  self.assert_(p.isUsingModifier(mc))
2999  testMod = DummyMod()
3000  p.b = EDAnalyzer("Dummy2", fred = int32(1))
3001  m1.toModify(p.b, fred = int32(3))
3002  p.extend(testMod)
3003  testProcMod = ProcModifierMod(m1,_rem_a)
3004  p.extend(testProcMod)
3005  self.assert_(not hasattr(p,"a"))
3006  self.assertEqual(p.b.fred.value(),3)
3007  #check cloneAndExclude
3008  m1 = Modifier()
3009  m2 = Modifier()
3010  mc = ModifierChain(m1,m2)
3011  mclone = mc.copyAndExclude([m2])
3012  self.assert_(not mclone._isOrContains(m2))
3013  self.assert_(mclone._isOrContains(m1))
3014  m3 = Modifier()
3015  mc2 = ModifierChain(mc,m3)
3016  mclone = mc2.copyAndExclude([m2])
3017  self.assert_(not mclone._isOrContains(m2))
3018  self.assert_(mclone._isOrContains(m1))
3019  self.assert_(mclone._isOrContains(m3))
3020  #check combining
3021  m1 = Modifier()
3022  m2 = Modifier()
3023  p = Process("test",m1)
3024  p.a = EDAnalyzer("MyAnalyzer", fred = int32(1), wilma = int32(1))
3025  (m1 & m2).toModify(p.a, fred = int32(2))
3026  self.assertEqual(p.a.fred, 1)
3027  m1 = Modifier()
3028  m2 = Modifier()
3029  p = Process("test",m1,m2)
3030  p.a = EDAnalyzer("MyAnalyzer", fred = int32(1), wilma = int32(1))
3031  (m1 & m2).toModify(p.a, fred = int32(2))
3032  self.assertEqual(p.a.fred, 2)
3033  m1 = Modifier()
3034  m2 = Modifier()
3035  m3 = Modifier()
3036  p = Process("test",m1,m2,m3)
3037  p.a = EDAnalyzer("MyAnalyzer", fred = int32(1), wilma = int32(1))
3038  (m1 & m2 & m3).toModify(p.a, fred = int32(2))
3039  self.assertEqual(p.a.fred, 2)
3040  #check toReplaceWith
3041  m1 = Modifier()
3042  p = Process("test",m1)
3043  p.a =EDAnalyzer("MyAnalyzer", fred = int32(1))
3044  m1.toReplaceWith(p.a, EDAnalyzer("YourAnalyzer", wilma = int32(3)))
3045  p.b =EDAnalyzer("BAn")
3046  p.c =EDProducer("c")
3047  p.d =EDProducer("d")
3048  p.tc = Task(p.c)
3049  p.td = Task(p.d)
3050  p.s = Sequence(p.a, p.tc)
3051  m1.toReplaceWith(p.s, Sequence(p.a+p.b, p.td))
3052  self.assertEqual(p.a.wilma.value(),3)
3053  self.assertEqual(p.a.type_(),"YourAnalyzer")
3054  self.assertEqual(hasattr(p,"fred"),False)
3055  self.assertTrue(p.s.dumpPython("") == "cms.Sequence(process.a+process.b, process.td)\n")
3056  p.e =EDProducer("e")
3057  m1.toReplaceWith(p.td, Task(p.e))
3058  self.assertTrue(p.td._collection == OrderedSet([p.e]))
3059  #check toReplaceWith doesn't activate not chosen
3060  m1 = Modifier()
3061  p = Process("test")
3062  p.a =EDAnalyzer("MyAnalyzer", fred = int32(1))
3063  m1.toReplaceWith(p.a, EDAnalyzer("YourAnalyzer", wilma = int32(3)))
3064  self.assertEqual(p.a.type_(),"MyAnalyzer")
3065  unittest.main()
def testModifier(self)
Definition: Config.py:2885
def Config.TestModuleCommand.testOverride (   self)

Definition at line 2449 of file Config.py.

2449  def testOverride(self):
2450  p = Process('test')
2451  a = EDProducer("A", a1=int32(0))
2452  self.assert_(not a.isModified())
2453  a.a1 = 1
2454  self.assert_(a.isModified())
2455  p.a = a
2456  self.assertEqual(p.a.a1.value(), 1)
2457  # try adding an unmodified module.
2458  # should accept it
2459  p.a = EDProducer("A", a1=int32(2))
2460  self.assertEqual(p.a.a1.value(), 2)
2461  # try adding a modified module. Should throw
2462  # no longer, since the same (modified) say, geometry
2463  # could come from more than one cff
2464  b = EDProducer("A", a1=int32(3))
2465  b.a1 = 4
2466  #self.assertRaises(RuntimeError, setattr, *(p,'a',b))
2467  ps1 = PSet(a = int32(1))
2468  ps2 = PSet(a = int32(2))
2469  self.assertRaises(ValueError, EDProducer, 'C', ps1, ps2)
2470  self.assertRaises(ValueError, EDProducer, 'C', ps1, a=int32(3))
2471 
def testOverride(self)
Definition: Config.py:2449
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 2484 of file Config.py.

2484  def testPrefers(self):
2485  p = Process("Test")
2486  p.add_(ESSource("ForceSource"))
2487  p.juicer = ESProducer("JuicerProducer")
2488  p.prefer("ForceSource")
2489  p.prefer("juicer")
2490  self.assertEqual(p.dumpConfig(),
2491 """process Test = {
2492  es_module juicer = JuicerProducer {
2493  }
2494  es_source = ForceSource {
2495  }
2496  es_prefer = ForceSource {
2497  }
2498  es_prefer juicer = JuicerProducer {
2499  }
2500 }
2501 """)
2502  p.prefer("juicer",fooRcd=vstring("Foo"))
2503  self.assertEqual(p.dumpConfig(),
2504 """process Test = {
2505  es_module juicer = JuicerProducer {
2506  }
2507  es_source = ForceSource {
2508  }
2509  es_prefer = ForceSource {
2510  }
2511  es_prefer juicer = JuicerProducer {
2512  vstring fooRcd = {
2513  'Foo'
2514  }
2515 
2516  }
2517 }
2518 """)
2519  self.assertEqual(p.dumpPython(),
2520 """import FWCore.ParameterSet.Config as cms
2521 
2522 process = cms.Process("Test")
2523 
2524 process.juicer = cms.ESProducer("JuicerProducer")
2525 
2526 
2527 process.ForceSource = cms.ESSource("ForceSource")
2528 
2529 
2530 process.prefer("ForceSource")
2531 
2532 process.prefer("juicer",
2533  fooRcd = cms.vstring('Foo')
2534 )
2535 
2536 """)
2537 
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 2612 of file Config.py.

2612  def testPrune(self):
2613  p = Process("test")
2614  p.a = EDAnalyzer("MyAnalyzer")
2615  p.b = EDAnalyzer("YourAnalyzer")
2616  p.c = EDAnalyzer("OurAnalyzer")
2617  p.d = EDAnalyzer("OurAnalyzer")
2618  p.s = Sequence(p.d)
2619  p.path1 = Path(p.a)
2620  p.path2 = Path(p.b)
2621  self.assert_(p.schedule is None)
2622  pths = p.paths
2623  keys = pths.keys()
2624  self.assertEqual(pths[keys[0]],p.path1)
2625  self.assertEqual(pths[keys[1]],p.path2)
2626  p.pset1 = PSet(parA = string("pset1"))
2627  p.pset2 = untracked.PSet(parA = string("pset2"))
2628  p.vpset1 = VPSet()
2629  p.vpset2 = untracked.VPSet()
2630  p.prune()
2631  self.assert_(hasattr(p, 'a'))
2632  self.assert_(hasattr(p, 'b'))
2633  self.assert_(not hasattr(p, 'c'))
2634  self.assert_(not hasattr(p, 'd'))
2635  self.assert_(not hasattr(p, 's'))
2636  self.assert_(hasattr(p, 'path1'))
2637  self.assert_(hasattr(p, 'path2'))
2638 # self.assert_(not hasattr(p, 'pset1'))
2639 # self.assert_(hasattr(p, 'pset2'))
2640 # self.assert_(not hasattr(p, 'vpset1'))
2641 # self.assert_(not hasattr(p, 'vpset2'))
2642 
2643  p = Process("test")
2644  p.a = EDAnalyzer("MyAnalyzer")
2645  p.b = EDAnalyzer("YourAnalyzer")
2646  p.c = EDAnalyzer("OurAnalyzer")
2647  p.d = EDAnalyzer("OurAnalyzer")
2648  p.e = EDAnalyzer("OurAnalyzer")
2649  p.s = Sequence(p.d)
2650  p.s2 = Sequence(p.b)
2651  p.s3 = Sequence(p.e)
2652  p.path1 = Path(p.a)
2653  p.path2 = Path(p.b)
2654  p.path3 = Path(p.b+p.s2)
2655  p.path4 = Path(p.b+p.s3)
2656  p.schedule = Schedule(p.path1,p.path2,p.path3)
2657  pths = p.paths
2658  keys = pths.keys()
2659  self.assertEqual(pths[keys[0]],p.path1)
2660  self.assertEqual(pths[keys[1]],p.path2)
2661  p.prune()
2662  self.assert_(hasattr(p, 'a'))
2663  self.assert_(hasattr(p, 'b'))
2664  self.assert_(not hasattr(p, 'c'))
2665  self.assert_(not hasattr(p, 'd'))
2666  self.assert_(not hasattr(p, 'e'))
2667  self.assert_(not hasattr(p, 's'))
2668  self.assert_(hasattr(p, 's2'))
2669  self.assert_(not hasattr(p, 's3'))
2670  self.assert_(hasattr(p, 'path1'))
2671  self.assert_(hasattr(p, 'path2'))
2672  self.assert_(hasattr(p, 'path3'))
2673  self.assert_(not hasattr(p, 'path4'))
2674  #test SequencePlaceholder
2675  p = Process("test")
2676  p.a = EDAnalyzer("MyAnalyzer")
2677  p.b = EDAnalyzer("YourAnalyzer")
2678  p.s = Sequence(SequencePlaceholder("a")+p.b)
2679  p.pth = Path(p.s)
2680  p.prune()
2681  self.assert_(hasattr(p, 'a'))
2682  self.assert_(hasattr(p, 'b'))
2683  self.assert_(hasattr(p, 's'))
2684  self.assert_(hasattr(p, 'pth'))
2685  #test unresolved SequencePlaceholder
2686  p = Process("test")
2687  p.b = EDAnalyzer("YourAnalyzer")
2688  p.s = Sequence(SequencePlaceholder("a")+p.b)
2689  p.pth = Path(p.s)
2690  p.prune(keepUnresolvedSequencePlaceholders=True)
2691  self.assert_(hasattr(p, 'b'))
2692  self.assert_(hasattr(p, 's'))
2693  self.assert_(hasattr(p, 'pth'))
2694  self.assertEqual(p.s.dumpPython(''),'cms.Sequence(cms.SequencePlaceholder("a")+process.b)\n')
def Config.TestModuleCommand.testRefToPSet (   self)

Definition at line 2596 of file Config.py.

2596  def testRefToPSet(self):
2597  proc = Process("test")
2598  proc.top = PSet(a = int32(1))
2599  proc.ref = PSet(refToPSet_ = string("top"))
2600  proc.ref2 = PSet( a = int32(1), b = PSet( refToPSet_ = string("top")))
2601  proc.ref3 = PSet(refToPSet_ = string("ref"))
2602  proc.ref4 = VPSet(PSet(refToPSet_ = string("top")),
2603  PSet(refToPSet_ = string("ref2")))
2604  p = TestMakePSet()
2605  proc.fillProcessDesc(p)
2606  self.assertEqual((True,1),p.values["ref"][1].values["a"])
2607  self.assertEqual((True,1),p.values["ref3"][1].values["a"])
2608  self.assertEqual((True,1),p.values["ref2"][1].values["a"])
2609  self.assertEqual((True,1),p.values["ref2"][1].values["b"][1].values["a"])
2610  self.assertEqual((True,1),p.values["ref4"][1][0].values["a"])
2611  self.assertEqual((True,1),p.values["ref4"][1][1].values["a"])
def testRefToPSet(self)
Definition: Config.py:2596
def Config.TestModuleCommand.testSchedule (   self)

Definition at line 2304 of file Config.py.

References list().

2304  def testSchedule(self):
2305  p = Process("test")
2306  p.a = EDAnalyzer("MyAnalyzer")
2307  p.b = EDAnalyzer("YourAnalyzer")
2308  p.c = EDAnalyzer("OurAnalyzer")
2309  p.d = EDAnalyzer("OurAnalyzer")
2310  p.path1 = Path(p.a)
2311  p.path2 = Path(p.b)
2312  p.path3 = Path(p.d)
2313 
2314  s = Schedule(p.path1,p.path2)
2315  self.assertEqual(s[0],p.path1)
2316  self.assertEqual(s[1],p.path2)
2317  p.schedule = s
2318  self.assert_('b' in p.schedule.moduleNames())
2319  self.assert_(hasattr(p, 'b'))
2320  self.assert_(hasattr(p, 'c'))
2321  self.assert_(hasattr(p, 'd'))
2322  self.assert_(hasattr(p, 'path1'))
2323  self.assert_(hasattr(p, 'path2'))
2324  self.assert_(hasattr(p, 'path3'))
2325  p.prune()
2326  self.assert_('b' in p.schedule.moduleNames())
2327  self.assert_(hasattr(p, 'b'))
2328  self.assert_(not hasattr(p, 'c'))
2329  self.assert_(not hasattr(p, 'd'))
2330  self.assert_(hasattr(p, 'path1'))
2331  self.assert_(hasattr(p, 'path2'))
2332  self.assert_(not hasattr(p, 'path3'))
2333 
2334  self.assertTrue(len(p.schedule._tasks) == 0)
2335 
2336  p = Process("test")
2337  p.a = EDAnalyzer("MyAnalyzer")
2338  p.b = EDAnalyzer("YourAnalyzer")
2339  p.c = EDAnalyzer("OurAnalyzer")
2340  p.d = EDAnalyzer("dAnalyzer")
2341  p.e = EDProducer("eProducer")
2342  p.f = EDProducer("fProducer")
2343  p.Tracer = Service("Tracer")
2344  p.path1 = Path(p.a)
2345  p.path2 = Path(p.b)
2346  p.path3 = Path(p.d)
2347  p.task1 = Task(p.e)
2348  p.task2 = Task(p.f, p.Tracer)
2349  s = Schedule(p.path1,p.path2,tasks=[p.task1,p.task2,p.task1])
2350  self.assertEqual(s[0],p.path1)
2351  self.assertEqual(s[1],p.path2)
2352  self.assertTrue(len(s._tasks) == 2)
2353  self.assertTrue(p.task1 in s._tasks)
2354  self.assertTrue(p.task2 in s._tasks)
2355  listOfTasks = list(s._tasks)
2356  self.assertTrue(len(listOfTasks) == 2)
2357  self.assertTrue(p.task1 == listOfTasks[0])
2358  self.assertTrue(p.task2 == listOfTasks[1])
2359  p.schedule = s
2360  self.assert_('b' in p.schedule.moduleNames())
2361 
2362  process2 = Process("test")
2363  process2.a = EDAnalyzer("MyAnalyzer")
2364  process2.e = EDProducer("eProducer")
2365  process2.path1 = Path(process2.a)
2366  process2.task1 = Task(process2.e)
2367  process2.schedule = Schedule(process2.path1,tasks=process2.task1)
2368  listOfTasks = list(process2.schedule._tasks)
2369  self.assertTrue(listOfTasks[0] == process2.task1)
2370 
2371  # test Schedule copy
2372  s2 = s.copy()
2373  self.assertEqual(s2[0],p.path1)
2374  self.assertEqual(s2[1],p.path2)
2375  self.assertTrue(len(s2._tasks) == 2)
2376  self.assertTrue(p.task1 in s2._tasks)
2377  self.assertTrue(p.task2 in s2._tasks)
2378  listOfTasks = list(s2._tasks)
2379  self.assertTrue(len(listOfTasks) == 2)
2380  self.assertTrue(p.task1 == listOfTasks[0])
2381  self.assertTrue(p.task2 == listOfTasks[1])
2382 
2383  names = s.moduleNames()
2384  self.assertTrue(names == set(['a', 'b', 'e', 'Tracer', 'f']))
2385  #adding a path not attached to the Process should cause an exception
2386  p = Process("test")
2387  p.a = EDAnalyzer("MyAnalyzer")
2388  path1 = Path(p.a)
2389  s = Schedule(path1)
2390  self.assertRaises(RuntimeError, lambda : p.setSchedule_(s) )
2391 
2392  #make sure anonymous sequences work
2393  p = Process("test")
2394  p.a = EDAnalyzer("MyAnalyzer")
2395  p.b = EDAnalyzer("MyOtherAnalyzer")
2396  p.c = EDProducer("MyProd")
2397  path1 = Path(p.c*Sequence(p.a+p.b))
2398  s = Schedule(path1)
2399  self.assert_('a' in s.moduleNames())
2400  self.assert_('b' in s.moduleNames())
2401  self.assert_('c' in s.moduleNames())
2402  p.path1 = path1
2403  p.schedule = s
2404  p.prune()
2405  self.assert_('a' in s.moduleNames())
2406  self.assert_('b' in s.moduleNames())
2407  self.assert_('c' in s.moduleNames())
2408 
def testSchedule(self)
Definition: Config.py:2304
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 2556 of file Config.py.

References cond.hash, and harvestTrackValidationPlots.str.

2556  def testSubProcess(self):
2557  process = Process("Parent")
2558  subProcess = Process("Child")
2559  subProcess.a = EDProducer("A")
2560  subProcess.p = Path(subProcess.a)
2561  subProcess.add_(Service("Foo"))
2562  process.addSubProcess(SubProcess(subProcess))
2563  d = process.dumpPython()
2564  equalD ="""import FWCore.ParameterSet.Config as cms
2565 
2566 process = cms.Process("Parent")
2567 
2568 parentProcess = process
2569 import FWCore.ParameterSet.Config as cms
2570 
2571 process = cms.Process("Child")
2572 
2573 process.a = cms.EDProducer("A")
2574 
2575 
2576 process.Foo = cms.Service("Foo")
2577 
2578 
2579 process.p = cms.Path(process.a)
2580 
2581 
2582 childProcess = process
2583 process = parentProcess
2584 process.addSubProcess(cms.SubProcess(process = childProcess, SelectEvents = cms.untracked.PSet(
2585 
2586 ), outputCommands = cms.untracked.vstring()))
2587 
2588 """
2589  equalD = equalD.replace("parentProcess","parentProcess"+str(hash(process.subProcesses_()[0])))
2590  self.assertEqual(d,equalD)
2591  p = TestMakePSet()
2592  process.fillProcessDesc(p)
2593  self.assertEqual((True,['a']),p.values["subProcesses"][1][0].values["process"][1].values['@all_modules'])
2594  self.assertEqual((True,['p']),p.values["subProcesses"][1][0].values["process"][1].values['@paths'])
2595  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:2556
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 2695 of file Config.py.

2696  p = Process("test")
2697  p.a = EDProducer("ma")
2698  p.b = EDAnalyzer("mb")
2699  p.t1 = Task(TaskPlaceholder("c"))
2700  p.t2 = Task(p.a, TaskPlaceholder("d"), p.t1)
2701  p.t3 = Task(TaskPlaceholder("e"))
2702  p.path1 = Path(p.b, p.t2, p.t3)
2703  p.t5 = Task(p.a, TaskPlaceholder("g"), TaskPlaceholder("t4"))
2704  p.t4 = Task(TaskPlaceholder("f"))
2705  p.endpath1 = EndPath(p.b, p.t5)
2706  p.t6 = Task(TaskPlaceholder("h"))
2707  p.t7 = Task(p.a, TaskPlaceholder("i"), p.t6)
2708  p.t8 = Task(TaskPlaceholder("j"))
2709  p.schedule = Schedule(p.path1, p.endpath1,tasks=[p.t7,p.t8])
2710  p.c = EDProducer("mc")
2711  p.d = EDProducer("md")
2712  p.e = EDProducer("me")
2713  p.f = EDProducer("mf")
2714  p.g = EDProducer("mg")
2715  p.h = EDProducer("mh")
2716  p.i = EDProducer("mi")
2717  p.j = EDProducer("mj")
2718  self.assertEqual(p.dumpPython(),
2719 """import FWCore.ParameterSet.Config as cms
2720 
2721 process = cms.Process("test")
2722 
2723 process.a = cms.EDProducer("ma")
2724 
2725 
2726 process.c = cms.EDProducer("mc")
2727 
2728 
2729 process.d = cms.EDProducer("md")
2730 
2731 
2732 process.e = cms.EDProducer("me")
2733 
2734 
2735 process.f = cms.EDProducer("mf")
2736 
2737 
2738 process.g = cms.EDProducer("mg")
2739 
2740 
2741 process.h = cms.EDProducer("mh")
2742 
2743 
2744 process.i = cms.EDProducer("mi")
2745 
2746 
2747 process.j = cms.EDProducer("mj")
2748 
2749 
2750 process.b = cms.EDAnalyzer("mb")
2751 
2752 
2753 process.t8 = cms.Task(cms.TaskPlaceholder("j"))
2754 
2755 
2756 process.t6 = cms.Task(cms.TaskPlaceholder("h"))
2757 
2758 
2759 process.t7 = cms.Task(cms.TaskPlaceholder("i"), process.a, process.t6)
2760 
2761 
2762 process.t4 = cms.Task(cms.TaskPlaceholder("f"))
2763 
2764 
2765 process.t5 = cms.Task(cms.TaskPlaceholder("g"), cms.TaskPlaceholder("t4"), process.a)
2766 
2767 
2768 process.t3 = cms.Task(cms.TaskPlaceholder("e"))
2769 
2770 
2771 process.t1 = cms.Task(cms.TaskPlaceholder("c"))
2772 
2773 
2774 process.t2 = cms.Task(cms.TaskPlaceholder("d"), process.a, process.t1)
2775 
2776 
2777 process.path1 = cms.Path(process.b, process.t2, process.t3)
2778 
2779 
2780 process.endpath1 = cms.EndPath(process.b, process.t5)
2781 
2782 
2783 process.schedule = cms.Schedule(*[ process.path1, process.endpath1 ], tasks=[process.t7, process.t8])
2784 """)
2785  p.resolve()
2786  self.assertEqual(p.dumpPython(),
2787 """import FWCore.ParameterSet.Config as cms
2788 
2789 process = cms.Process("test")
2790 
2791 process.a = cms.EDProducer("ma")
2792 
2793 
2794 process.c = cms.EDProducer("mc")
2795 
2796 
2797 process.d = cms.EDProducer("md")
2798 
2799 
2800 process.e = cms.EDProducer("me")
2801 
2802 
2803 process.f = cms.EDProducer("mf")
2804 
2805 
2806 process.g = cms.EDProducer("mg")
2807 
2808 
2809 process.h = cms.EDProducer("mh")
2810 
2811 
2812 process.i = cms.EDProducer("mi")
2813 
2814 
2815 process.j = cms.EDProducer("mj")
2816 
2817 
2818 process.b = cms.EDAnalyzer("mb")
2819 
2820 
2821 process.t8 = cms.Task(process.j)
2822 
2823 
2824 process.t6 = cms.Task(process.h)
2825 
2826 
2827 process.t7 = cms.Task(process.a, process.i, process.t6)
2828 
2829 
2830 process.t4 = cms.Task(process.f)
2831 
2832 
2833 process.t5 = cms.Task(process.a, process.g, process.t4)
2834 
2835 
2836 process.t3 = cms.Task(process.e)
2837 
2838 
2839 process.t1 = cms.Task(process.c)
2840 
2841 
2842 process.t2 = cms.Task(process.a, process.d, process.t1)
2843 
2844 
2845 process.path1 = cms.Path(process.b, process.t2, process.t3)
2846 
2847 
2848 process.endpath1 = cms.EndPath(process.b, process.t5)
2849 
2850 
2851 process.schedule = cms.Schedule(*[ process.path1, process.endpath1 ], tasks=[process.t7, process.t8])
2852 """)
2853 
def testTaskPlaceholder(self)
Definition: Config.py:2695
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 2442 of file Config.py.

2442  def testUsing(self):
2443  p = Process('test')
2444  p.block = PSet(a = int32(1))
2445  p.modu = EDAnalyzer('Analyzer', p.block, b = int32(2))
2446  self.assertEqual(p.modu.a.value(),1)
2447  self.assertEqual(p.modu.b.value(),2)
2448 

Member Data Documentation

Config.TestModuleCommand.a

Definition at line 2983 of file Config.py.

Config.TestModuleCommand.proc_mod_

Definition at line 2980 of file Config.py.