The Gaudi Framework  master (181af51f)
Loading...
Searching...
No Matches
ConditionsStallTest.py
Go to the documentation of this file.
1#!/usr/bin/env gaudirun.py
2
12"""
13A 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
21from Configurables import (
22 AlgResourcePool,
23 AvalancheSchedulerSvc,
24 HiveSlimEventLoopMgr,
25 HiveWhiteBoard,
26 Test__ViewTester,
27)
28from Gaudi.Configuration import *
29
30# metaconfig -------------------------------------------------------------------
31# It's confortable to collect the relevant parameters at the top of the optionfile
32evtslots = 1
33evtMax = 10
34threads = 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
41whiteboard = 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
49slimeventloopmgr = 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
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.
68AlgResourcePool(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
75from Configurables import Gaudi__TestSuite__Conditions__CondSvc as CS
76
77condSvc = CS(name="CondSvc", Algs=["AlgA"], Data=["/Event/A1"])
78
79# -------------------------------------------------------------------------------
80
81# Set up of the crunchers, daily business --------------------------------------
82
83a1 = Test__ViewTester("AlgA", OutputLevel=INFO)
84a1.outKeys = ["/Event/A1"]
85a1.inpKeys = ["/Event/A2"]
86
87a2 = Test__ViewTester("AlgB", OutputLevel=INFO)
88a2.inpKeys = ["/Event/A1"]
89
90a3 = Test__ViewTester("AlgC", OutputLevel=INFO)
91a3.outKeys = ["/Event/A2"]
92
93algSeq = 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# -------------------------------------------------------------------------------
The AlgResourcePool is a concrete implementation of the IAlgResourcePool interface.
The Application Manager class.
Data service base class.