| The Gaudi Framework v32r1 (f65d50dc)

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