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