The Gaudi Framework  v36r1 (3e2fb5a8)
ViewIsolationTest.py
Go to the documentation of this file.
1 #!/usr/bin/env gaudirun.py
2 
12 '''
13 A test for issue 13 in gitlab.
14 Two different sets of sub-event contexts are created, and the
15 same algorithms (attached to a common control flow node) run in each
16 
17 The ViewTester is an algorithm specifically designed to create sub-event
18 contexts, pass them to the scheduler, and report on the current context.
19 
20 Five instances of ViewTester are used as follows:
21  - Algorithm A1 creates two sub-event contexts
22  - Algorithms A2 and A3 run within the sub-event contexts
23  - Algorithm A4 creates two more sub-event contexts
24  - Algorithms A2 and A3 run again, in the new contexts
25  - Algorithm A5 runs in the whole event context, after the sub-events
26 
27 '''
28 from Gaudi.Configuration import *
29 from Configurables import (HiveWhiteBoard, HiveSlimEventLoopMgr,
30  AvalancheSchedulerSvc, AlgResourcePool, CPUCruncher,
31  GaudiSequencer, Test__ViewTester)
32 
33 # metaconfig -------------------------------------------------------------------
34 # It's confortable to collect the relevant parameters at the top of the optionfile
35 evtslots = 1
36 evtMax = 10
37 cardinality = 1
38 threads = 1
39 viewsPerEvt = 2
40 # -------------------------------------------------------------------------------
41 
42 # The configuration of the whiteboard ------------------------------------------
43 # It is useful to call it EventDataSvc to replace the usual data service with
44 # the whiteboard transparently.
45 
46 whiteboard = HiveWhiteBoard("EventDataSvc", EventSlots=evtslots)
47 
48 # -------------------------------------------------------------------------------
49 
50 # Event Loop Manager -----------------------------------------------------------
51 # It's called slim since it has less functionalities overall than the good-old
52 # event loop manager. Here we just set its outputlevel to DEBUG.
53 
54 slimeventloopmgr = HiveSlimEventLoopMgr(
55  SchedulerName="AvalancheSchedulerSvc", OutputLevel=INFO)
56 
57 # -------------------------------------------------------------------------------
58 
59 # ForwardScheduler -------------------------------------------------------------
60 # We just decide how many algorithms in flight we want to have and how many
61 # threads in the pool. The default value is -1, which is for TBB equivalent
62 # to take over the whole machine.
63 
64 scheduler = AvalancheSchedulerSvc(ThreadPoolSize=threads, OutputLevel=INFO)
65 
66 # -------------------------------------------------------------------------------
67 
68 # Algo Resource Pool -----------------------------------------------------------
69 # Nothing special here, we just set the debug level.
70 AlgResourcePool(OutputLevel=INFO)
71 
72 # -------------------------------------------------------------------------------
73 
74 # Set up of the crunchers, daily business --------------------------------------
75 
76 a1 = Test__ViewTester("A1")
77 a1.baseViewName = 'viewOne'
78 a1.viewNumber = viewsPerEvt
79 a1.viewNodeName = 'viewNodeOne'
80 
81 a2 = Test__ViewTester("A2")
82 a2.viewNodeName = ''
83 
84 a3 = Test__ViewTester("A3")
85 a3.viewNodeName = ''
86 
87 a4 = Test__ViewTester("A4")
88 a4.baseViewName = 'viewTwo'
89 a4.viewNumber = viewsPerEvt
90 a4.viewNodeName = 'viewNodeTwo'
91 
92 a5 = Test__ViewTester("A5")
93 a5.viewNodeName = ''
94 
95 for algo in [a1, a2, a3, a4, a5]:
96  algo.Cardinality = cardinality
97  algo.OutputLevel = INFO
98 
99 extraNode = GaudiSequencer(
100  "extraNode", Members=[a2, a3], Sequential=True, OutputLevel=INFO)
101 
102 viewNodeOne = GaudiSequencer(
103  "viewNodeOne",
104  Members=[extraNode],
105  Sequential=False,
106  ShortCircuit=False,
107  OutputLevel=INFO)
108 
109 viewNodeTwo = GaudiSequencer(
110  "viewNodeTwo",
111  Members=[extraNode],
112  Sequential=False,
113  ShortCircuit=False,
114  OutputLevel=INFO)
115 
116 createViewSeq = GaudiSequencer(
117  "createViewSeq",
118  Members=[a1, viewNodeOne, a4, viewNodeTwo, a5],
119  Sequential=True,
120  OutputLevel=INFO)
121 
122 # Application Manager ----------------------------------------------------------
123 # We put everything together and change the type of message service
124 
126  EvtMax=evtMax,
127  EvtSel='NONE',
128  ExtSvc=[whiteboard],
129  EventLoop=slimeventloopmgr,
130  TopAlg=[createViewSeq],
131  MessageSvcType="InertMessageSvc")
132 
133 # -------------------------------------------------------------------------------
Gaudi.Configuration
Definition: Configuration.py:1
ApplicationMgr
Definition: ApplicationMgr.h:57