Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v36r16 (ea80daf8)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 from Configurables import (
21  AlgResourcePool,
22  AvalancheSchedulerSvc,
23  HiveSlimEventLoopMgr,
24  HiveWhiteBoard,
25  Test__ViewTester,
26 )
27 from Gaudi.Configuration import *
28 
29 # metaconfig -------------------------------------------------------------------
30 # It's confortable to collect the relevant parameters at the top of the optionfile
31 evtslots = 1
32 evtMax = 10
33 threads = 1
34 # -------------------------------------------------------------------------------
35 
36 # The configuration of the whiteboard ------------------------------------------
37 # It is useful to call it EventDataSvc to replace the usual data service with
38 # the whiteboard transparently.
39 
40 whiteboard = HiveWhiteBoard("EventDataSvc", EventSlots=evtslots)
41 
42 # -------------------------------------------------------------------------------
43 
44 # Event Loop Manager -----------------------------------------------------------
45 # It's called slim since it has less functionalities overall than the good-old
46 # event loop manager. Here we just set its outputlevel to DEBUG.
47 
48 slimeventloopmgr = HiveSlimEventLoopMgr(
49  SchedulerName="AvalancheSchedulerSvc", OutputLevel=INFO
50 )
51 
52 # -------------------------------------------------------------------------------
53 
54 # ForwardScheduler -------------------------------------------------------------
55 # We just decide how many algorithms in flight we want to have and how many
56 # threads in the pool. The default value is -1, which is for TBB equivalent
57 # to take over the whole machine.
58 
59 scheduler = AvalancheSchedulerSvc(
60  ThreadPoolSize=threads, OutputLevel=INFO, CheckDependencies=True, DataLoaderAlg=""
61 )
62 
63 # -------------------------------------------------------------------------------
64 
65 # Algo Resource Pool -----------------------------------------------------------
66 # Nothing special here, we just set the debug level.
67 AlgResourcePool(OutputLevel=INFO)
68 
69 # -------------------------------------------------------------------------------
70 
71 # Conditions service -----------------------------------------------------------
72 # This declares algorithms or data to be part of the "conditions realm"
73 # They are detached from the regular CF graph
74 from Configurables import Gaudi__Examples__Conditions__CondSvc as CS
75 
76 condSvc = CS(name="CondSvc", Algs=["AlgA"], Data=["/Event/A1"])
77 
78 # -------------------------------------------------------------------------------
79 
80 # Set up of the crunchers, daily business --------------------------------------
81 
82 a1 = Test__ViewTester("AlgA", OutputLevel=INFO)
83 a1.outKeys = ["/Event/A1"]
84 a1.inpKeys = ["/Event/A2"]
85 
86 a2 = Test__ViewTester("AlgB", OutputLevel=INFO)
87 a2.inpKeys = ["/Event/A1"]
88 
89 a3 = Test__ViewTester("AlgC", OutputLevel=INFO)
90 a3.outKeys = ["/Event/A2"]
91 
92 algSeq = GaudiSequencer(
93  "algSeq", Members=[a1, a2, a3], Sequential=True, OutputLevel=INFO
94 )
95 
96 # Application Manager ----------------------------------------------------------
97 # We put everything together and change the type of message service
98 
100  EvtMax=evtMax,
101  EvtSel="NONE",
102  ExtSvc=[whiteboard, condSvc],
103  EventLoop=slimeventloopmgr,
104  TopAlg=[algSeq],
105  MessageSvcType="InertMessageSvc",
106 )
107 
108 # -------------------------------------------------------------------------------
Gaudi.Configuration
Definition: Configuration.py:1
GaudiSequencer
Definition: GaudiSequencer.h:38
ApplicationMgr
Definition: ApplicationMgr.h:57