| The Gaudi Framework v32r1 (f65d50dc)

ControlFlowBranching+CrossBranchDataFlow.py
Go to the documentation of this file.
1 #!/usr/bin/env gaudirun.py
2 """
3 Typically, an EVTREJECTED algorithm is used to "short-circuit" the execution flow within
4 the group of algorithms it belongs to. Within such early-terminated group, a false-negative
5 data dependency resolution can never occur since all downstream algorithms are skipped.
6 However, there might be other algorithms - outside of the early-terminated group - that depend
7 on data outputs of the EVTREJECTED algorithm. The test emulates this scenario.
8 """
9
10 from Gaudi.Configuration import *
11 from Configurables import HiveWhiteBoard, HiveSlimEventLoopMgr, AvalancheSchedulerSvc, AlgResourcePool
12 from Configurables import GaudiSequencer, CPUCruncher, CPUCrunchSvc
13
14 # metaconfig
15 evtslots = 1
16 evtMax = 1
17 algosInFlight = 1
18
19 InertMessageSvc(OutputLevel=INFO)
20
21 whiteboard = HiveWhiteBoard(
22 "EventDataSvc", EventSlots=evtslots, OutputLevel=INFO)
23
24 slimeventloopmgr = HiveSlimEventLoopMgr(
25 SchedulerName="AvalancheSchedulerSvc", OutputLevel=DEBUG)
26
27 AvalancheSchedulerSvc(ThreadPoolSize=algosInFlight, OutputLevel=DEBUG)
28
29 AlgResourcePool(OutputLevel=DEBUG)
30
31 CPUCrunchSvc(shortCalib=True)
32
33 # Assemble data flow graph
34 # algorithm that triggers an early exit from "Branch2"
35 a1 = CPUCruncher("AlgA", InvertDecision=True)
36 a1.outKeys = ['/Event/A']
37
38 a2 = CPUCruncher("AlgB")
39 a2.inpKeys = ['/Event/A']
40
41 a3 = CPUCruncher("AlgC")
42 a3.inpKeys = ['/Event/A']
43
44 for a in [a1, a2, a3]:
45 a.avgRuntime = .01
46
47 # Assemble control flow graph
48 branch1 = GaudiSequencer("Branch1", ModeOR=False, ShortCircuit=False)
49 branch2 = GaudiSequencer(
50 "Branch2", ModeOR=False, ShortCircuit=True, Sequential=True)
51
52 branch2.Members = [a1, a2]
53 branch1.Members = [branch2, a3]
54
55 ApplicationMgr(
56 EvtMax=evtMax,
57 EvtSel='NONE',
58 ExtSvc=[whiteboard],
59 EventLoop=slimeventloopmgr,
60 TopAlg=[branch1],
61 MessageSvcType="InertMessageSvc",
62 OutputLevel=INFO)
InertMessageSvc
Thread safe extension to the standard MessageSvc.
Definition: InertMessageSvc.h:26
Gaudi.Configuration
Definition: Configuration.py:1
ApplicationMgr
The Application Manager class.
Definition: ApplicationMgr.h:45