The Gaudi Framework  master (37c0b60a)
ConditionsStallTest.py
Go to the documentation of this file.
1 #!/usr/bin/env gaudirun.py
2 
12 """
13 A test to demonstrate stalling for a conditions algorithm
14 
15  - Control flow requires that Alg C run after Alg B
16  - Alg B requires conditions data produced by Alg A
17  - However, Alg A requires the output from Alg C, and thus the job will stall
18 
19 """
20 
21 from Configurables import (
22  AlgResourcePool,
23  AvalancheSchedulerSvc,
24  HiveSlimEventLoopMgr,
25  HiveWhiteBoard,
26  Test__ViewTester,
27 )
28 from Gaudi.Configuration import *
29 
30 # metaconfig -------------------------------------------------------------------
31 # It's confortable to collect the relevant parameters at the top of the optionfile
32 evtslots = 1
33 evtMax = 10
34 threads = 1
35 # -------------------------------------------------------------------------------
36 
37 # The configuration of the whiteboard ------------------------------------------
38 # It is useful to call it EventDataSvc to replace the usual data service with
39 # the whiteboard transparently.
40 
41 whiteboard = HiveWhiteBoard("EventDataSvc", EventSlots=evtslots)
42 
43 # -------------------------------------------------------------------------------
44 
45 # Event Loop Manager -----------------------------------------------------------
46 # It's called slim since it has less functionalities overall than the good-old
47 # event loop manager. Here we just set its outputlevel to DEBUG.
48 
49 slimeventloopmgr = HiveSlimEventLoopMgr(
50  SchedulerName="AvalancheSchedulerSvc", OutputLevel=INFO
51 )
52 
53 # -------------------------------------------------------------------------------
54 
55 # ForwardScheduler -------------------------------------------------------------
56 # We just decide how many algorithms in flight we want to have and how many
57 # threads in the pool. The default value is -1, which is for TBB equivalent
58 # to take over the whole machine.
59 
60 scheduler = AvalancheSchedulerSvc(
61  ThreadPoolSize=threads, OutputLevel=INFO, CheckDependencies=True, DataLoaderAlg=""
62 )
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 # Conditions service -----------------------------------------------------------
73 # This declares algorithms or data to be part of the "conditions realm"
74 # They are detached from the regular CF graph
75 from Configurables import Gaudi__TestSuite__Conditions__CondSvc as CS
76 
77 condSvc = CS(name="CondSvc", Algs=["AlgA"], Data=["/Event/A1"])
78 
79 # -------------------------------------------------------------------------------
80 
81 # Set up of the crunchers, daily business --------------------------------------
82 
83 a1 = Test__ViewTester("AlgA", OutputLevel=INFO)
84 a1.outKeys = ["/Event/A1"]
85 a1.inpKeys = ["/Event/A2"]
86 
87 a2 = Test__ViewTester("AlgB", OutputLevel=INFO)
88 a2.inpKeys = ["/Event/A1"]
89 
90 a3 = Test__ViewTester("AlgC", OutputLevel=INFO)
91 a3.outKeys = ["/Event/A2"]
92 
93 algSeq = Gaudi__Sequencer(
94  "algSeq", Members=[a1, a2, a3], Sequential=True, OutputLevel=INFO
95 )
96 
97 # Application Manager ----------------------------------------------------------
98 # We put everything together and change the type of message service
99 
101  EvtMax=evtMax,
102  EvtSel="NONE",
103  ExtSvc=[whiteboard, condSvc],
104  EventLoop=slimeventloopmgr,
105  TopAlg=[algSeq],
106  MessageSvcType="InertMessageSvc",
107 )
108 
109 # -------------------------------------------------------------------------------
Gaudi.Configuration
Definition: Configuration.py:1
ApplicationMgr
Definition: ApplicationMgr.h:57