The Gaudi Framework  v30r2 (9eca68f7)
HiveSlimEventLoopMgr.cpp
Go to the documentation of this file.
1 // FW includes
4 #include "GaudiKernel/DataSvc.h"
13 #include "GaudiKernel/Incident.h"
14 #include "GaudiKernel/MsgStream.h"
15 #include "GaudiKernel/SmartIF.h"
16 
17 #include "HistogramAgent.h"
18 
20 
21 #include "GaudiKernel/Algorithm.h"
23 
25 
26 #include <GaudiKernel/IScheduler.h>
27 
28 // External libraries
29 #include <chrono>
30 
31 // Instantiation of a static factory class used by clients to create instances of this service
33 
34 #define ON_DEBUG if ( UNLIKELY( outputLevel() <= MSG::DEBUG ) )
35 #define ON_VERBOSE if ( UNLIKELY( outputLevel() <= MSG::VERBOSE ) )
36 
37 #define DEBMSG ON_DEBUG debug()
38 #define VERMSG ON_VERBOSE verbose()
39 
40 //--------------------------------------------------------------------------------------------
41 // Standard Constructor
42 //--------------------------------------------------------------------------------------------
44  : base_class( name, svcLoc ), m_appMgrUI( svcLoc )
45 {
46 }
47 
48 //--------------------------------------------------------------------------------------------
49 // Standard Destructor
50 //--------------------------------------------------------------------------------------------
52 {
58  delete m_evtContext;
59 }
60 
61 //--------------------------------------------------------------------------------------------
62 // implementation of IAppMgrUI::initialize
63 //--------------------------------------------------------------------------------------------
65 {
66 
67  if ( !m_appMgrUI ) return StatusCode::FAILURE;
68 
70  if ( !sc.isSuccess() ) {
71  error() << "Failed to initialize Service Base class." << endmsg;
72  return StatusCode::FAILURE;
73  }
74 
75  // Get the references to the services that are needed by the ApplicationMgr itself
76  m_incidentSvc = serviceLocator()->service( "IncidentSvc" );
77  if ( !m_incidentSvc ) {
78  fatal() << "Error retrieving IncidentSvc." << endmsg;
79  return StatusCode::FAILURE;
80  }
81 
82  // Setup access to event data services
83  m_evtDataMgrSvc = serviceLocator()->service( "EventDataSvc" );
84  if ( !m_evtDataMgrSvc ) {
85  fatal() << "Error retrieving EventDataSvc interface IDataManagerSvc." << endmsg;
86  return StatusCode::FAILURE;
87  }
88  m_whiteboard = serviceLocator()->service( "EventDataSvc" );
89  if ( !m_whiteboard ) {
90  fatal() << "Error retrieving EventDataSvc interface IHiveWhiteBoard." << endmsg;
91  return StatusCode::FAILURE;
92  }
94  if ( !m_schedulerSvc ) {
95  fatal() << "Error retrieving SchedulerSvc interface IScheduler." << endmsg;
96  return StatusCode::FAILURE;
97  }
98  // Obtain the IProperty of the ApplicationMgr
100  if ( !m_appMgrProperty ) {
101  fatal() << "IProperty interface not found in ApplicationMgr." << endmsg;
102  return StatusCode::FAILURE;
103  }
104 
105  // We do not expect a Event Selector necessarily being declared
106  setProperty( m_appMgrProperty->getProperty( "EvtSel" ) ).ignore();
107 
108  if ( m_evtsel != "NONE" || m_evtsel.length() == 0 ) {
109  m_evtSelector = serviceLocator()->service( "EventSelector" );
110  if ( m_evtSelector ) {
111  // Setup Event Selector
113  if ( !sc.isSuccess() ) {
114  fatal() << "Can not create the event selector Context." << endmsg;
115  return sc;
116  }
117  } else {
118  fatal() << "EventSelector not found." << endmsg;
119  return sc;
120  }
121  } else {
122  m_evtSelector = 0;
123  m_evtContext = 0;
124  if ( m_warnings ) {
125  warning() << "Unable to locate service \"EventSelector\" " << endmsg;
126  warning() << "No events will be processed from external input." << endmsg;
127  }
128  }
129 
130  // Setup access to histogramming services
131  m_histoDataMgrSvc = serviceLocator()->service( "HistogramDataSvc" );
132  if ( !m_histoDataMgrSvc ) {
133  fatal() << "Error retrieving HistogramDataSvc." << endmsg;
134  return sc;
135  }
136  // Setup histogram persistency
137  m_histoPersSvc = serviceLocator()->service( "HistogramPersistencySvc" );
138  if ( !m_histoPersSvc ) {
139  warning() << "Histograms cannot not be saved - though required." << endmsg;
140  return sc;
141  }
142 
143  // Setup algorithm resource pool
144  m_algResourcePool = serviceLocator()->service( "AlgResourcePool" );
145  if ( !m_algResourcePool ) {
146  fatal() << "Error retrieving AlgResourcePool" << endmsg;
147  return StatusCode::FAILURE;
148  }
149 
150  m_algExecStateSvc = serviceLocator()->service( "AlgExecStateSvc" );
151  if ( !m_algExecStateSvc ) {
152  fatal() << "Error retrieving AlgExecStateSvc" << endmsg;
153  return StatusCode::FAILURE;
154  }
155 
157  info() << "Found " << m_eventNumberBlacklist.size() << " events in black list" << endmsg;
158 
159  return StatusCode::SUCCESS;
160 }
161 //--------------------------------------------------------------------------------------------
162 // implementation of IService::reinitialize
163 //--------------------------------------------------------------------------------------------
165 {
166 
167  // Check to see whether a new Event Selector has been specified
168  setProperty( m_appMgrProperty->getProperty( "EvtSel" ) );
169  if ( m_evtsel != "NONE" || m_evtsel.empty() ) {
170  auto theSvc = serviceLocator()->service( "EventSelector" );
171  auto theEvtSel = theSvc.as<IEvtSelector>();
172  StatusCode sc;
173  if ( theEvtSel && ( theEvtSel.get() != m_evtSelector.get() ) ) {
174  // Setup Event Selector
175  if ( m_evtSelector.get() && m_evtContext ) {
176  // Need to release context before switching to new event selector
178  m_evtContext = nullptr;
179  }
180  m_evtSelector = theEvtSel;
181  if ( theSvc->FSMState() == Gaudi::StateMachine::INITIALIZED ) {
182  sc = theSvc->reinitialize();
183  if ( !sc.isSuccess() ) {
184  error() << "Failure Reinitializing EventSelector " << theSvc->name() << endmsg;
185  return sc;
186  }
187  } else {
188  sc = theSvc->sysInitialize();
189  if ( !sc.isSuccess() ) {
190  error() << "Failure Initializing EventSelector " << theSvc->name() << endmsg;
191  return sc;
192  }
193  }
195  if ( !sc.isSuccess() ) {
196  error() << "Can not create Context " << theSvc->name() << endmsg;
197  return sc;
198  }
199 
200  } else if ( m_evtSelector ) {
201  if ( m_evtContext ) {
203  m_evtContext = nullptr;
204  }
206  if ( !sc.isSuccess() ) {
207  error() << "Can not create Context " << theSvc->name() << endmsg;
208  return sc;
209  }
210  }
211  } else if ( m_evtSelector && m_evtContext ) {
213  m_evtSelector = nullptr;
214  m_evtContext = nullptr;
215  }
216  return StatusCode::SUCCESS;
217 }
218 
219 //--------------------------------------------------------------------------------------------
220 // implementation of IService::stop
221 //--------------------------------------------------------------------------------------------
222 // Removed call to MinimalEventLoopMgr!
224 {
225  if ( !m_endEventFired ) {
226  // Fire pending EndEvent incident
227  m_incidentSvc->fireIncident( Incident( name(), IncidentType::EndEvent ) );
228  m_endEventFired = true;
229  }
230  return StatusCode::SUCCESS;
231 }
232 
233 //--------------------------------------------------------------------------------------------
234 // implementation of IAppMgrUI::finalize
235 //--------------------------------------------------------------------------------------------
236 // Removed call to MinimalEventLoopMgr!
238 {
239 
240  StatusCode scRet;
242 
243  if ( sc.isFailure() ) {
244  scRet = StatusCode::FAILURE;
245  error() << "Problems finalizing Service base class" << endmsg;
246  }
247 
248  // Save Histograms Now
249  if ( m_histoPersSvc ) {
250  HistogramAgent agent;
251  sc = m_histoDataMgrSvc->traverseTree( &agent );
252  if ( sc.isSuccess() ) {
253  const IDataSelector& objects = agent.selectedObjects();
254  // skip /stat entry!
255  sc = std::accumulate( begin( objects ), end( objects ), sc, [&]( StatusCode s, const auto& i ) {
256  IOpaqueAddress* pAddr = nullptr;
257  StatusCode iret = m_histoPersSvc->createRep( i, pAddr );
258  if ( iret.isSuccess() ) i->registry()->setAddress( pAddr );
259  return s.isFailure() ? s : iret;
260  } );
261  sc = std::accumulate( begin( objects ), end( objects ), sc, [&]( StatusCode s, const auto& i ) {
262  IRegistry* reg = i->registry();
263  StatusCode iret = m_histoPersSvc->fillRepRefs( reg->address(), i );
264  return s.isFailure() ? s : iret;
265  } );
266  if ( sc.isSuccess() ) {
267  info() << "Histograms converted successfully according to request." << endmsg;
268  } else {
269  error() << "Error while saving Histograms." << endmsg;
270  }
271  } else {
272  error() << "Error while traversing Histogram data store" << endmsg;
273  }
274  }
275 
276  scRet = sc;
277 
278  // Release event selector context
279  if ( m_evtSelector && m_evtContext ) {
281  m_evtContext = nullptr;
282  }
283 
285  m_appMgrUI.reset();
286 
287  // Release all interfaces...
290 
294 
295  return scRet;
296 }
297 
298 //--------------------------------------------------------------------------------------------
299 // implementation of executeEvent(void* par)
300 //--------------------------------------------------------------------------------------------
302 {
303 
304  // Leave the interface intact and swallow this C trick.
305  int& createdEvts = *( (int*)createdEvts_IntPtr );
306 
307  EventContext* evtContext( nullptr );
308 
309  // Check if event number is in blacklist
310  if ( LIKELY( m_blackListBS != nullptr ) ) { // we are processing a finite number of events, use bitset blacklist
311  if ( m_blackListBS->test( createdEvts ) ) {
312  verbose() << "Event " << createdEvts << " on black list" << endmsg;
314  }
315  } else if ( std::binary_search( m_eventNumberBlacklist.begin(), m_eventNumberBlacklist.end(), createdEvts ) ) {
316 
317  verbose() << "Event " << createdEvts << " on black list" << endmsg;
319  }
320 
321  if ( createEventContext( evtContext, createdEvts ).isFailure() ) {
322  fatal() << "Impossible to create event context" << endmsg;
323  return StatusCode::FAILURE;
324  }
325 
326  verbose() << "Beginning to process event " << createdEvts << endmsg;
327 
328  // An incident may schedule a stop, in which case is better to exit before the actual execution.
329  // DP have to find out who shoots this
330  /* if ( m_scheduledStop ) {
331  always() << "Terminating event processing loop due to a stop scheduled by an incident listener" << endmsg;
332  return StatusCode::SUCCESS;
333  }*/
334 
335  StatusCode declEvtRootSc = declareEventRootAddress();
336  if ( declEvtRootSc.isFailure() ) { // We ran out of events!
337  createdEvts = -1; // Set created event to a negative value: we finished!
338  return StatusCode::SUCCESS;
339  }
340 
341  // Fire BeginEvent "Incident"
342  m_incidentSvc->fireIncident( std::make_unique<Incident>( name(), IncidentType::BeginEvent, *evtContext ) );
343 
344  // Now add event to the scheduler
345  verbose() << "Adding event " << evtContext->evt() << ", slot " << evtContext->slot() << " to the scheduler" << endmsg;
346 
347  m_incidentSvc->fireIncident( std::make_unique<Incident>( name(), IncidentType::BeginProcessing, *evtContext ) );
348 
349  StatusCode addEventStatus = m_schedulerSvc->pushNewEvent( evtContext );
350 
351  // If this fails, we need to wait for something to complete
352  if ( !addEventStatus.isSuccess() ) {
353  fatal() << "An event processing slot should be now free in the scheduler, but it appears not to be the case."
354  << endmsg;
355  }
356 
357  createdEvts++;
358  return StatusCode::SUCCESS;
359 }
360 
361 //--------------------------------------------------------------------------------------------
362 // implementation of IEventProcessing::executeRun
363 //--------------------------------------------------------------------------------------------
365 {
366  StatusCode sc;
367  bool eventfailed = false;
368 
369  if ( maxevt > 0 ) { // finite number of events to process
370  const unsigned int umaxevt = static_cast<unsigned int>( maxevt );
371  m_blackListBS = new boost::dynamic_bitset<>( maxevt ); // all initialized to zero
372  for ( unsigned int i = 0; i < m_eventNumberBlacklist.size() && m_eventNumberBlacklist[i] <= umaxevt;
373  ++i ) { // black list is sorted in init
374  m_blackListBS->set( m_eventNumberBlacklist[i], true );
375  }
376  }
377 
378  // Call now the nextEvent(...)
379  sc = nextEvent( maxevt );
380  if ( sc.isFailure() ) eventfailed = true;
381 
382  delete m_blackListBS;
383 
384  return eventfailed ? StatusCode::FAILURE : StatusCode::SUCCESS;
385 }
386 
387 //--------------------------------------------------------------------------------------------
388 // Implementation of IEventProcessor::stopRun()
389 //--------------------------------------------------------------------------------------------
391 {
392  // Set the application return code
393  auto appmgr = serviceLocator()->as<IProperty>();
395  error() << "Could not set return code of the application (" << Gaudi::ReturnCode::ScheduledStop << ")" << endmsg;
396  }
397  m_scheduledStop = true;
398  return StatusCode::SUCCESS;
399 }
400 
401 //--------------------------------------------------------------------------------------------
402 // implementation of IAppMgrUI::nextEvent
403 //--------------------------------------------------------------------------------------------
404 // Here the loop on the events takes place.
405 // This is also the natural place to put the preparation of the algorithms
406 // contexts, which contain the event specific data.
407 #include "GaudiKernel/Memory.h"
409 {
410 
411  // Calculate runtime
413 
414  // Reset the application return code.
416 
417  int finishedEvts = 0;
418  int createdEvts = 0;
419  int skippedEvts = 0;
420  info() << "Starting loop on events" << endmsg;
421  // Loop until the finished events did not reach the maxevt number
422  bool loop_ended = false;
423  // Run the first event before spilling more than one
424  bool newEvtAllowed = false;
425 
426  constexpr double oneOver1024 = 1. / 1024.;
427 
428  uint iteration = 0;
429  auto start_time = Clock::now();
430  while ( !loop_ended && ( maxevt < 0 || ( finishedEvts + skippedEvts ) < maxevt ) ) {
431  debug() << "work loop iteration " << iteration++ << endmsg;
432  // if the created events did not reach maxevt, create an event
433  if ( ( newEvtAllowed || createdEvts == 0 ) && // Launch the first event alone
434  createdEvts >= 0 && // The events are not finished with an unlimited number of events
435  ( createdEvts < maxevt || maxevt < 0 ) && // The events are not finished with a limited number of events
436  m_schedulerSvc->freeSlots() > 0 && // There are still free slots in the scheduler
437  m_whiteboard->freeSlots() > 0 ) { // There are still free slots in the whiteboard
438 
439  if ( 1 == createdEvts ) // reset counter to count from event 1
440  start_time = Clock::now();
441 
442  debug() << "createdEvts: " << createdEvts << ", freeslots: " << m_schedulerSvc->freeSlots() << endmsg;
443  // DP remove to remove the syscalls...
444  // if (0!=createdEvts){
445  // info() << "Event Number = " << createdEvts
446  // << " WSS (MB) = " << System::mappedMemory(System::MemoryUnit::kByte)*oneOver1024
447  // << " Time (s) = " << secsFromStart(start_time) << endmsg;
448  // }
449 
450  // TODO can we adapt the interface of executeEvent for a nicer solution?
452  while ( !sc.isSuccess() // we haven't created an event yet
453  && ( createdEvts < maxevt || maxevt < 0 ) ) { // redunant check for maxEvts, can we do better?
454  sc = executeEvent( &createdEvts );
455 
456  if ( sc.isRecoverable() ) { // we skipped an event
457 
458  // this is all to skip the event
459  size_t slot =
460  m_whiteboard->allocateStore( createdEvts ); // we need a new store, not to change the previous event
461  m_whiteboard->selectStore( slot );
462  declareEventRootAddress(); // actually skip over the event
463  m_whiteboard->freeStore( slot ); // delete the store
464 
465  ++createdEvts;
466  ++skippedEvts;
467  } else if ( sc.isRecoverable() ) { // exit immediatly
468  return StatusCode::FAILURE;
469  } // else we have an success --> exit loop
470  }
471 
472  } // end if condition createdEvts < maxevt
473  else {
474  // all the events were created but not all finished or the slots were
475  // all busy: the scheduler should finish its job
476 
477  debug() << "Draining the scheduler" << endmsg;
478 
479  // Pull out of the scheduler the finished events
480  if ( drainScheduler( finishedEvts ).isFailure() ) loop_ended = true;
481  newEvtAllowed = true;
482  }
483  } // end main loop on finished events
484  auto end_time = Clock::now();
485 
486  info() << "---> Loop Finished (skipping 1st evt) - "
487  << " WSS " << System::mappedMemory( System::MemoryUnit::kByte ) * oneOver1024 << " total time "
488  << std::chrono::duration_cast<std::chrono::nanoseconds>( end_time - start_time ).count() << endmsg;
489  info() << skippedEvts << " events were SKIPed" << endmsg;
490 
491  return StatusCode::SUCCESS;
492 }
493 
494 //---------------------------------------------------------------------------
495 
498 {
499  refpAddr = nullptr;
501  if ( sc.isFailure() ) return sc;
502  // Create root address and assign address to data service
503  sc = m_evtSelector->createAddress( *m_evtContext, refpAddr );
504  if ( sc.isSuccess() ) return sc;
505  sc = m_evtSelector->next( *m_evtContext );
506  if ( sc.isFailure() ) return sc;
507  sc = m_evtSelector->createAddress( *m_evtContext, refpAddr );
508  if ( !sc.isSuccess() ) warning() << "Error creating IOpaqueAddress." << endmsg;
509  return sc;
510 }
511 
512 //---------------------------------------------------------------------------
513 
515 {
516  StatusCode sc;
517  if ( m_evtContext ) {
518  //---This is the "event iterator" context from EventSelector
519  IOpaqueAddress* pAddr = nullptr;
520  sc = getEventRoot( pAddr );
521  if ( !sc.isSuccess() ) {
522  info() << "No more events in event selection " << endmsg;
523  return StatusCode::FAILURE;
524  }
525  sc = m_evtDataMgrSvc->setRoot( "/Event", pAddr );
526  if ( !sc.isSuccess() ) {
527  warning() << "Error declaring event root address." << endmsg;
528  }
529  } else {
530  //---In case of no event selector----------------
531  sc = m_evtDataMgrSvc->setRoot( "/Event", new DataObject() );
532  if ( !sc.isSuccess() ) {
533  warning() << "Error declaring event root DataObject" << endmsg;
534  }
535  }
536  return StatusCode::SUCCESS;
537 }
538 
539 //---------------------------------------------------------------------------
540 
542 {
543  evtContext = new EventContext;
544  evtContext->set( createdEvts, m_whiteboard->allocateStore( createdEvts ) );
545  m_algExecStateSvc->reset( *evtContext );
546 
547  StatusCode sc = m_whiteboard->selectStore( evtContext->slot() );
548  if ( sc.isFailure() ) {
549  warning() << "Slot " << evtContext->slot() << " could not be selected for the WhiteBoard" << endmsg;
550  }
551  return sc;
552 }
553 
554 //---------------------------------------------------------------------------
555 
557 {
558 
560 
561  // maybe we can do better
562  std::vector<EventContext*> finishedEvtContexts;
563 
564  EventContext* finishedEvtContext( nullptr );
565 
566  // Here we wait not to loose cpu resources
567  debug() << "Waiting for a context" << endmsg;
568  sc = m_schedulerSvc->popFinishedEvent( finishedEvtContext );
569 
570  // We got past it: cache the pointer
571  if ( sc.isSuccess() ) {
572  debug() << "Context obtained" << endmsg;
573  } else {
574  // A problem occurred.
575  debug() << "Context not obtained: a problem in the scheduling?" << endmsg;
576  // return StatusCode::FAILURE;
577  }
578 
579  finishedEvtContexts.push_back( finishedEvtContext );
580 
581  // Let's see if we can pop other event contexts
582  while ( m_schedulerSvc->tryPopFinishedEvent( finishedEvtContext ).isSuccess() ) {
583  finishedEvtContexts.push_back( finishedEvtContext );
584  }
585 
586  // Now we flush them
587  StatusCode finalSC;
588  for ( auto& thisFinishedEvtContext : finishedEvtContexts ) {
589  if ( !thisFinishedEvtContext ) {
590  error() << "Detected nullptr ctxt before clearing WB!" << endmsg;
591  finalSC = StatusCode::FAILURE;
592  continue;
593  }
594  if ( m_algExecStateSvc->eventStatus( *thisFinishedEvtContext ) != EventStatus::Success ) {
595  fatal() << "Failed event detected on " << thisFinishedEvtContext << endmsg;
596  finalSC = StatusCode::FAILURE;
597  }
598  // shouldn't these incidents move to the forward scheduler?
599  // If we want to consume incidents with an algorithm at the end of the graph
600  // we need to add this to forward scheduler lambda action,
601  // otherwise we have to do this serially on this thread!
602  m_incidentSvc->fireIncident( Incident( name(), IncidentType::EndProcessing, *thisFinishedEvtContext ) );
603  m_incidentSvc->fireIncident( Incident( name(), IncidentType::EndEvent, *thisFinishedEvtContext ) );
604 
605  debug() << "Clearing slot " << thisFinishedEvtContext->slot() << " (event " << thisFinishedEvtContext->evt()
606  << ") of the whiteboard" << endmsg;
607 
608  StatusCode sc = clearWBSlot( thisFinishedEvtContext->slot() );
609  if ( !sc.isSuccess() )
610  error() << "Whiteboard slot " << thisFinishedEvtContext->slot() << " could not be properly cleared";
611 
612  delete thisFinishedEvtContext;
613 
614  finishedEvts++;
615  }
616  return finalSC;
617 }
618 
619 //---------------------------------------------------------------------------
620 
622 {
623  StatusCode sc = m_whiteboard->clearStore( evtSlot );
624  if ( !sc.isSuccess() ) warning() << "Clear of Event data store failed" << endmsg;
625  return m_whiteboard->freeStore( evtSlot );
626 }
627 //---------------------------------------------------------------------------
virtual StatusCode traverseTree(IDataStoreAgent *pAgent)=0
Analyse by traversing all data objects in the data store.
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
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.
MsgStream & verbose() const
shortcut for the method msgStream(MSG::VERBOSE)
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
#define DECLARE_COMPONENT(type)
Definition: PluginService.h:33
ContextEvt_t evt() const
Definition: EventContext.h:39
STL class.
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;.
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:127
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.
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
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.