The Gaudi Framework  master (181af51f)
Loading...
Searching...
No Matches
SubSlotException.py
Go to the documentation of this file.
1#!/usr/bin/env gaudirun.py
2
12"""
13A test for an incorrect handling of exceptions from algorithms running in sub-slots
14
15Throwing an exception causes the event to be marked as failed.
16It also means that the part of the code that updates the algorithm state is bypassed.
17Since the AlgExecStateSvc does not (currently) understand sub-slots,
18if the exception is thrown by an alg in sub-slot 2, the state for that same alg
19in sub-slot 1 is retrieved.
20
21So, it is possible to have a failed event, without any algorihms in ERROR state.
22The scheduler does not have handling for this, and hangs.
23
24"""
25
26from Configurables import (
27 AlgResourcePool,
28 AvalancheSchedulerSvc,
29 CPUCruncher,
30 Gaudi__Sequencer,
31 GaudiTesting__StopLoopAlg,
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 INFO.
58
59slimeventloopmgr = 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
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.
78AlgResourcePool(OutputLevel=INFO)
79
80# -------------------------------------------------------------------------------
81
82# Set up of the crunchers, daily business --------------------------------------
83
84a1 = Test__ViewTester("A1")
85a1.baseViewName = "view"
86a1.viewNumber = viewsPerEvt
87a1.viewNodeName = "viewNode"
88
89a2 = Test__ViewTester("A2")
90a2.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
95a3 = GaudiTesting__StopLoopAlg("A3", EventCount=3, Mode="exception")
96
97a4 = Test__ViewTester("A4")
98a4.viewNodeName = ""
99
100for algo in [a1, a2, a3, a4]:
101 algo.Cardinality = cardinality
102 algo.OutputLevel = INFO
103
104viewNode = Gaudi__Sequencer(
105 "viewNode", Members=[a2, a3], Sequential=False, ShortCircuit=False, OutputLevel=INFO
106)
107
108createViewSeq = 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
116 EvtMax=evtMax,
117 EvtSel="NONE",
118 ExtSvc=[whiteboard],
119 EventLoop=slimeventloopmgr,
120 TopAlg=[createViewSeq],
121 MessageSvcType="InertMessageSvc",
122)
123
124# -------------------------------------------------------------------------------
The AlgResourcePool is a concrete implementation of the IAlgResourcePool interface.
The Application Manager class.
Data service base class.