Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v31r0 (aeb156f0)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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", Members=[extraNode], Sequential=False, OutputLevel=INFO)
94 
95 viewNodeTwo = GaudiSequencer(
96  "viewNodeTwo", Members=[extraNode], Sequential=False, OutputLevel=INFO)
97 
98 createViewSeq = GaudiSequencer(
99  "createViewSeq",
100  Members=[a1, viewNodeOne, a4, viewNodeTwo, a5],
101  Sequential=True,
102  OutputLevel=INFO)
103 
104 # Application Manager ----------------------------------------------------------
105 # We put everything together and change the type of message service
106 
108  EvtMax=evtMax,
109  EvtSel='NONE',
110  ExtSvc=[whiteboard],
111  EventLoop=slimeventloopmgr,
112  TopAlg=[createViewSeq],
113  MessageSvcType="InertMessageSvc")
114 
115 # -------------------------------------------------------------------------------
Sequencer for executing several algorithms, stopping when one is faulty.
The AlgResourcePool is a concrete implementation of the IAlgResourcePool interface.
Data service base class.
The Application Manager class.