| The Gaudi Framework v32r1 (f65d50dc)

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