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