The Gaudi Framework  v36r1 (3e2fb5a8)
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 Gaudi.Configuration import *
19 from Configurables import (HiveWhiteBoard, HiveSlimEventLoopMgr,
20  AvalancheSchedulerSvc, AlgResourcePool, CPUCruncher,
21  InertMessageSvc, ApplicationMgr, CPUCrunchSvc)
22 
23 evtslots = 8
24 evtMax = 50
25 cardinality = 10
26 threads = 10
27 
28 whiteboard = HiveWhiteBoard("EventDataSvc", EventSlots=evtslots)
29 
30 slimeventloopmgr = HiveSlimEventLoopMgr(
31  SchedulerName="AvalancheSchedulerSvc",
32  OutputLevel=DEBUG,
33  AbortOnFailure=False)
34 
35 scheduler = AvalancheSchedulerSvc(ThreadPoolSize=threads, OutputLevel=DEBUG)
36 
37 AlgResourcePool(OutputLevel=DEBUG)
38 CPUCrunchSvc(shortCalib=True)
39 
40 #
41 # - A3 returns an ERROR once in a while
42 # - A1-A2-A4 execute normally and then a stall is detected
43 #
44 # A1
45 # / \
46 # A2 A3
47 # | |
48 # A4 A5
49 #
50 a1 = CPUCruncher("A1")
51 a1.outKeys = ['/Event/a1']
52 
53 a2 = CPUCruncher("A2")
54 a2.inpKeys = ['/Event/a1']
55 a2.outKeys = ['/Event/a2']
56 
57 a3 = CPUCruncher("A3")
58 a3.inpKeys = ['/Event/a1']
59 a3.outKeys = ['/Event/a3']
60 a3.FailNEvents = 7 # produce ERROR every Nth event
61 
62 a4 = CPUCruncher("A4")
63 a4.inpKeys = ['/Event/a2']
64 a4.outKeys = ['/Event/a4']
65 
66 a5 = CPUCruncher("A5")
67 a5.inpKeys = ['/Event/a3']
68 a5.outKeys = ['/Event/a5']
69 
70 for algo in [a1, a2, a3, a4, a5]:
71  algo.Cardinality = cardinality
72  algo.avgRuntime = .1
73 
74 msgSvc = InertMessageSvc("MessageSvc", Format="% F%30W%S%4W%e%s%7W%R%T %0W%M")
75 ApplicationMgr().SvcMapping.append(msgSvc)
76 
77 ApplicationMgr(
78  EvtMax=evtMax,
79  EvtSel='NONE',
80  ExtSvc=[whiteboard],
81  EventLoop=slimeventloopmgr,
82  TopAlg=[a1, a2, a3, a4, a5],
83  MessageSvcType="InertMessageSvc")
Gaudi.Configuration
Definition: Configuration.py:1