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