The Gaudi Framework
master (0ea74171)
Toggle main menu visibility
Loading...
Searching...
No Matches
SubSlotException.py
Go to the documentation of this file.
1
#!/usr/bin/env gaudirun.py
2
12
"""
13
A test for an incorrect handling of exceptions from algorithms running in sub-slots
14
15
Throwing an exception causes the event to be marked as failed.
16
It also means that the part of the code that updates the algorithm state is bypassed.
17
Since the AlgExecStateSvc does not (currently) understand sub-slots,
18
if the exception is thrown by an alg in sub-slot 2, the state for that same alg
19
in sub-slot 1 is retrieved.
20
21
So, it is possible to have a failed event, without any algorihms in ERROR state.
22
The scheduler does not have handling for this, and hangs.
23
24
"""
25
26
from
Configurables
import
(
27
AlgResourcePool,
28
AvalancheSchedulerSvc,
29
CPUCruncher,
30
Gaudi__Sequencer,
31
GaudiTesting__StopLoopAlg,
32
HiveSlimEventLoopMgr,
33
HiveWhiteBoard,
34
Test__ViewTester,
35
)
36
from
Gaudi.Configuration
import
*
37
38
# metaconfig -------------------------------------------------------------------
39
# It's confortable to collect the relevant parameters at the top of the optionfile
40
evtslots = 1
41
evtMax = 10
42
cardinality = 1
43
threads = 1
44
viewsPerEvt = 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
51
whiteboard =
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 INFO.
58
59
slimeventloopmgr =
HiveSlimEventLoopMgr
(
60
SchedulerName=
"AvalancheSchedulerSvc"
, OutputLevel=INFO
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
70
scheduler =
AvalancheSchedulerSvc
(
71
ThreadPoolSize=threads, OutputLevel=INFO, VerboseSubSlots=
True
72
)
73
74
# -------------------------------------------------------------------------------
75
76
# Algo Resource Pool -----------------------------------------------------------
77
# Nothing special here, we just set the debug level.
78
AlgResourcePool
(OutputLevel=INFO)
79
80
# -------------------------------------------------------------------------------
81
82
# Set up of the crunchers, daily business --------------------------------------
83
84
a1 = Test__ViewTester(
"A1"
)
85
a1.baseViewName =
"view"
86
a1.viewNumber = viewsPerEvt
87
a1.viewNodeName =
"viewNode"
88
89
a2 = Test__ViewTester(
"A2"
)
90
a2.viewNodeName =
""
91
92
# EventCount is tracked by a private member of the algorithm, so increments whenever it is run
93
# EventCount = 2 corresponds to the 1st view of the 2nd event, giving a correctly-handled exception
94
# EventCount = 3 corresponds to the 2nd view of the 2nd event, causing the hang
95
a3 = GaudiTesting__StopLoopAlg(
"A3"
, EventCount=3, Mode=
"exception"
)
96
97
a4 = Test__ViewTester(
"A4"
)
98
a4.viewNodeName =
""
99
100
for
algo
in
[a1, a2, a3, a4]:
101
algo.Cardinality = cardinality
102
algo.OutputLevel = INFO
103
104
viewNode = Gaudi__Sequencer(
105
"viewNode"
, Members=[a2, a3], Sequential=
False
, ShortCircuit=
False
, OutputLevel=INFO
106
)
107
108
createViewSeq = Gaudi__Sequencer(
109
"createViewSeq"
, Members=[a1, viewNode, a4], Sequential=
True
, OutputLevel=INFO
110
)
111
112
# Application Manager ----------------------------------------------------------
113
# We put everything together and change the type of message service
114
115
ApplicationMgr
(
116
EvtMax=evtMax,
117
EvtSel=
"NONE"
,
118
ExtSvc=[whiteboard],
119
EventLoop=slimeventloopmgr,
120
TopAlg=[createViewSeq],
121
MessageSvcType=
"InertMessageSvc"
,
122
)
123
124
# -------------------------------------------------------------------------------
AlgResourcePool
The AlgResourcePool is a concrete implementation of the IAlgResourcePool interface.
Definition
AlgResourcePool.h:35
ApplicationMgr
The Application Manager class.
Definition
ApplicationMgr.h:54
AvalancheSchedulerSvc
Definition
AvalancheSchedulerSvc.h:114
HiveSlimEventLoopMgr
Definition
HiveSlimEventLoopMgr.h:31
HiveWhiteBoard
Data service base class.
Definition
HiveWhiteBoard.cpp:100
Gaudi.Configuration
Definition
Configuration.py:1
GaudiHive
options
SubSlotException.py
Generated on
for The Gaudi Framework by
1.17.0