Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v31r0 (aeb156f0)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
CFplusViewBug.py
Go to the documentation of this file.
1 #!/usr/bin/env gaudirun.py
2 '''
3 A deliberately badly-configured job to demonstrate a crash in
4 sub-event scheduling.
5 
6 The ViewTester is an algorithm specifically designed to create sub-event
7 contexts, pass them to the scheduler, and report on the current context.
8 
9 The re-use of filter_alg causes the CF to "skip over" filter_alg2
10 This would then cause sub-events to be scheduled, but with the
11 "ShortCircuit" property of the hltStep node set True, the event can
12 be deleted before the sub-events have completed, causing the crash.
13 
14 There is now protection in AvalancheScheduler against this crash,
15 but note that re-using algs in this way is still expected to cause
16 surprising CF behaviour.
17 '''
18 from Gaudi.Configuration import *
19 from Configurables import (HiveWhiteBoard, HiveSlimEventLoopMgr,
20  AvalancheSchedulerSvc, AlgResourcePool, CPUCruncher,
21  GaudiSequencer, Test__ViewTester)
22 
23 # metaconfig -------------------------------------------------------------------
24 # It's confortable to collect the relevant parameters at the top of the optionfile
25 evtslots = 1
26 evtMax = 10
27 cardinality = 1
28 threads = 1
29 viewsPerEvt = 2
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(ThreadPoolSize=threads, OutputLevel=INFO)
55 
56 # -------------------------------------------------------------------------------
57 
58 # Algo Resource Pool -----------------------------------------------------------
59 # Nothing special here, we just set the debug level.
60 AlgResourcePool(OutputLevel=INFO)
61 
62 # -------------------------------------------------------------------------------
63 
64 filter_alg = CPUCruncher("filter_alg")
65 filter_alg.InvertDecision = False
66 filter_alg.avgRuntime = 0.0
67 
68 filter_alg2 = CPUCruncher("filter_alg2")
69 filter_alg2.InvertDecision = True
70 filter_alg2.avgRuntime = 0.0
71 
72 view_make_alg = Test__ViewTester("view_make_alg")
73 view_make_alg.baseViewName = 'view'
74 view_make_alg.viewNumber = viewsPerEvt
75 view_make_alg.viewNodeName = 'view_test_node'
76 
77 view_test_alg = CPUCruncher("view_test_alg")
78 view_test_alg.InvertDecision = False
79 view_test_alg.avgRuntime = 1.0
80 
81 for algo in [filter_alg, filter_alg2, view_make_alg, view_test_alg]:
82  algo.Cardinality = cardinality
83  algo.OutputLevel = INFO
84 
85 view_test_node = GaudiSequencer(
86  "view_test_node",
87  Members=[view_test_alg],
88  Sequential=False,
89  OutputLevel=INFO)
90 
91 view_make_node = GaudiSequencer(
92  "view_make_node",
93  Members=[filter_alg, view_make_alg, view_test_node],
94  Sequential=True,
95  OutputLevel=INFO)
96 
97 hltStep = GaudiSequencer(
98  "hltStep",
99  Members=[filter_alg, filter_alg2, view_make_node],
100  Sequential=True,
101  ShortCircuit=True,
102  ModeOR=False,
103  OutputLevel=INFO)
104 
105 # Application Manager ----------------------------------------------------------
106 # We put everything together and change the type of message service
107 
109  EvtMax=evtMax,
110  EvtSel='NONE',
111  ExtSvc=[whiteboard],
112  EventLoop=slimeventloopmgr,
113  TopAlg=[hltStep],
114  MessageSvcType="InertMessageSvc")
115 
116 # -------------------------------------------------------------------------------
A class that implements a search for prime numbers.
Definition: CPUCruncher.h:19
Sequencer for executing several algorithms, stopping when one is faulty.
The AlgResourcePool is a concrete implementation of the IAlgResourcePool interface.
Data service base class.
The Application Manager class.