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