The Gaudi Framework  master (1304469f)
Loading...
Searching...
No Matches
SubSlotVsSlotIsolation.py
Go to the documentation of this file.
1#!/usr/bin/env gaudirun.py
2
12"""
13A test for isolating sub-slot data from the parent slot.
14The main sequence has two steps of creating and running sub-events.
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
19Seven instances of ViewTester are used as follows:
20 - Algorithm A1 creates a sub-event context
21 - Algorithms A2 and A3 run within the sub-event, sharing data
22 - Algorithm A4 creates another sub-event contexts, and a data output
23 - Algorithms A5 and A6 run within the new sub-event, but cannot access data from A4
24 - Algorithm A7 runs in the whole event context, after the sub-events
25
26The test should stall if isolation is working
27"""
28
29from Configurables import (
30 AlgResourcePool,
31 AvalancheSchedulerSvc,
32 Gaudi__Sequencer,
33 HiveSlimEventLoopMgr,
34 HiveWhiteBoard,
35 Test__ViewTester,
36)
37from Gaudi.Configuration import *
38
39# metaconfig -------------------------------------------------------------------
40# It's confortable to collect the relevant parameters at the top of the optionfile
41evtslots = 1
42evtMax = 1
43cardinality = 1
44threads = 1
45viewsPerEvt = 1
46# -------------------------------------------------------------------------------
47
48# The configuration of the whiteboard ------------------------------------------
49# It is useful to call it EventDataSvc to replace the usual data service with
50# the whiteboard transparently.
51
52whiteboard = HiveWhiteBoard("EventDataSvc", EventSlots=evtslots)
53
54# -------------------------------------------------------------------------------
55
56# Event Loop Manager -----------------------------------------------------------
57# It's called slim since it has less functionalities overall than the good-old
58# event loop manager. Here we just set its outputlevel to DEBUG.
59
60slimeventloopmgr = HiveSlimEventLoopMgr(
61 SchedulerName="AvalancheSchedulerSvc", OutputLevel=DEBUG
62)
63
64# -------------------------------------------------------------------------------
65
66# ForwardScheduler -------------------------------------------------------------
67# We just decide how many algorithms in flight we want to have and how many
68# threads in the pool. The default value is -1, which is for TBB equivalent
69# to take over the whole machine.
70
72 ThreadPoolSize=threads, OutputLevel=INFO, VerboseSubSlots=True
73)
74
75# -------------------------------------------------------------------------------
76
77# Algo Resource Pool -----------------------------------------------------------
78# Nothing special here, we just set the debug level.
79AlgResourcePool(OutputLevel=DEBUG)
80
81# -------------------------------------------------------------------------------
82
83# Set up of the crunchers, daily business --------------------------------------
84
85a1 = Test__ViewTester("A1")
86a1.baseViewName = "viewOne"
87a1.viewNumber = viewsPerEvt
88a1.viewNodeName = "viewNodeOne"
89
90a2 = Test__ViewTester("A2")
91a2.viewNodeName = ""
92a2.outKeys = ["/Event/a2"]
93
94a3 = Test__ViewTester("A3")
95a3.viewNodeName = ""
96a3.inpKeys = ["/Event/a2"] # Should be able to load a2 from the shared sub-slot
97
98a4 = Test__ViewTester("A4")
99a4.baseViewName = "viewTwo"
100a4.viewNumber = viewsPerEvt
101a4.viewNodeName = "viewNodeTwo"
102a4.outKeys = ["/Event/a4"]
103
104a5 = Test__ViewTester("A5")
105a5.viewNodeName = ""
106a5.inpKeys = ["/Event/a4"] # Should not be able to load a4 from the "whole event" slot
107
108a6 = Test__ViewTester("A6")
109a6.viewNodeName = ""
110
111a7 = Test__ViewTester("A7")
112a7.viewNodeName = ""
113
114for algo in [a1, a2, a3, a4, a5, a6, a7]:
115 algo.Cardinality = cardinality
116 algo.OutputLevel = DEBUG
117
118viewNodeOne = Gaudi__Sequencer(
119 "viewNodeOne", Members=[a2, a3], Sequential=False, ShortCircuit=False
120)
121
122viewNodeTwo = Gaudi__Sequencer(
123 "viewNodeTwo", Members=[a5, a6], Sequential=False, ShortCircuit=False
124)
125
126createViewSeq = Gaudi__Sequencer(
127 "createViewSeq",
128 Members=[a1, viewNodeOne, a4, viewNodeTwo, a7],
129 Sequential=True,
130 OutputLevel=VERBOSE,
131)
132
133# Application Manager ----------------------------------------------------------
134# We put everything together and change the type of message service
135
137 EvtMax=evtMax,
138 EvtSel="NONE",
139 ExtSvc=[whiteboard],
140 EventLoop=slimeventloopmgr,
141 TopAlg=[createViewSeq],
142 MessageSvcType="InertMessageSvc",
143)
144
145# -------------------------------------------------------------------------------
The AlgResourcePool is a concrete implementation of the IAlgResourcePool interface.
The Application Manager class.
Data service base class.