The Gaudi Framework  master (37c0b60a)
AsyncIncidents.py
Go to the documentation of this file.
1 #!/usr/bin/env gaudirun.py
2 
17 
18 from 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 )
31 from Gaudi.Configuration import *
32 
33 msgFmt = "% F%40W%S%4W%s%e%7W%R%T %0W%M"
34 msgSvc = InertMessageSvc("MessageSvc", OutputLevel=INFO)
35 msgSvc.Format = msgFmt
36 ApplicationMgr().SvcMapping.append(msgSvc)
37 
38 IncidentSvc(OutputLevel=DEBUG)
39 CPUCrunchSvc(shortCalib=True)
40 
41 # metaconfig
42 evtslots = 5
43 evtMax = 20
44 cardinality = 10
45 algosInFlight = 10
46 
47 whiteboard = HiveWhiteBoard("EventDataSvc", EventSlots=evtslots)
48 
49 slimeventloopmgr = HiveSlimEventLoopMgr(OutputLevel=INFO)
50 
51 scheduler = AvalancheSchedulerSvc(ThreadPoolSize=algosInFlight, OutputLevel=DEBUG)
52 
53 AlgResourcePool(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 
58 EventLoopInitProcAlg = IncidentProcAlg("EventLoopInitProcessingAlg", OutputLevel=DEBUG)
59 EventLoopFinalProcAlg = IncidentProcAlg(
60  "EventLoopFinalProcessingAlg", OutputLevel=DEBUG
61 )
62 # add two dummy incident aware services that register
63 AITestSvc1 = IncidentAsyncTestSvc(
64  "IncidentAwareService1",
65  FileOffset=10000000,
66  EventMultiplier=1000,
67  IncidentNames=["BeginEvent", "EndEvent", "BeginRun", "EndRun", "AbortEvent"],
68  Priority=1000,
69 )
70 AITestSvc2 = IncidentAsyncTestSvc(
71  "IncidentAwareService2",
72  FileOffset=10000000 * 100,
73  EventMultiplier=1000 * 1000,
74  IncidentNames=["BeginEvent", "EndEvent"],
75  Priority=1,
76 )
77 AITestAlg1 = IncidentAsyncTestAlg(
78  "IncidentAwareTestAlg1",
79  ServiceName="IncidentAwareService1",
80  Cardinality=5,
81  inpKeys=["/Event/a1"],
82 )
83 
84 AITestAlg2 = IncidentAsyncTestAlg(
85  "IncidentAwareTestAlg2",
86  ServiceName="IncidentAwareService2",
87  Cardinality=1,
88  inpKeys=["/Event/a2"],
89 )
90 
91 FakeInput = CPUCruncher(
92  "FakeInput",
93  outKeys=["/Event/a1", "/Event/a3", "/Event/a4"],
94  varRuntime=0.1,
95  avgRuntime=0.1,
96 )
97 
98 Producer1 = CPUCruncher(
99  "Producer1", inpKeys=["/Event/a1", "/Event/a3"], outKeys=["/Event/a5", "/Event/a6"]
100 )
101 
102 Filter = CPUCruncher("Filter", inpKeys=["/Event/a4"])
103 
104 Producer2 = CPUCruncher("Producer2", inpKeys=["/Event/a3"], outKeys=["/Event/a2"])
105 
106 Filter2 = CPUCruncher("Filter2", inpKeys=["/Event/a2"])
107 
108 sequence0 = Gaudi__Sequencer("Sequence0")
109 sequence0.ModeOR = False
110 sequence0.ShortCircuit = False # whether the evaluation is lazy or not!
111 sequence0.Members += [EventLoopInitProcAlg]
112 sequencex = Gaudi__Sequencer("SequenceX")
113 sequencex.ModeOR = False
114 sequencex.ShortCircuit = False # whether the evaluation is lazy or not!
115 sequencex.Members += [EventLoopFinalProcAlg]
116 sequence1 = Gaudi__Sequencer("Sequence1")
117 sequence1.Members += [FakeInput, Producer1, Filter, Producer2, AITestAlg1, AITestAlg2]
118 sequence1.ModeOR = False
119 sequence1.ShortCircuit = False # whether the evaluation is lazy or not!
120 sequence2 = Gaudi__Sequencer("Sequence2")
121 sequence2.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 )
InertMessageSvc
Definition: InertMessageSvc.h:36
Gaudi.Configuration
Definition: Configuration.py:1
ApplicationMgr
Definition: ApplicationMgr.h:57