The Gaudi Framework  master (e68eea06)
Loading...
Searching...
No Matches
AsyncIncidents.py
Go to the documentation of this file.
1#!/usr/bin/env gaudirun.py
2
17
18from Configurables import (
19 AlgResourcePool,
20 AvalancheSchedulerSvc,
21 CPUCruncher,
22 CPUCrunchSvc,
23 Gaudi__Sequencer,
24 HiveSlimEventLoopMgr,
25 HiveWhiteBoard,
26 IncidentAsyncTestAlg,
27 IncidentAsyncTestSvc,
28 IncidentProcAlg,
29 IncidentSvc,
30)
31from Gaudi.Configuration import *
32
33msgFmt = "% F%40W%S%4W%s%e%7W%R%T %0W%M"
34msgSvc = InertMessageSvc("MessageSvc", OutputLevel=INFO)
35msgSvc.Format = msgFmt
36ApplicationMgr().SvcMapping.append(msgSvc)
37
38IncidentSvc(OutputLevel=DEBUG)
39CPUCrunchSvc(shortCalib=True)
40
41# metaconfig
42evtslots = 5
43evtMax = 20
44cardinality = 10
45algosInFlight = 10
46
47whiteboard = HiveWhiteBoard("EventDataSvc", EventSlots=evtslots)
48
49slimeventloopmgr = HiveSlimEventLoopMgr(OutputLevel=INFO)
50
51scheduler = AvalancheSchedulerSvc(ThreadPoolSize=algosInFlight, OutputLevel=DEBUG)
52
53AlgResourcePool(OutputLevel=INFO)
54# Async Incident svc processing algs to be added at the beginning and
55# at the end of event graph to process incidents fired in the context
56# of the given event
57
58EventLoopInitProcAlg = IncidentProcAlg("EventLoopInitProcessingAlg", OutputLevel=DEBUG)
59EventLoopFinalProcAlg = IncidentProcAlg(
60 "EventLoopFinalProcessingAlg", OutputLevel=DEBUG
61)
62# add two dummy incident aware services that register
64 "IncidentAwareService1",
65 FileOffset=10000000,
66 EventMultiplier=1000,
67 IncidentNames=["BeginEvent", "EndEvent", "BeginRun", "EndRun", "AbortEvent"],
68 Priority=1000,
69)
71 "IncidentAwareService2",
72 FileOffset=10000000 * 100,
73 EventMultiplier=1000 * 1000,
74 IncidentNames=["BeginEvent", "EndEvent"],
75 Priority=1,
76)
78 "IncidentAwareTestAlg1",
79 ServiceName="IncidentAwareService1",
80 Cardinality=5,
81 inpKeys=["/Event/a1"],
82)
83
85 "IncidentAwareTestAlg2",
86 ServiceName="IncidentAwareService2",
87 Cardinality=1,
88 inpKeys=["/Event/a2"],
89)
90
91FakeInput = CPUCruncher(
92 "FakeInput",
93 outKeys=["/Event/a1", "/Event/a3", "/Event/a4"],
94 varRuntime=0.1,
95 avgRuntime=0.1,
96)
97
98Producer1 = CPUCruncher(
99 "Producer1", inpKeys=["/Event/a1", "/Event/a3"], outKeys=["/Event/a5", "/Event/a6"]
100)
101
102Filter = CPUCruncher("Filter", inpKeys=["/Event/a4"])
103
104Producer2 = CPUCruncher("Producer2", inpKeys=["/Event/a3"], outKeys=["/Event/a2"])
105
106Filter2 = CPUCruncher("Filter2", inpKeys=["/Event/a2"])
107
108sequence0 = Gaudi__Sequencer("Sequence0")
109sequence0.ModeOR = False
110sequence0.ShortCircuit = False # whether the evaluation is lazy or not!
111sequence0.Members += [EventLoopInitProcAlg]
112sequencex = Gaudi__Sequencer("SequenceX")
113sequencex.ModeOR = False
114sequencex.ShortCircuit = False # whether the evaluation is lazy or not!
115sequencex.Members += [EventLoopFinalProcAlg]
116sequence1 = Gaudi__Sequencer("Sequence1")
117sequence1.Members += [FakeInput, Producer1, Filter, Producer2, AITestAlg1, AITestAlg2]
118sequence1.ModeOR = False
119sequence1.ShortCircuit = False # whether the evaluation is lazy or not!
120sequence2 = Gaudi__Sequencer("Sequence2")
121sequence2.Members += [sequence0, sequence1, Filter2, sequencex]
122
124 EvtMax=evtMax,
125 EvtSel="NONE",
126 ExtSvc=[whiteboard, AITestSvc1, AITestSvc2],
127 EventLoop=slimeventloopmgr,
128 TopAlg=[sequence2],
129 MessageSvcType="InertMessageSvc",
130)
The AlgResourcePool is a concrete implementation of the IAlgResourcePool interface.
The Application Manager class.
A class that implements a search for prime numbers.
Definition CPUCruncher.h:30
Data service base class.
Default implementation of the IIncidentSvc interface.
Definition IncidentSvc.h:35
Thread safe extension to the standard MessageSvc.