The Gaudi Framework  master (37c0b60a)
AvalancheSchedulerErrorTest.py
Go to the documentation of this file.
1 #!/usr/bin/env gaudirun.py
2 
12 """
13 Test the correct handling on errors during the event processing:
14 - The CPUCruncher is configured to return an ERROR on a fraction of the events
15 - The EventLoopMgr is configured to continue with the next event on ERROR
16 """
17 
18 from Configurables import (
19  AlgResourcePool,
20  ApplicationMgr,
21  AvalancheSchedulerSvc,
22  CPUCruncher,
23  CPUCrunchSvc,
24  HiveSlimEventLoopMgr,
25  HiveWhiteBoard,
26  InertMessageSvc,
27 )
28 from Gaudi.Configuration import *
29 
30 evtslots = 8
31 evtMax = 50
32 cardinality = 10
33 threads = 10
34 
35 whiteboard = HiveWhiteBoard("EventDataSvc", EventSlots=evtslots)
36 
37 slimeventloopmgr = HiveSlimEventLoopMgr(
38  SchedulerName="AvalancheSchedulerSvc", OutputLevel=DEBUG, AbortOnFailure=False
39 )
40 
41 scheduler = AvalancheSchedulerSvc(ThreadPoolSize=threads, OutputLevel=DEBUG)
42 
43 AlgResourcePool(OutputLevel=DEBUG)
44 CPUCrunchSvc(shortCalib=True)
45 
46 #
47 # - A3 returns an ERROR once in a while
48 # - A1-A2-A4 execute normally and then a stall is detected
49 #
50 # A1
51 # / \
52 # A2 A3
53 # | |
54 # A4 A5
55 #
56 a1 = CPUCruncher("A1")
57 a1.outKeys = ["/Event/a1"]
58 
59 a2 = CPUCruncher("A2")
60 a2.inpKeys = ["/Event/a1"]
61 a2.outKeys = ["/Event/a2"]
62 
63 a3 = CPUCruncher("A3")
64 a3.inpKeys = ["/Event/a1"]
65 a3.outKeys = ["/Event/a3"]
66 a3.FailNEvents = 7 # produce ERROR every Nth event
67 
68 a4 = CPUCruncher("A4")
69 a4.inpKeys = ["/Event/a2"]
70 a4.outKeys = ["/Event/a4"]
71 
72 a5 = CPUCruncher("A5")
73 a5.inpKeys = ["/Event/a3"]
74 a5.outKeys = ["/Event/a5"]
75 
76 for algo in [a1, a2, a3, a4, a5]:
77  algo.Cardinality = cardinality
78  algo.avgRuntime = 0.1
79 
80 msgSvc = InertMessageSvc("MessageSvc", Format="% F%30W%S%4W%e%s%7W%R%T %0W%M")
81 ApplicationMgr().SvcMapping.append(msgSvc)
82 
83 ApplicationMgr(
84  EvtMax=evtMax,
85  EvtSel="NONE",
86  ExtSvc=[whiteboard],
87  EventLoop=slimeventloopmgr,
88  TopAlg=[a1, a2, a3, a4, a5],
89  MessageSvcType="InertMessageSvc",
90 )
Gaudi.Configuration
Definition: Configuration.py:1