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