The Gaudi Framework  master (b9786168)
Loading...
Searching...
No Matches
CFinViewTest.py
Go to the documentation of this file.
1#!/usr/bin/env gaudirun.py
2
12"""
13A test for control flow scheduling within sub-event contexts.
14The sub-event control flow node has a child node attached.
15
16The ViewTester is an algorithm specifically designed to create sub-event
17contexts, pass them to the scheduler, and report on the current context.
18
19Six 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 - Algorithms B1 and B2 run within the sub-event contexts,
23 on a child control flow node
24 - Algorithm A4 runs in the whole event context, after the sub-events
25
26"""
27
28from Configurables import (
29 AlgResourcePool,
30 AvalancheSchedulerSvc,
31 Gaudi__Sequencer,
32 HiveSlimEventLoopMgr,
33 HiveWhiteBoard,
34 Test__ViewTester,
35)
36from Gaudi.Configuration import *
37
38# metaconfig -------------------------------------------------------------------
39# It's confortable to collect the relevant parameters at the top of the optionfile
40evtslots = 1
41evtMax = 10
42cardinality = 1
43threads = 1
44viewsPerEvt = 2
45# -------------------------------------------------------------------------------
46
47# The configuration of the whiteboard ------------------------------------------
48# It is useful to call it EventDataSvc to replace the usual data service with
49# the whiteboard transparently.
50
51whiteboard = HiveWhiteBoard("EventDataSvc", EventSlots=evtslots)
52
53# -------------------------------------------------------------------------------
54
55# Event Loop Manager -----------------------------------------------------------
56# It's called slim since it has less functionalities overall than the good-old
57# event loop manager. Here we just set its outputlevel to DEBUG.
58
59slimeventloopmgr = HiveSlimEventLoopMgr(
60 SchedulerName="AvalancheSchedulerSvc", OutputLevel=DEBUG
61)
62
63# -------------------------------------------------------------------------------
64
65# ForwardScheduler -------------------------------------------------------------
66# We just decide how many algorithms in flight we want to have and how many
67# threads in the pool. The default value is -1, which is for TBB equivalent
68# to take over the whole machine.
69
70scheduler = AvalancheSchedulerSvc(ThreadPoolSize=threads, OutputLevel=INFO)
71
72# -------------------------------------------------------------------------------
73
74# Algo Resource Pool -----------------------------------------------------------
75# Nothing special here, we just set the debug level.
76AlgResourcePool(OutputLevel=DEBUG)
77
78# -------------------------------------------------------------------------------
79
80# Set up of the crunchers, daily business --------------------------------------
81
82a1 = Test__ViewTester("A1")
83a1.baseViewName = "view"
84a1.viewNumber = viewsPerEvt
85a1.viewNodeName = "viewNode"
86
87a2 = Test__ViewTester("A2")
88a2.viewNodeName = ""
89
90a3 = Test__ViewTester("A3")
91a3.viewNodeName = ""
92
93a4 = Test__ViewTester("A4")
94a4.viewNodeName = ""
95
96b1 = Test__ViewTester("B1")
97b1.viewNodeName = ""
98
99b2 = Test__ViewTester("B2")
100b2.viewNodeName = ""
101
102for algo in [a1, a2, a3, a4, b1, b2]:
103 algo.Cardinality = cardinality
104 algo.OutputLevel = DEBUG
105
106nodeInView = Gaudi__Sequencer(
107 "nodeInView", Members=[b1, b2], Sequential=False, OutputLevel=VERBOSE
108)
109
110viewNode = Gaudi__Sequencer(
111 "viewNode", Members=[a2, nodeInView, a3], Sequential=False, OutputLevel=VERBOSE
112)
113
114createViewSeq = Gaudi__Sequencer(
115 "createViewSeq", Members=[a1, viewNode, a4], Sequential=True, OutputLevel=VERBOSE
116)
117
118# Application Manager ----------------------------------------------------------
119# We put everything together and change the type of message service
120
122 EvtMax=evtMax,
123 EvtSel="NONE",
124 ExtSvc=[whiteboard],
125 EventLoop=slimeventloopmgr,
126 TopAlg=[createViewSeq],
127 MessageSvcType="InertMessageSvc",
128)
129
130# -------------------------------------------------------------------------------
The AlgResourcePool is a concrete implementation of the IAlgResourcePool interface.
The Application Manager class.
Data service base class.