| The Gaudi Framework v32r1 (f65d50dc)

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