The Gaudi Framework  v36r1 (3e2fb5a8)
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 Gaudi.Configuration import *
22 from Configurables import (HiveWhiteBoard, HiveSlimEventLoopMgr,
23  AvalancheSchedulerSvc, AlgResourcePool,
24  GaudiSequencer, Test__ViewTester)
25 
26 # metaconfig -------------------------------------------------------------------
27 # It's confortable to collect the relevant parameters at the top of the optionfile
28 evtslots = 1
29 evtMax = 1
30 cardinality = 1
31 threads = 1
32 # -------------------------------------------------------------------------------
33 
34 # The configuration of the whiteboard ------------------------------------------
35 # It is useful to call it EventDataSvc to replace the usual data service with
36 # the whiteboard transparently.
37 
38 whiteboard = HiveWhiteBoard("EventDataSvc", EventSlots=evtslots)
39 
40 # -------------------------------------------------------------------------------
41 
42 # Event Loop Manager -----------------------------------------------------------
43 # It's called slim since it has less functionalities overall than the good-old
44 # event loop manager. Here we just set its outputlevel to DEBUG.
45 
46 slimeventloopmgr = HiveSlimEventLoopMgr(
47  SchedulerName="AvalancheSchedulerSvc", OutputLevel=INFO)
48 
49 # -------------------------------------------------------------------------------
50 
51 # ForwardScheduler -------------------------------------------------------------
52 # We just decide how many algorithms in flight we want to have and how many
53 # threads in the pool. The default value is -1, which is for TBB equivalent
54 # to take over the whole machine.
55 
56 scheduler = AvalancheSchedulerSvc(ThreadPoolSize=threads, OutputLevel=VERBOSE)
57 
58 # -------------------------------------------------------------------------------
59 
60 # Algo Resource Pool -----------------------------------------------------------
61 # Nothing special here, we just set the debug level.
62 AlgResourcePool(OutputLevel=INFO)
63 
64 # -------------------------------------------------------------------------------
65 
66 # Set up of the crunchers, daily business --------------------------------------
67 
68 a1 = Test__ViewTester("A1")
69 a1.Cardinality = cardinality
70 a1.OutputLevel = INFO
71 a1.viewNodeName = ''
72 a2 = Test__ViewTester("A2")
73 a2.Cardinality = cardinality
74 a2.OutputLevel = INFO
75 a2.viewNodeName = ''
76 
77 emptySeq = GaudiSequencer(
78  "emptySeq",
79  Members=[],
80  Sequential=False,
81  ModeOR=True,
82  ShortCircuit=False,
83  OutputLevel=INFO)
84 
85 topSeq = GaudiSequencer(
86  "topSeq",
87  #Members=[emptySeq, a1], #This finds a different bug/quirk
88  Members=[a1, emptySeq, a2],
89  Sequential=True,
90  ModeOR=False,
91  ShortCircuit=True,
92  OutputLevel=INFO)
93 
94 # Application Manager ----------------------------------------------------------
95 # We put everything together and change the type of message service
96 
98  EvtMax=evtMax,
99  EvtSel='NONE',
100  ExtSvc=[whiteboard],
101  EventLoop=slimeventloopmgr,
102  TopAlg=[topSeq],
103  MessageSvcType="InertMessageSvc")
104 
105 # -------------------------------------------------------------------------------
Gaudi.Configuration
Definition: Configuration.py:1
ApplicationMgr
Definition: ApplicationMgr.h:57