| The Gaudi Framework v32r1 (f65d50dc)

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