The Gaudi Framework  v33r0 (d5ea422b)
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, StatusCodeSvc,
22  CPUCrunchSvc)
23 
24 evtslots = 8
25 evtMax = 50
26 cardinality = 10
27 threads = 10
28 
29 whiteboard = HiveWhiteBoard("EventDataSvc", EventSlots=evtslots)
30 
31 slimeventloopmgr = HiveSlimEventLoopMgr(
32  SchedulerName="AvalancheSchedulerSvc",
33  OutputLevel=DEBUG,
34  AbortOnFailure=False)
35 
36 scheduler = AvalancheSchedulerSvc(ThreadPoolSize=threads, OutputLevel=DEBUG)
37 
38 AlgResourcePool(OutputLevel=DEBUG)
39 CPUCrunchSvc(shortCalib=True)
40 
41 scs = StatusCodeSvc("StatusCodeSvc", OutputLevel=DEBUG)
42 
43 #
44 # - A3 returns an ERROR once in a while
45 # - A1-A2-A4 execute normally and then a stall is detected
46 #
47 # A1
48 # / \
49 # A2 A3
50 # | |
51 # A4 A5
52 #
53 a1 = CPUCruncher("A1")
54 a1.outKeys = ['/Event/a1']
55 
56 a2 = CPUCruncher("A2")
57 a2.inpKeys = ['/Event/a1']
58 a2.outKeys = ['/Event/a2']
59 
60 a3 = CPUCruncher("A3")
61 a3.inpKeys = ['/Event/a1']
62 a3.outKeys = ['/Event/a3']
63 a3.FailNEvents = 7 # produce ERROR every Nth event
64 
65 a4 = CPUCruncher("A4")
66 a4.inpKeys = ['/Event/a2']
67 a4.outKeys = ['/Event/a4']
68 
69 a5 = CPUCruncher("A5")
70 a5.inpKeys = ['/Event/a3']
71 a5.outKeys = ['/Event/a5']
72 
73 for algo in [a1, a2, a3, a4, a5]:
74  algo.Cardinality = cardinality
75  algo.avgRuntime = .1
76 
77 msgSvc = InertMessageSvc("MessageSvc", Format="% F%30W%S%4W%e%s%7W%R%T %0W%M")
78 ApplicationMgr().SvcMapping.append(msgSvc)
79 
81  EvtMax=evtMax,
82  EvtSel='NONE',
83  ExtSvc=[whiteboard, scs],
84  EventLoop=slimeventloopmgr,
85  TopAlg=[a1, a2, a3, a4, a5],
86  MessageSvcType="InertMessageSvc")
Thread safe extension to the standard MessageSvc.
A class that implements a search for prime numbers.
Definition: CPUCruncher.h:29
The AlgResourcePool is a concrete implementation of the IAlgResourcePool interface.
Data service base class.
The Application Manager class.