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