The Gaudi Framework  master (82fdf313)
Loading...
Searching...
No Matches
CFBugWithEmptyNode.py
Go to the documentation of this file.
1#!/usr/bin/env gaudirun.py
2
12"""
13A test for a control flow bug arising from empty graph nodes
14
15An empty node with ModeOR=True will return a default decision of False, without any algs needing evaluation
16This can have the effect of short-circuiting/early return from its parent node, while also continuing
17evaluation within that parent - see https://gitlab.cern.ch/gaudi/Gaudi/-/issues/135
18
19In this test, A2 will run unless the bug has been fixed
20"""
21
22from Configurables import (
23 AlgResourcePool,
24 AvalancheSchedulerSvc,
25 Gaudi__Sequencer,
26 HiveSlimEventLoopMgr,
27 HiveWhiteBoard,
28 Test__ViewTester,
29)
30from Gaudi.Configuration import *
31
32# metaconfig -------------------------------------------------------------------
33# It's confortable to collect the relevant parameters at the top of the optionfile
34evtslots = 1
35evtMax = 1
36cardinality = 1
37threads = 1
38# -------------------------------------------------------------------------------
39
40# The configuration of the whiteboard ------------------------------------------
41# It is useful to call it EventDataSvc to replace the usual data service with
42# the whiteboard transparently.
43
44whiteboard = HiveWhiteBoard("EventDataSvc", EventSlots=evtslots)
45
46# -------------------------------------------------------------------------------
47
48# Event Loop Manager -----------------------------------------------------------
49# It's called slim since it has less functionalities overall than the good-old
50# event loop manager. Here we just set its outputlevel to DEBUG.
51
52slimeventloopmgr = HiveSlimEventLoopMgr(
53 SchedulerName="AvalancheSchedulerSvc", OutputLevel=INFO
54)
55
56# -------------------------------------------------------------------------------
57
58# ForwardScheduler -------------------------------------------------------------
59# We just decide how many algorithms in flight we want to have and how many
60# threads in the pool. The default value is -1, which is for TBB equivalent
61# to take over the whole machine.
62
63scheduler = AvalancheSchedulerSvc(ThreadPoolSize=threads, OutputLevel=VERBOSE)
64
65# -------------------------------------------------------------------------------
66
67# Algo Resource Pool -----------------------------------------------------------
68# Nothing special here, we just set the debug level.
69AlgResourcePool(OutputLevel=INFO)
70
71# -------------------------------------------------------------------------------
72
73# Set up of the crunchers, daily business --------------------------------------
74
75a1 = Test__ViewTester("A1")
76a1.Cardinality = cardinality
77a1.OutputLevel = INFO
78a1.viewNodeName = ""
79a2 = Test__ViewTester("A2")
80a2.Cardinality = cardinality
81a2.OutputLevel = INFO
82a2.viewNodeName = ""
83
84emptySeq = Gaudi__Sequencer(
85 "emptySeq",
86 Members=[],
87 Sequential=False,
88 ModeOR=True,
89 ShortCircuit=False,
90 OutputLevel=INFO,
91)
92
93topSeq = Gaudi__Sequencer(
94 "topSeq",
95 # Members=[emptySeq, a1], #This finds a different bug/quirk
96 Members=[a1, emptySeq, a2],
97 Sequential=True,
98 ModeOR=False,
99 ShortCircuit=True,
100 OutputLevel=INFO,
101)
102
103# Application Manager ----------------------------------------------------------
104# We put everything together and change the type of message service
105
107 EvtMax=evtMax,
108 EvtSel="NONE",
109 ExtSvc=[whiteboard],
110 EventLoop=slimeventloopmgr,
111 TopAlg=[topSeq],
112 MessageSvcType="InertMessageSvc",
113)
114
115# -------------------------------------------------------------------------------
The AlgResourcePool is a concrete implementation of the IAlgResourcePool interface.
The Application Manager class.
Data service base class.