The Gaudi Framework  master (37c0b60a)
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 
22 from Configurables import (
23  AlgResourcePool,
24  AvalancheSchedulerSvc,
25  Gaudi__Sequencer,
26  HiveSlimEventLoopMgr,
27  HiveWhiteBoard,
28  Test__ViewTester,
29 )
30 from Gaudi.Configuration import *
31 
32 # metaconfig -------------------------------------------------------------------
33 # It's confortable to collect the relevant parameters at the top of the optionfile
34 evtslots = 1
35 evtMax = 1
36 cardinality = 1
37 threads = 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 
44 whiteboard = 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 
52 slimeventloopmgr = 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 
63 scheduler = AvalancheSchedulerSvc(ThreadPoolSize=threads, OutputLevel=VERBOSE)
64 
65 # -------------------------------------------------------------------------------
66 
67 # Algo Resource Pool -----------------------------------------------------------
68 # Nothing special here, we just set the debug level.
69 AlgResourcePool(OutputLevel=INFO)
70 
71 # -------------------------------------------------------------------------------
72 
73 # Set up of the crunchers, daily business --------------------------------------
74 
75 a1 = Test__ViewTester("A1")
76 a1.Cardinality = cardinality
77 a1.OutputLevel = INFO
78 a1.viewNodeName = ""
79 a2 = Test__ViewTester("A2")
80 a2.Cardinality = cardinality
81 a2.OutputLevel = INFO
82 a2.viewNodeName = ""
83 
84 emptySeq = Gaudi__Sequencer(
85  "emptySeq",
86  Members=[],
87  Sequential=False,
88  ModeOR=True,
89  ShortCircuit=False,
90  OutputLevel=INFO,
91 )
92 
93 topSeq = 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 # -------------------------------------------------------------------------------
Gaudi.Configuration
Definition: Configuration.py:1
ApplicationMgr
Definition: ApplicationMgr.h:57