The Gaudi Framework  v30r3 (a5ef0a68)
HiveSlimEventLoopMgr.cpp
Go to the documentation of this file.
1 // Local includes
3 #include "HistogramAgent.h"
4 
5 // Framework includes
8 #include "GaudiKernel/DataSvc.h"
10 #include "GaudiKernel/Incident.h"
11 
12 // External libraries
13 #include <chrono>
14 
15 // Instantiation of a static factory class used by clients to create instances of this service
17 
18 #define ON_DEBUG if ( msgLevel( MSG::DEBUG ) )
19 #define DEBUG_MSG ON_DEBUG debug()
20 
21 #define ON_VERBOSE if ( msgLevel( MSG::VERBOSE ) )
22 #define VERBOSE_MSG ON_VERBOSE verbose()
23 
24 //--------------------------------------------------------------------------------------------
25 // Standard Constructor
26 //--------------------------------------------------------------------------------------------
28  : base_class( name, svcLoc ), m_appMgrUI( svcLoc )
29 {
30 }
31 
32 //--------------------------------------------------------------------------------------------
33 // Standard Destructor
34 //--------------------------------------------------------------------------------------------
36 {
42  delete m_evtContext;
43 }
44 
45 //--------------------------------------------------------------------------------------------
46 // implementation of IAppMgrUI::initialize
47 //--------------------------------------------------------------------------------------------
49 {
50 
51  if ( !m_appMgrUI ) return StatusCode::FAILURE;
52 
54  if ( !sc.isSuccess() ) {
55  error() << "Failed to initialize Service Base class." << endmsg;
56  return StatusCode::FAILURE;
57  }
58 
59  // Get the references to the services that are needed by the ApplicationMgr itself
60  m_incidentSvc = serviceLocator()->service( "IncidentSvc" );
61  if ( !m_incidentSvc ) {
62  fatal() << "Error retrieving IncidentSvc." << endmsg;
63  return StatusCode::FAILURE;
64  }
65 
66  // Setup access to event data services
67  m_evtDataMgrSvc = serviceLocator()->service( "EventDataSvc" );
68  if ( !m_evtDataMgrSvc ) {
69  fatal() << "Error retrieving EventDataSvc interface IDataManagerSvc." << endmsg;
70  return StatusCode::FAILURE;
71  }
72  m_whiteboard = serviceLocator()->service( "EventDataSvc" );
73  if ( !m_whiteboard ) {
74  fatal() << "Error retrieving EventDataSvc interface IHiveWhiteBoard." << endmsg;
75  return StatusCode::FAILURE;
76  }
78  if ( !m_schedulerSvc ) {
79  fatal() << "Error retrieving SchedulerSvc interface IScheduler." << endmsg;
80  return StatusCode::FAILURE;
81  }
82  // Obtain the IProperty of the ApplicationMgr
84  if ( !m_appMgrProperty ) {
85  fatal() << "IProperty interface not found in ApplicationMgr." << endmsg;
86  return StatusCode::FAILURE;
87  }
88 
89  // We do not expect a Event Selector necessarily being declared
90  setProperty( m_appMgrProperty->getProperty( "EvtSel" ) ).ignore();
91 
92  if ( m_evtsel != "NONE" || m_evtsel.length() == 0 ) {
93  m_evtSelector = serviceLocator()->service( "EventSelector" );
94  if ( m_evtSelector ) {
95  // Setup Event Selector
97  if ( !sc.isSuccess() ) {
98  fatal() << "Can not create the event selector Context." << endmsg;
99  return sc;
100  }
101  } else {
102  fatal() << "EventSelector not found." << endmsg;
103  return sc;
104  }
105  } else {
106  m_evtSelector = 0;
107  m_evtContext = 0;
108  if ( m_warnings ) {
109  warning() << "Unable to locate service \"EventSelector\" " << endmsg;
110  warning() << "No events will be processed from external input." << endmsg;
111  }
112  }
113 
114  // Setup access to histogramming services
115  m_histoDataMgrSvc = serviceLocator()->service( "HistogramDataSvc" );
116  if ( !m_histoDataMgrSvc ) {
117  fatal() << "Error retrieving HistogramDataSvc." << endmsg;
118  return sc;
119  }
120  // Setup histogram persistency
121  m_histoPersSvc = serviceLocator()->service( "HistogramPersistencySvc" );
122  if ( !m_histoPersSvc ) {
123  warning() << "Histograms cannot not be saved - though required." << endmsg;
124  return sc;
125  }
126 
127  // Setup algorithm resource pool
128  m_algResourcePool = serviceLocator()->service( "AlgResourcePool" );
129  if ( !m_algResourcePool ) {
130  fatal() << "Error retrieving AlgResourcePool" << endmsg;
131  return StatusCode::FAILURE;
132  }
133 
134  m_algExecStateSvc = serviceLocator()->service( "AlgExecStateSvc" );
135  if ( !m_algExecStateSvc ) {
136  fatal() << "Error retrieving AlgExecStateSvc" << endmsg;
137  return StatusCode::FAILURE;
138  }
139 
141  info() << "Found " << m_eventNumberBlacklist.size() << " events in black list" << endmsg;
142 
143  return StatusCode::SUCCESS;
144 }
145 //--------------------------------------------------------------------------------------------
146 // implementation of IService::reinitialize
147 //--------------------------------------------------------------------------------------------
149 {
150 
151  // Check to see whether a new Event Selector has been specified
152  setProperty( m_appMgrProperty->getProperty( "EvtSel" ) );
153  if ( m_evtsel != "NONE" || m_evtsel.empty() ) {
154  auto theSvc = serviceLocator()->service( "EventSelector" );
155  auto theEvtSel = theSvc.as<IEvtSelector>();
156  StatusCode sc;
157  if ( theEvtSel && ( theEvtSel.get() != m_evtSelector.get() ) ) {
158  // Setup Event Selector
159  if ( m_evtSelector.get() && m_evtContext ) {
160  // Need to release context before switching to new event selector
162  m_evtContext = nullptr;
163  }
164  m_evtSelector = theEvtSel;
165  if ( theSvc->FSMState() == Gaudi::StateMachine::INITIALIZED ) {
166  sc = theSvc->reinitialize();
167  if ( !sc.isSuccess() ) {
168  error() << "Failure Reinitializing EventSelector " << theSvc->name() << endmsg;
169  return sc;
170  }
171  } else {
172  sc = theSvc->sysInitialize();
173  if ( !sc.isSuccess() ) {
174  error() << "Failure Initializing EventSelector " << theSvc->name() << endmsg;
175  return sc;
176  }
177  }
179  if ( !sc.isSuccess() ) {
180  error() << "Can not create Context " << theSvc->name() << endmsg;
181  return sc;
182  }
183 
184  } else if ( m_evtSelector ) {
185  if ( m_evtContext ) {
187  m_evtContext = nullptr;
188  }
190  if ( !sc.isSuccess() ) {
191  error() << "Can not create Context " << theSvc->name() << endmsg;
192  return sc;
193  }
194  }
195  } else if ( m_evtSelector && m_evtContext ) {
197  m_evtSelector = nullptr;
198  m_evtContext = nullptr;
199  }
200  return StatusCode::SUCCESS;
201 }
202 
203 //--------------------------------------------------------------------------------------------
204 // implementation of IService::stop
205 //--------------------------------------------------------------------------------------------
206 // Removed call to MinimalEventLoopMgr!
208 {
209  if ( !m_endEventFired ) {
210  // Fire pending EndEvent incident
211  m_incidentSvc->fireIncident( Incident( name(), IncidentType::EndEvent ) );
212  m_endEventFired = true;
213  }
214  return StatusCode::SUCCESS;
215 }
216 
217 //--------------------------------------------------------------------------------------------
218 // implementation of IAppMgrUI::finalize
219 //--------------------------------------------------------------------------------------------
220 // Removed call to MinimalEventLoopMgr!
222 {
223 
224  StatusCode scRet;
226 
227  if ( sc.isFailure() ) {
228  scRet = StatusCode::FAILURE;
229  error() << "Problems finalizing Service base class" << endmsg;
230  }
231 
232  // Save Histograms Now
233  if ( m_histoPersSvc ) {
234  HistogramAgent agent;
235  sc = m_histoDataMgrSvc->traverseTree( &agent );
236  if ( sc.isSuccess() ) {
237  const IDataSelector& objects = agent.selectedObjects();
238  // skip /stat entry!
239  sc = std::accumulate( begin( objects ), end( objects ), sc, [&]( StatusCode s, const auto& i ) {
240  IOpaqueAddress* pAddr = nullptr;
241  StatusCode iret = m_histoPersSvc->createRep( i, pAddr );
242  if ( iret.isSuccess() ) i->registry()->setAddress( pAddr );
243  return s.isFailure() ? s : iret;
244  } );
245  sc = std::accumulate( begin( objects ), end( objects ), sc, [&]( StatusCode s, const auto& i ) {
246  IRegistry* reg = i->registry();
247  StatusCode iret = m_histoPersSvc->fillRepRefs( reg->address(), i );
248  return s.isFailure() ? s : iret;
249  } );
250  if ( sc.isSuccess() ) {
251  info() << "Histograms converted successfully according to request." << endmsg;
252  } else {
253  error() << "Error while saving Histograms." << endmsg;
254  }
255  } else {
256  error() << "Error while traversing Histogram data store" << endmsg;
257  }
258  }
259 
260  scRet = sc;
261 
262  // Release event selector context
263  if ( m_evtSelector && m_evtContext ) {
265  m_evtContext = nullptr;
266  }
267 
269  m_appMgrUI.reset();
270 
271  // Release all interfaces...
274 
278 
279  return scRet;
280 }
281 
282 //--------------------------------------------------------------------------------------------
283 // implementation of executeEvent(void* par)
284 //--------------------------------------------------------------------------------------------
286 {
287 
288  // Leave the interface intact and swallow this C trick.
289  int& createdEvts = *( (int*)createdEvts_IntPtr );
290 
291  EventContext* evtContext( nullptr );
292 
293  // Check if event number is in blacklist
294  if ( LIKELY( m_blackListBS != nullptr ) ) { // we are processing a finite number of events, use bitset blacklist
295  if ( m_blackListBS->test( createdEvts ) ) {
296  VERBOSE_MSG << "Event " << createdEvts << " on black list" << endmsg;
298  }
299  } else if ( std::binary_search( m_eventNumberBlacklist.begin(), m_eventNumberBlacklist.end(), createdEvts ) ) {
300 
301  VERBOSE_MSG << "Event " << createdEvts << " on black list" << endmsg;
303  }
304 
305  if ( createEventContext( evtContext, createdEvts ).isFailure() ) {
306  fatal() << "Impossible to create event context" << endmsg;
307  return StatusCode::FAILURE;
308  }
309 
310  VERBOSE_MSG << "Beginning to process event " << createdEvts << endmsg;
311 
312  // An incident may schedule a stop, in which case is better to exit before the actual execution.
313  // DP have to find out who shoots this
314  /* if ( m_scheduledStop ) {
315  always() << "Terminating event processing loop due to a stop scheduled by an incident listener" << endmsg;
316  return StatusCode::SUCCESS;
317  }*/
318 
319  StatusCode declEvtRootSc = declareEventRootAddress();
320  if ( declEvtRootSc.isFailure() ) { // We ran out of events!
321  createdEvts = -1; // Set created event to a negative value: we finished!
322  return StatusCode::SUCCESS;
323  }
324 
325  // Fire BeginEvent "Incident"
326  m_incidentSvc->fireIncident( std::make_unique<Incident>( name(), IncidentType::BeginEvent, *evtContext ) );
327 
328  // Now add event to the scheduler
329  VERBOSE_MSG << "Adding event " << evtContext->evt() << ", slot " << evtContext->slot() << " to the scheduler"
330  << endmsg;
331 
332  m_incidentSvc->fireIncident( std::make_unique<Incident>( name(), IncidentType::BeginProcessing, *evtContext ) );
333 
334  StatusCode addEventStatus = m_schedulerSvc->pushNewEvent( evtContext );
335 
336  // If this fails, we need to wait for something to complete
337  if ( !addEventStatus.isSuccess() ) {
338  fatal() << "An event processing slot should be now free in the scheduler, but it appears not to be the case."
339  << endmsg;
340  }
341 
342  ++createdEvts;
343  return StatusCode::SUCCESS;
344 }
345 
346 //--------------------------------------------------------------------------------------------
347 // implementation of IEventProcessing::executeRun
348 //--------------------------------------------------------------------------------------------
350 {
351  StatusCode sc;
352  bool eventfailed = false;
353 
354  if ( maxevt > 0 ) { // finite number of events to process
355  const unsigned int umaxevt = static_cast<unsigned int>( maxevt );
356  m_blackListBS = new boost::dynamic_bitset<>( maxevt ); // all initialized to zero
357  for ( unsigned int i = 0; i < m_eventNumberBlacklist.size() && m_eventNumberBlacklist[i] <= umaxevt;
358  ++i ) { // black list is sorted in init
359  m_blackListBS->set( m_eventNumberBlacklist[i], true );
360  }
361  }
362 
363  // Call now the nextEvent(...)
364  sc = nextEvent( maxevt );
365  if ( sc.isFailure() ) eventfailed = true;
366 
367  delete m_blackListBS;
368 
369  return eventfailed ? StatusCode::FAILURE : StatusCode::SUCCESS;
370 }
371 
372 //--------------------------------------------------------------------------------------------
373 // Implementation of IEventProcessor::stopRun()
374 //--------------------------------------------------------------------------------------------
376 {
377  // Set the application return code
378  auto appmgr = serviceLocator()->as<IProperty>();
380  error() << "Could not set return code of the application (" << Gaudi::ReturnCode::ScheduledStop << ")" << endmsg;
381  }
382  m_scheduledStop = true;
383  return StatusCode::SUCCESS;
384 }
385 
386 //--------------------------------------------------------------------------------------------
387 // implementation of IAppMgrUI::nextEvent
388 //--------------------------------------------------------------------------------------------
389 // Here the loop on the events takes place.
390 // This is also the natural place to put the preparation of the algorithms
391 // contexts, which contain the event specific data.
392 #include "GaudiKernel/Memory.h"
394 {
395 
396  // Calculate runtime
398 
399  // Reset the application return code.
401 
402  int finishedEvts = 0;
403  int createdEvts = 0;
404  int skippedEvts = 0;
405  info() << "Starting loop on events" << endmsg;
406  // Loop until the finished events did not reach the maxevt number
407  bool loop_ended = false;
408  // Run the first event before spilling more than one
409  bool newEvtAllowed = false;
410 
411  constexpr double oneOver1024 = 1. / 1024.;
412 
413  uint iteration = 0;
414  auto start_time = Clock::now();
415  while ( !loop_ended && ( maxevt < 0 || ( finishedEvts + skippedEvts ) < maxevt ) ) {
416  DEBUG_MSG << "work loop iteration " << iteration++ << endmsg;
417  // if the created events did not reach maxevt, create an event
418  if ( ( newEvtAllowed || createdEvts == 0 ) && // Launch the first event alone
419  createdEvts >= 0 && // The events are not finished with an unlimited number of events
420  ( createdEvts < maxevt || maxevt < 0 ) && // The events are not finished with a limited number of events
421  m_schedulerSvc->freeSlots() > 0 && // There are still free slots in the scheduler
422  m_whiteboard->freeSlots() > 0 ) { // There are still free slots in the whiteboard
423 
424  if ( 1 == createdEvts ) // reset counter to count from event 1
425  start_time = Clock::now();
426 
427  DEBUG_MSG << "createdEvts: " << createdEvts << ", freeslots: " << m_schedulerSvc->freeSlots() << endmsg;
428  // DP remove to remove the syscalls...
429  // if (0!=createdEvts){
430  // info() << "Event Number = " << createdEvts
431  // << " WSS (MB) = " << System::mappedMemory(System::MemoryUnit::kByte)*oneOver1024
432  // << " Time (s) = " << secsFromStart(start_time) << endmsg;
433  // }
434 
435  // TODO can we adapt the interface of executeEvent for a nicer solution?
437  while ( !sc.isSuccess() // we haven't created an event yet
438  && ( createdEvts < maxevt || maxevt < 0 ) ) { // redunant check for maxEvts, can we do better?
439  sc = executeEvent( &createdEvts );
440 
441  if ( sc.isRecoverable() ) { // we skipped an event
442 
443  // this is all to skip the event
444  size_t slot =
445  m_whiteboard->allocateStore( createdEvts ); // we need a new store, not to change the previous event
446  m_whiteboard->selectStore( slot );
447  declareEventRootAddress(); // actually skip over the event
448  m_whiteboard->freeStore( slot ); // delete the store
449 
450  ++createdEvts;
451  ++skippedEvts;
452  } else if ( sc.isRecoverable() ) { // exit immediatly
453  return StatusCode::FAILURE;
454  } // else we have an success --> exit loop
455  }
456 
457  } // end if condition createdEvts < maxevt
458  else {
459  // all the events were created but not all finished or the slots were
460  // all busy: the scheduler should finish its job
461 
462  DEBUG_MSG << "Draining the scheduler" << endmsg;
463 
464  // Pull out of the scheduler the finished events
465  if ( drainScheduler( finishedEvts ).isFailure() ) loop_ended = true;
466  newEvtAllowed = true;
467  }
468  } // end main loop on finished events
469  auto end_time = Clock::now();
470 
471  info() << "---> Loop Finished (skipping 1st evt) - "
472  << " WSS " << System::mappedMemory( System::MemoryUnit::kByte ) * oneOver1024 << " total time "
473  << std::chrono::duration_cast<std::chrono::nanoseconds>( end_time - start_time ).count() << endmsg;
474  info() << skippedEvts << " events were SKIPed" << endmsg;
475 
476  return StatusCode::SUCCESS;
477 }
478 
479 //---------------------------------------------------------------------------
480 
483 {
484  refpAddr = nullptr;
486  if ( sc.isFailure() ) return sc;
487  // Create root address and assign address to data service
488  sc = m_evtSelector->createAddress( *m_evtContext, refpAddr );
489  if ( sc.isSuccess() ) return sc;
490  sc = m_evtSelector->next( *m_evtContext );
491  if ( sc.isFailure() ) return sc;
492  sc = m_evtSelector->createAddress( *m_evtContext, refpAddr );
493  if ( !sc.isSuccess() ) warning() << "Error creating IOpaqueAddress." << endmsg;
494  return sc;
495 }
496 
497 //---------------------------------------------------------------------------
498 
500 {
501  StatusCode sc;
502  if ( m_evtContext ) {
503  //---This is the "event iterator" context from EventSelector
504  IOpaqueAddress* pAddr = nullptr;
505  sc = getEventRoot( pAddr );
506  if ( !sc.isSuccess() ) {
507  info() << "No more events in event selection " << endmsg;
508  return StatusCode::FAILURE;
509  }
510  sc = m_evtDataMgrSvc->setRoot( "/Event", pAddr );
511  if ( !sc.isSuccess() ) {
512  warning() << "Error declaring event root address." << endmsg;
513  }
514  } else {
515  //---In case of no event selector----------------
516  sc = m_evtDataMgrSvc->setRoot( "/Event", new DataObject() );
517  if ( !sc.isSuccess() ) {
518  warning() << "Error declaring event root DataObject" << endmsg;
519  }
520  }
521  return StatusCode::SUCCESS;
522 }
523 
524 //---------------------------------------------------------------------------
525 
527 {
528  evtContext = new EventContext;
529  evtContext->set( createdEvts, m_whiteboard->allocateStore( createdEvts ) );
530  m_algExecStateSvc->reset( *evtContext );
531 
532  StatusCode sc = m_whiteboard->selectStore( evtContext->slot() );
533  if ( sc.isFailure() ) {
534  warning() << "Slot " << evtContext->slot() << " could not be selected for the WhiteBoard" << endmsg;
535  }
536  return sc;
537 }
538 
539 //---------------------------------------------------------------------------
540 
542 {
543 
545 
546  // maybe we can do better
547  std::vector<EventContext*> finishedEvtContexts;
548 
549  EventContext* finishedEvtContext( nullptr );
550 
551  // Here we wait not to loose cpu resources
552  DEBUG_MSG << "Waiting for a context" << endmsg;
553  sc = m_schedulerSvc->popFinishedEvent( finishedEvtContext );
554 
555  // We got past it: cache the pointer
556  DEBUG_MSG << "Context " << ( sc.isSuccess() ? "obtained" : "not obtained: a problem in the scheduling?" ) << endmsg;
557  finishedEvtContexts.push_back( finishedEvtContext );
558 
559  // Let's see if we can pop other event contexts
560  while ( m_schedulerSvc->tryPopFinishedEvent( finishedEvtContext ).isSuccess() ) {
561  finishedEvtContexts.push_back( finishedEvtContext );
562  }
563 
564  // Now we flush them
565  StatusCode finalSC;
566  for ( auto& thisFinishedEvtContext : finishedEvtContexts ) {
567  if ( !thisFinishedEvtContext ) {
568  error() << "Detected nullptr ctxt before clearing WB!" << endmsg;
569  finalSC = StatusCode::FAILURE;
570  continue;
571  }
572  if ( m_algExecStateSvc->eventStatus( *thisFinishedEvtContext ) != EventStatus::Success ) {
573  ( m_abortOnFailure ? fatal() : error() ) << "Failed event detected on " << thisFinishedEvtContext << endmsg;
574  if ( m_abortOnFailure ) finalSC = StatusCode::FAILURE;
575  }
576  // shouldn't these incidents move to the forward scheduler?
577  // If we want to consume incidents with an algorithm at the end of the graph
578  // we need to add this to forward scheduler lambda action,
579  // otherwise we have to do this serially on this thread!
580  m_incidentSvc->fireIncident( Incident( name(), IncidentType::EndProcessing, *thisFinishedEvtContext ) );
581  m_incidentSvc->fireIncident( Incident( name(), IncidentType::EndEvent, *thisFinishedEvtContext ) );
582 
583  DEBUG_MSG << "Clearing slot " << thisFinishedEvtContext->slot() << " (event " << thisFinishedEvtContext->evt()
584  << ") of the whiteboard" << endmsg;
585 
586  StatusCode sc = clearWBSlot( thisFinishedEvtContext->slot() );
587  if ( !sc.isSuccess() )
588  error() << "Whiteboard slot " << thisFinishedEvtContext->slot() << " could not be properly cleared";
589 
590  delete thisFinishedEvtContext;
591 
592  ++finishedEvts;
593  }
594  return finalSC;
595 }
596 
597 //---------------------------------------------------------------------------
598 
600 {
601  StatusCode sc = m_whiteboard->clearStore( evtSlot );
602  if ( !sc.isSuccess() ) warning() << "Clear of Event data store failed" << endmsg;
603  return m_whiteboard->freeStore( evtSlot );
604 }
605 //---------------------------------------------------------------------------
virtual StatusCode traverseTree(IDataStoreAgent *pAgent)=0
Analyse by traversing all data objects in the data store.
#define DEBUG_MSG
StatusCode clearWBSlot(int evtSlot)
Clear a slot in the WB.
constexpr static const auto FAILURE
Definition: StatusCode.h:88
StatusCode initialize() override
Definition: Service.cpp:63
Gaudi::Property< std::string > m_evtsel
SmartIF< IIncidentSvc > m_incidentSvc
Reference to the incident service.
SmartIF< IDataManagerSvc > m_evtDataMgrSvc
Reference to the Event Data Service&#39;s IDataManagerSvc interface.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
StatusCode declareEventRootAddress()
Declare the root address of the event.
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:288
Gaudi::Property< bool > m_abortOnFailure
void set(const ContextEvt_t &e=0, const ContextID_t &s=INVALID_CONTEXT_ID)
Definition: EventContext.h:44
StatusCode finalize() override
Definition: Service.cpp:173
StatusCode setProperty(const Gaudi::Details::PropertyBase &p) override
set the property form another property
ContextID_t slot() const
Definition: EventContext.h:40
SmartIF< IAppMgrUI > m_appMgrUI
Reference to the IAppMgrUI interface of the application manager.
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
HiveSlimEventLoopMgr(const std::string &nam, ISvcLocator *svcLoc)
Standard Constructor.
StatusCode drainScheduler(int &finishedEvents)
Drain the scheduler from all actions that may be queued.
The Event Selector Interface.
Definition: IEvtSelector.h:18
bool isSuccess() const
Definition: StatusCode.h:287
HistogramAgent base in charge of collecting all the refereces to DataObjects in a transient store tha...
SmartIF< IHiveWhiteBoard > m_whiteboard
Reference to the Whiteboard.
virtual StatusCode setRoot(std::string root_name, DataObject *pObject)=0
Initialize data store for new event by giving new event path.
SmartIF< IScheduler > m_schedulerSvc
A shortcut for the scheduler.
bool m_scheduledStop
Scheduled stop of event processing.
T binary_search(T...args)
Gaudi::Property< std::vector< unsigned int > > m_eventNumberBlacklist
T duration_cast(T...args)
virtual StatusCode getProperty(Gaudi::Details::PropertyBase *p) const =0
Get the property by property.
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)=0
Convert the transient object to the requested representation.
virtual size_t freeSlots()=0
Get free slots number.
SmartIF< IFace > as()
Definition: ISvcLocator.h:109
This class represents an entry point to all the event specific data.
Definition: EventContext.h:24
SmartIF< IProperty > m_appMgrProperty
Property interface of ApplicationMgr.
bool isFailure() const
Definition: StatusCode.h:139
constexpr int ScheduledStop
Definition: AppReturnCode.h:27
ContextEvt_t evt() const
Definition: EventContext.h:39
STL class.
#define DECLARE_COMPONENT(type)
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:82
Gaudi::Property< bool > m_warnings
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:79
T push_back(T...args)
StatusCode finalize() override
implementation of IService::finalize
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
StatusCode stopRun() override
implementation of IEventProcessor::stopRun()
virtual StatusCode selectStore(size_t partitionIndex)=0
Activate an given &#39;slot&#39; for all subsequent calls within the same thread id.
virtual void fireIncident(const Incident &incident)=0
Fire an Incident.
~HiveSlimEventLoopMgr() override
Standard Destructor.
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
virtual StatusCode clearStore(size_t partitionIndex)=0
Clear an given &#39;slot&#39;.
#define VERBOSE_MSG
constexpr static const auto RECOVERABLE
Definition: StatusCode.h:89
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
StatusCode executeRun(int maxevt) override
implementation of IEventProcessor::executeRun()
StatusCode createEventContext(EventContext *&eventContext, int createdEvents)
Create event context.
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
virtual StatusCode pushNewEvent(EventContext *eventContext)=0
Make an event available to the scheduler.
StatusCode getEventRoot(IOpaqueAddress *&refpAddr)
Create event address using event selector.
bool isRecoverable() const
Definition: StatusCode.h:293
virtual StatusCode releaseContext(Context *&) const =0
Release the Context object.
IDataSelector * selectedObjects()
Return the set of selected DataObjects.
StatusCode setAppReturnCode(SmartIF< IProperty > &appmgr, int value, bool force=false)
Set the application return code.
Definition: AppReturnCode.h:51
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
#define LIKELY(x)
Definition: Kernel.h:121
virtual void reset(const EventContext &ctx)=0
GAUDI_API long mappedMemory(MemoryUnit unit=kByte, InfoType fetch=Memory, long pid=-1)
Basic Process Information: priority boost.
Definition: Memory.cpp:204
StatusCode initialize() override
implementation of IService::initialize
SmartIF< IAlgExecStateSvc > m_algExecStateSvc
Reference to the AlgExecStateSvc.
SmartIF< IConversionSvc > m_histoPersSvc
Reference to the Histogram Persistency Service.
virtual size_t allocateStore(int evtnumber)=0
Allocate a store partition for new event.
Gaudi::Property< std::string > m_schedulerName
const StatusCode & ignore() const
Ignore/check StatusCode.
Definition: StatusCode.h:165
virtual StatusCode tryPopFinishedEvent(EventContext *&eventContext)=0
Try to retrieve a finished event from the scheduler.
Base class for all Incidents (computing events).
Definition: Incident.h:17
virtual const EventStatus::Status & eventStatus(const EventContext &ctx) const =0
SmartIF< IDataManagerSvc > m_histoDataMgrSvc
Reference to the Histogram Data Service.
SmartIF< IEvtSelector > m_evtSelector
Reference to the Event Selector.
string s
Definition: gaudirun.py:253
virtual StatusCode freeStore(size_t partitionIndex)=0
Free a store partition.
StatusCode reinitialize() override
implementation of IService::reinitialize
virtual StatusCode next(Context &c) const =0
Fetch the next event or the first event if it will be use soon after the creation of the context...
T sort(T...args)
virtual StatusCode createContext(Context *&c) const =0
Create and return a context object that will keep track of the state of selection.
void reset(TYPE *ptr=nullptr)
Set the internal pointer to the passed one disposing of the old one.
Definition: SmartIF.h:92
virtual StatusCode createAddress(const Context &c, IOpaqueAddress *&iop) const =0
Create an IOpaqueAddress object from the event fetched.
AttribStringParser::Iterator begin(const AttribStringParser &parser)
T accumulate(T...args)
Opaque address interface definition.
int maxevt
Definition: Bootstrap.cpp:276
MsgStream & fatal() const
shortcut for the method msgStream(MSG::FATAL)
constexpr int Success
Definition: AppReturnCode.h:18
The IProperty is the basic interface for all components which have properties that can be set or get...
Definition: IProperty.h:20
SmartIF< IAlgResourcePool > m_algResourcePool
Reference to the Algorithm resource pool.
StatusCode executeEvent(void *par) override
implementation of IEventProcessor::executeEvent(void* par)
virtual IOpaqueAddress * address() const =0
Retrieve opaque storage address.
virtual StatusCode fillRepRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Resolve the references of the converted object.
StatusCode nextEvent(int maxevt) override
implementation of IService::nextEvent
virtual unsigned int freeSlots()=0
Get the free event processing slots.
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: Service.cpp:291
virtual StatusCode popFinishedEvent(EventContext *&eventContext)=0
Retrieve a finished event from the scheduler.
bool m_endEventFired
Flag to avoid to fire the EnvEvent incident twice in a row (and also not before the first event) ...
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
boost::dynamic_bitset * m_blackListBS
StatusCode stop() override
implementation of IService::stop
IEvtSelector::Context * m_evtContext
Event Iterator.