| The Gaudi Framework v32r1 (f65d50dc)

CFinViewTest.py
Go to the documentation of this file.
1 #!/usr/bin/env gaudirun.py
2 '''
3 A test for control flow scheduling within sub-event contexts.
4 The sub-event control flow node has a child node attached.
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 Six 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 - Algorithms B1 and B2 run within the sub-event contexts,
13 on a child control flow node
14 - Algorithm A4 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 = 'view'
67 a1.viewNumber = viewsPerEvt
68 a1.viewNodeName = 'viewNode'
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.viewNodeName = ''
78
79 b1 = Test__ViewTester("B1")
80 b1.viewNodeName = ''
81
82 b2 = Test__ViewTester("B2")
83 b2.viewNodeName = ''
84
85 for algo in [a1, a2, a3, a4, b1, b2]:
86 algo.Cardinality = cardinality
87 algo.OutputLevel = DEBUG
88
89 nodeInView = GaudiSequencer(
90 "nodeInView", Members=[b1, b2], Sequential=False, OutputLevel=VERBOSE)
91
92 viewNode = GaudiSequencer(
93 "viewNode",
94 Members=[a2, nodeInView, a3],
95 Sequential=False,
96 OutputLevel=VERBOSE)
97
98 createViewSeq = GaudiSequencer(
99 "createViewSeq",
100 Members=[a1, viewNode, a4],
101 Sequential=True,
102 OutputLevel=VERBOSE)
103
104 # Application Manager ----------------------------------------------------------
105 # We put everything together and change the type of message service
106
107 ApplicationMgr(
108 EvtMax=evtMax,
109 EvtSel='NONE',
110 ExtSvc=[whiteboard],
111 EventLoop=slimeventloopmgr,
112 TopAlg=[createViewSeq],
113 MessageSvcType="InertMessageSvc")
114
115 # -------------------------------------------------------------------------------
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