| The Gaudi Framework v32r1 (f65d50dc)

Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
HiveSlimEventLoopMgr Class Reference

`#include <GaudiHive/HiveSlimEventLoopMgr.h>`

Inheritance diagram for HiveSlimEventLoopMgr:
[legend]
Collaboration diagram for HiveSlimEventLoopMgr:
[legend]

## Public Member Functions
| ~HiveSlimEventLoopMgr () override
StatusCode | getEventRoot (IOpaqueAddress *&refpAddr)
| Create event address using event selector. More...
StatusCode | initialize () override
| implementation of IService::initialize More...
StatusCode | reinitialize () override
| implementation of IService::reinitialize More...
StatusCode | stop () override
| implementation of IService::stop More...
StatusCode | finalize () override
| implementation of IService::finalize More...
StatusCode | nextEvent (int maxevt) override
| implementation of IService::nextEvent More...
EventContext | createEventContext () override
| implementation of IEventProcessor::createEventContext() More...
StatusCode | executeEvent (EventContext &&ctx) override
| implementation of IEventProcessor::executeEvent(EventContext&&) More...
StatusCode | executeRun (int maxevt) override
| implementation of IEventProcessor::executeRun() More...
StatusCode | stopRun () override
| implementation of IEventProcessor::stopRun() More...
Public Member Functions inherited from extends< Service, IEventProcessor >
void * | i_cast (const InterfaceID &tid) const override
| Implementation of IInterface::i_cast. More...
StatusCode | queryInterface (const InterfaceID &ti, void **pp) override
| Implementation of IInterface::queryInterface. More...
std::vector< std::string > | getInterfaceNames () const override
| Implementation of IInterface::getInterfaceNames. More...
Public Member Functions inherited from Service
const std::string & | name () const override
| Retrieve name of the service. More...
StatusCode | configure () override
StatusCode | initialize () override
StatusCode | start () override
StatusCode | stop () override
StatusCode | finalize () override
StatusCode | terminate () override
Gaudi::StateMachine::State | FSMState () const override
Gaudi::StateMachine::State | targetFSMState () const override
StatusCode | reinitialize () override
StatusCode | restart () override
StatusCode | sysInitialize () override
| Initialize Service. More...
StatusCode | sysStart () override
| Initialize Service. More...
StatusCode | sysStop () override
| Initialize Service. More...
StatusCode | sysFinalize () override
| Finalize Service. More...
StatusCode | sysReinitialize () override
| Re-initialize the Service. More...
StatusCode | sysRestart () override
| Re-initialize the Service. More...
| Service (std::string name, ISvcLocator *svcloc)
| Standard Constructor. More...
SmartIF< ISvcLocator > & | serviceLocator () const override
| Retrieve pointer to service locator. More...
StatusCode | setProperties ()
| Method for setting declared properties to the values specified for the job. More...
template<class T >
StatusCode | service (const std::string &name, const T *&psvc, bool createIf=true) const
| Access a service by name, creating it if it doesn't already exist. More...
template<class T >
StatusCode | service (const std::string &name, T *&psvc, bool createIf=true) const
template<typename IFace = IService>
SmartIF< IFace > | service (const std::string &name, bool createIf=true) const
template<class T >
StatusCode | service (const std::string &svcType, const std::string &svcName, T *&psvc) const
| Access a service by name and type, creating it if it doesn't already exist. More...
template<class T >
StatusCode | declareTool (ToolHandle< T > &handle, std::string toolTypeAndName, bool createIf=true)
| Declare used tool. More...
SmartIF< IAuditorSvc > & | auditorSvc () const
| The standard auditor service.May not be invoked before sysInitialize() has been invoked. More...
Public Member Functions inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
| PropertyHolder ()=default
Gaudi::Details::PropertyBase & | declareProperty (Gaudi::Details::PropertyBase &prop)
| Declare a property. More...
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, TYPE &value, const std::string &doc="none")
| Helper to wrap a regular data member and use it as a regular property. More...
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, Gaudi::Property< TYPE, VERIFIER, HANDLERS > &prop, const std::string &doc="none")
| Declare a PropertyBase instance setting name and documentation. More...
Gaudi::Details::PropertyBase * | declareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="")
| Declare a remote property. More...
StatusCode | setProperty (const Gaudi::Details::PropertyBase &p) override
| set the property form another property More...
StatusCode | setProperty (const std::string &s) override
| set the property from the formatted string More...
StatusCode | setProperty (const std::string &n, const std::string &v) override
| set the property from name and the value More...
StatusCode | setProperty (const std::string &name, const TYPE &value)
| set the property form the value More...
StatusCode | getProperty (Gaudi::Details::PropertyBase *p) const override
| get the property More...
const Gaudi::Details::PropertyBase & | getProperty (const std::string &name) const override
| get the property by name More...
StatusCode | getProperty (const std::string &n, std::string &v) const override
| convert the property to the string More...
const std::vector< Gaudi::Details::PropertyBase * > & | getProperties () const override
| get all properties More...
bool | hasProperty (const std::string &name) const override
| Return true if we have a property with the given name. More...
| PropertyHolder (const PropertyHolder &)=delete
PropertyHolder & | operator= (const PropertyHolder &)=delete
Public Member Functions inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
MSG::Level | msgLevel () const
| get the cached level (originally extracted from the embedded MsgStream) More...
bool | msgLevel (MSG::Level lvl) const
| get the output level from the embedded MsgStream More...
MSG::Level | outputLevel () const
| Backward compatibility function for getting the output level. More...
Public Member Functions inherited from CommonMessagingBase
virtual | ~CommonMessagingBase ()=default
| Virtual destructor. More...
const SmartIF< IMessageSvc > & | msgSvc () const
| The standard message service. More...
MsgStream & | msgStream () const
| Return an uninitialized MsgStream. More...
MsgStream & | msgStream (const MSG::Level level) const
| Predefined configurable message stream for the efficient printouts. More...
MsgStream & | always () const
| shortcut for the method msgStream(MSG::ALWAYS) More...
MsgStream & | fatal () const
| shortcut for the method msgStream(MSG::FATAL) More...
MsgStream & | err () const
| shortcut for the method msgStream(MSG::ERROR) More...
MsgStream & | error () const
| shortcut for the method msgStream(MSG::ERROR) More...
MsgStream & | warning () const
| shortcut for the method msgStream(MSG::WARNING) More...
MsgStream & | info () const
| shortcut for the method msgStream(MSG::INFO) More...
MsgStream & | debug () const
| shortcut for the method msgStream(MSG::DEBUG) More...
MsgStream & | verbose () const
| shortcut for the method msgStream(MSG::VERBOSE) More...
MsgStream & | msg () const
| shortcut for the method msgStream(MSG::INFO) More...

## Protected Member Functions
StatusCode | clearWBSlot (int evtSlot)
| Clear a slot in the WB. More...
StatusCode | declareEventRootAddress ()
| Declare the root address of the event. More...
StatusCode | drainScheduler (int &finishedEvents)
| Drain the scheduler from all actions that may be queued. More...
Protected Member Functions inherited from Service
| ~Service () override
| Standard Destructor. More...
int | outputLevel () const
| get the `Service's` output level More...
Protected Member Functions inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
Gaudi::Details::PropertyBase * | property (const std::string &name) const
Protected Member Functions inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
MSG::Level | setUpMessaging () const
| Set up local caches. More...
MSG::Level | resetMessaging ()
| Reinitialize internal states. More...
void | updateMsgStreamOutputLevel (int level)
| Update the output level of the cached MsgStream. More...

## Protected Attributes
Gaudi::Property< std::string > | m_histPersName {this, "HistogramPersistency", "", ""}
Gaudi::Property< std::string > | m_evtsel {this, "EvtSel", "", ""}
Gaudi::Property< bool > | m_warnings {this, "Warnings", true, "Set this property to false to suppress warning messages"}
Gaudi::Property< std::string > | m_schedulerName
Gaudi::Property< std::vector< unsigned int > > | m_eventNumberBlacklist {this, "EventNumberBlackList", {}, ""}
Gaudi::Property< bool > | m_abortOnFailure {this, "AbortOnFailure", true, "Abort job on event failure"}
SmartIF< IDataManagerSvc > | m_evtDataMgrSvc
| Reference to the Event Data Service's IDataManagerSvc interface. More...
SmartIF< IEvtSelector > | m_evtSelector
| Reference to the Event Selector. More...
IEvtSelector::Context * | m_evtContext = nullptr
| Event Iterator. More...
SmartIF< IDataManagerSvc > | m_histoDataMgrSvc
| Reference to the Histogram Data Service. More...
SmartIF< IConversionSvc > | m_histoPersSvc
| Reference to the Histogram Persistency Service. More...
SmartIF< IHiveWhiteBoard > | m_whiteboard
| Reference to the Whiteboard. More...
SmartIF< IAlgResourcePool > | m_algResourcePool
| Reference to the Algorithm resource pool. More...
SmartIF< IAlgExecStateSvc > | m_algExecStateSvc
| Reference to the AlgExecStateSvc. More...
SmartIF< IProperty > | m_appMgrProperty
| Property interface of ApplicationMgr. More...
bool | m_endEventFired = false
| Flag to avoid to fire the EnvEvent incident twice in a row (and also not before the first event) More...
SmartIF< IScheduler > | m_schedulerSvc
| A shortcut for the scheduler. More...
SmartIF< IIncidentListener > | m_abortEventListener
| Instance of the incident listener waiting for AbortEvent. More...
bool | m_scheduledStop = false
| Scheduled stop of event processing. More...
SmartIF< IIncidentSvc > | m_incidentSvc
| Reference to the incident service. More...
std::unique_ptr< boost::dynamic_bitset<> > | m_blackListBS
EventContext::ContextEvt_t | m_nevt {0}
Protected Attributes inherited from Service
Gaudi::StateMachine::State | m_state = Gaudi::StateMachine::OFFLINE
| Service state. More...
Gaudi::StateMachine::State | m_targetState = Gaudi::StateMachine::OFFLINE
| Service state. More...
Gaudi::Property< int > | m_outputLevel {this, "OutputLevel", MSG::NIL, "output level"}
Gaudi::Property< bool > | m_auditInit {this, "AuditServices", false, " unused"}
Gaudi::Property< bool > | m_auditorInitialize {this, "AuditInitialize", false, "trigger auditor on initialize()"}
Gaudi::Property< bool > | m_auditorStart {this, "AuditStart", false, "trigger auditor on start()"}
Gaudi::Property< bool > | m_auditorStop {this, "AuditStop", false, "trigger auditor on stop()"}
Gaudi::Property< bool > | m_auditorFinalize {this, "AuditFinalize", false, "trigger auditor on finalize()"}
Gaudi::Property< bool > | m_auditorReinitialize {this, "AuditReinitialize", false, "trigger auditor on reinitialize()"}
Gaudi::Property< bool > | m_auditorRestart {this, "AuditRestart", false, "trigger auditor on restart()"}
SmartIF< IAuditorSvc > | m_pAuditorSvc
| Auditor Service. More...

## Additional Inherited Members
Public Types inherited from extends< Service, IEventProcessor >
using | base_class = extends
| Typedef to this class. More...
using | extend_interfaces_base = extend_interfaces< Interfaces... >
| Typedef to the base of this class. More...
Public Types inherited from Service
using | Factory = Gaudi::PluginService::Factory< IService *(const std::string &, ISvcLocator *)>
Public Types inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
using | PropertyHolderImpl = PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
| Typedef used to refer to this class from derived classes, as in. More...
Public Types inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
using | base_class = CommonMessaging
Public Types inherited from extend_interfaces< Interfaces... >
using | ext_iids = typename Gaudi::interface_list_cat< typename Interfaces::ext_iids... >::type
| take union of the ext_iids of all Interfaces... More...

## Detailed Description

Definition at line 22 of file HiveSlimEventLoopMgr.h.

## Constructor & Destructor Documentation

## ◆ ~HiveSlimEventLoopMgr()

HiveSlimEventLoopMgr::~HiveSlimEventLoopMgr | ( |  | ) |
| override

Definition at line 27 of file HiveSlimEventLoopMgr.cpp.

27 { delete m_evtContext; }
HiveSlimEventLoopMgr::m_evtContext
IEvtSelector::Context * m_evtContext
Event Iterator.
Definition: HiveSlimEventLoopMgr.h:38

## Member Function Documentation

## ◆ clearWBSlot()

StatusCode HiveSlimEventLoopMgr::clearWBSlot | ( | int | evtSlot | ) |
| protected

Clear a slot in the WB.

Definition at line 550 of file HiveSlimEventLoopMgr.cpp.

550 {
551 StatusCode sc = m_whiteboard->clearStore( evtSlot );
552 if ( !sc.isSuccess() ) warning() << "Clear of Event data store failed" << endmsg;
553 return m_whiteboard->freeStore( evtSlot );
554 }
CommonMessagingBase::warning
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
Definition: CommonMessaging.h:101
HiveSlimEventLoopMgr::m_whiteboard
SmartIF< IHiveWhiteBoard > m_whiteboard
Reference to the Whiteboard.
Definition: HiveSlimEventLoopMgr.h:44
IHiveWhiteBoard::clearStore
virtual StatusCode clearStore(size_t partitionIndex)=0
Clear an given 'slot'.
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
StatusCode::isSuccess
bool isSuccess() const
Definition: StatusCode.h:267
IHiveWhiteBoard::freeStore
virtual StatusCode freeStore(size_t partitionIndex)=0
Free a store partition.
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192

## ◆ createEventContext()

EventContext HiveSlimEventLoopMgr::createEventContext | ( |  | ) |
| override

implementation of IEventProcessor::createEventContext()

Definition at line 475 of file HiveSlimEventLoopMgr.cpp.

475 {
476 EventContext ctx{m_nevt, m_whiteboard->allocateStore( m_nevt )};
477 ++m_nevt;
478
479 StatusCode sc = m_whiteboard->selectStore( ctx.slot() );
480 if ( sc.isFailure() ) {
481 throw GaudiException( "Slot " + std::to_string( ctx.slot() ) + " could not be selected for the WhiteBoard", name(),
482 sc );
483 }
484 if ( declareEventRootAddress().isFailure() ) { // We ran out of events!
485 // invalid context terminates the loop
486 return EventContext{};
487 }
488 return ctx;
489 }
GaudiException
Define general base for Gaudi exception.
Definition: GaudiException.h:21
HiveSlimEventLoopMgr::declareEventRootAddress
StatusCode declareEventRootAddress()
Declare the root address of the event.
Definition: HiveSlimEventLoopMgr.cpp:453
HiveSlimEventLoopMgr::m_whiteboard
SmartIF< IHiveWhiteBoard > m_whiteboard
Reference to the Whiteboard.
Definition: HiveSlimEventLoopMgr.h:44
std::to_string
T to_string(T... args)
EventContext
This class represents an entry point to all the event specific data.
Definition: EventContext.h:24
Service::name
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:274
IHiveWhiteBoard::selectStore
virtual StatusCode selectStore(size_t partitionIndex)=0
Activate an given 'slot' for all subsequent calls within the same thread id.
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
IHiveWhiteBoard::allocateStore
virtual size_t allocateStore(int evtnumber)=0
Allocate a store partition for new event.
StatusCode::isFailure
bool isFailure() const
Definition: StatusCode.h:130
HiveSlimEventLoopMgr::m_nevt
EventContext::ContextEvt_t m_nevt
Definition: HiveSlimEventLoopMgr.h:72

## ◆ declareEventRootAddress()

StatusCode HiveSlimEventLoopMgr::declareEventRootAddress | ( |  | ) |
| protected

Declare the root address of the event.

Definition at line 453 of file HiveSlimEventLoopMgr.cpp.

453 {
454 StatusCode sc;
455 if ( m_evtContext ) {
456 //---This is the "event iterator" context from EventSelector
457 IOpaqueAddress* pAddr = nullptr;
458 sc = getEventRoot( pAddr );
459 if ( !sc.isSuccess() ) {
460 info() << "No more events in event selection " << endmsg;
461 return StatusCode::FAILURE;
462 }
463 sc = m_evtDataMgrSvc->setRoot( "/Event", pAddr );
464 if ( !sc.isSuccess() ) { warning() << "Error declaring event root address." << endmsg; }
465 } else {
466 //---In case of no event selector----------------
467 sc = m_evtDataMgrSvc->setRoot( "/Event", new DataObject() );
468 if ( !sc.isSuccess() ) { warning() << "Error declaring event root DataObject" << endmsg; }
469 }
470 return StatusCode::SUCCESS;
471 }
HiveSlimEventLoopMgr::m_evtDataMgrSvc
SmartIF< IDataManagerSvc > m_evtDataMgrSvc
Reference to the Event Data Service's IDataManagerSvc interface.
Definition: HiveSlimEventLoopMgr.h:34
CommonMessagingBase::warning
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
Definition: CommonMessaging.h:101
IDataManagerSvc::setRoot
virtual StatusCode setRoot(std::string root_name, DataObject *pObject)=0
Initialize data store for new event by giving new event path.
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
CommonMessagingBase::info
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
Definition: CommonMessaging.h:104
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
HiveSlimEventLoopMgr::getEventRoot
StatusCode getEventRoot(IOpaqueAddress *&refpAddr)
Create event address using event selector.
Definition: HiveSlimEventLoopMgr.cpp:437
StatusCode::isSuccess
bool isSuccess() const
Definition: StatusCode.h:267
GaudiPython.Bindings.DataObject
DataObject
Definition: Bindings.py:55
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:86
IOpaqueAddress
Opaque address interface definition.
Definition: IOpaqueAddress.h:23
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192
HiveSlimEventLoopMgr::m_evtContext
IEvtSelector::Context * m_evtContext
Event Iterator.
Definition: HiveSlimEventLoopMgr.h:38

## ◆ drainScheduler()

StatusCode HiveSlimEventLoopMgr::drainScheduler | ( | int & | finishedEvents | ) |
| protected

Drain the scheduler from all actions that may be queued.

Definition at line 493 of file HiveSlimEventLoopMgr.cpp.

493 {
494
495 StatusCode sc( StatusCode::SUCCESS );
496
497 // maybe we can do better
498 std::vector<EventContext*> finishedEvtContexts;
499
500 EventContext* finishedEvtContext( nullptr );
501
502 // Here we wait not to loose cpu resources
503 DEBUG_MSG << "Waiting for a context" << endmsg;
504 sc = m_schedulerSvc->popFinishedEvent( finishedEvtContext );
505
506 // We got past it: cache the pointer
507 DEBUG_MSG << "Context " << ( sc.isSuccess() ? "obtained" : "not obtained: a problem in the scheduling?" ) << endmsg;
508 finishedEvtContexts.push_back( finishedEvtContext );
509
510 // Let's see if we can pop other event contexts
511 while ( m_schedulerSvc->tryPopFinishedEvent( finishedEvtContext ).isSuccess() ) {
512 finishedEvtContexts.push_back( finishedEvtContext );
513 }
514
515 // Now we flush them
516 StatusCode finalSC;
517 for ( auto& thisFinishedEvtContext : finishedEvtContexts ) {
518 if ( !thisFinishedEvtContext ) {
519 error() << "Detected nullptr ctxt before clearing WB!" << endmsg;
520 finalSC = StatusCode::FAILURE;
521 continue;
522 }
523 if ( m_algExecStateSvc->eventStatus( *thisFinishedEvtContext ) != EventStatus::Success ) {
524 ( m_abortOnFailure ? fatal() : error() ) << "Failed event detected on " << thisFinishedEvtContext << endmsg;
525 if ( m_abortOnFailure ) finalSC = StatusCode::FAILURE;
526 }
527 // shouldn't these incidents move to the forward scheduler?
528 // If we want to consume incidents with an algorithm at the end of the graph
529 // we need to add this to forward scheduler lambda action,
530 // otherwise we have to do this serially on this thread!
531 m_incidentSvc->fireIncident( Incident( name(), IncidentType::EndProcessing, *thisFinishedEvtContext ) );
532 m_incidentSvc->fireIncident( Incident( name(), IncidentType::EndEvent, *thisFinishedEvtContext ) );
533
534 DEBUG_MSG << "Clearing slot " << thisFinishedEvtContext->slot() << " (event " << thisFinishedEvtContext->evt()
535 << ") of the whiteboard" << endmsg;
536
537 StatusCode sc = clearWBSlot( thisFinishedEvtContext->slot() );
538 if ( !sc.isSuccess() )
539 error() << "Whiteboard slot " << thisFinishedEvtContext->slot() << " could not be properly cleared";
540
541 delete thisFinishedEvtContext;
542
543 ++finishedEvts;
544 }
545 return finalSC;
546 }
DEBUG_MSG
#define DEBUG_MSG
Definition: HiveSlimEventLoopMgr.cpp:19
HiveSlimEventLoopMgr::clearWBSlot
StatusCode clearWBSlot(int evtSlot)
Clear a slot in the WB.
Definition: HiveSlimEventLoopMgr.cpp:550
HiveSlimEventLoopMgr::m_incidentSvc
SmartIF< IIncidentSvc > m_incidentSvc
Reference to the incident service.
Definition: HiveSlimEventLoopMgr.h:67
HiveSlimEventLoopMgr::m_abortOnFailure
Gaudi::Property< bool > m_abortOnFailure
Definition: HiveSlimEventLoopMgr.h:31
IAlgExecStateSvc::eventStatus
virtual const EventStatus::Status & eventStatus(const EventContext &ctx) const =0
HiveSlimEventLoopMgr::m_schedulerSvc
SmartIF< IScheduler > m_schedulerSvc
A shortcut for the scheduler.
Definition: HiveSlimEventLoopMgr.h:55
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
EventContext
This class represents an entry point to all the event specific data.
Definition: EventContext.h:24
Service::name
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:274
std::vector::push_back
T push_back(T... args)
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:98
IIncidentSvc::fireIncident
virtual void fireIncident(const Incident &incident)=0
Fire an Incident.
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
EventStatus::Success
Definition: IAlgExecStateSvc.h:63
StatusCode::isSuccess
bool isSuccess() const
Definition: StatusCode.h:267
std::vector
STL class.
HiveSlimEventLoopMgr::m_algExecStateSvc
SmartIF< IAlgExecStateSvc > m_algExecStateSvc
Reference to the AlgExecStateSvc.
Definition: HiveSlimEventLoopMgr.h:48
IScheduler::tryPopFinishedEvent
virtual StatusCode tryPopFinishedEvent(EventContext *&eventContext)=0
Try to retrieve a finished event from the scheduler.
Incident
Base class for all Incidents (computing events).
Definition: Incident.h:17
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:86
CommonMessagingBase::fatal
MsgStream & fatal() const
shortcut for the method msgStream(MSG::FATAL)
Definition: CommonMessaging.h:92
IScheduler::popFinishedEvent
virtual StatusCode popFinishedEvent(EventContext *&eventContext)=0
Retrieve a finished event from the scheduler.
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192

## ◆ executeEvent()

StatusCode HiveSlimEventLoopMgr::executeEvent | ( | EventContext && | ctx | ) |
| override

implementation of IEventProcessor::executeEvent(EventContext&&)

Definition at line 261 of file HiveSlimEventLoopMgr.cpp.

261 {
262
263 m_algExecStateSvc->reset( ctx );
264
265 // Check if event number is in blacklist
266 if ( LIKELY( m_blackListBS != nullptr ) ) { // we are processing a finite number of events, use bitset blacklist
267 if ( m_blackListBS->test( ctx.evt() ) ) {
268 VERBOSE_MSG << "Event " << ctx.evt() << " on black list" << endmsg;
269 m_whiteboard->freeStore( ctx.slot() );
270 return StatusCode::RECOVERABLE;
271 }
272 } else if ( std::binary_search( m_eventNumberBlacklist.begin(), m_eventNumberBlacklist.end(), ctx.evt() ) ) {
273 VERBOSE_MSG << "Event " << ctx.evt() << " on black list" << endmsg;
274 m_whiteboard->freeStore( ctx.slot() );
275 return StatusCode::RECOVERABLE;
276 }
277
278 VERBOSE_MSG << "Beginning to process event " << ctx.evt() << endmsg;
279
280 // An incident may schedule a stop, in which case is better to exit before the actual execution.
281 // DP have to find out who shoots this
282 /* if ( m_scheduledStop ) {
283 always() << "Terminating event processing loop due to a stop scheduled by an incident listener" << endmsg;
284 return StatusCode::SUCCESS;
285 }*/
286
287 // Fire BeginEvent "Incident"
288 m_incidentSvc->fireIncident( std::make_unique<Incident>( name(), IncidentType::BeginEvent, ctx ) );
289
290 // Now add event to the scheduler
291 VERBOSE_MSG << "Adding event " << ctx.evt() << ", slot " << ctx.slot() << " to the scheduler" << endmsg;
292
293 m_incidentSvc->fireIncident( std::make_unique<Incident>( name(), IncidentType::BeginProcessing, ctx ) );
294
295 StatusCode addEventStatus = m_schedulerSvc->pushNewEvent( new EventContext{std::move( ctx )} );
296
297 // If this fails, we need to wait for something to complete
298 if ( !addEventStatus.isSuccess() ) {
299 fatal() << "An event processing slot should be now free in the scheduler, but it appears not to be the case."
300 << endmsg;
301 }
302
303 return StatusCode::SUCCESS;
304 }
HiveSlimEventLoopMgr::m_incidentSvc
SmartIF< IIncidentSvc > m_incidentSvc
Reference to the incident service.
Definition: HiveSlimEventLoopMgr.h:67
HiveSlimEventLoopMgr::m_blackListBS
std::unique_ptr< boost::dynamic_bitset<> > m_blackListBS
Definition: HiveSlimEventLoopMgr.h:70
EventContext::slot
ContextID_t slot() const
Definition: EventContext.h:41
EventContext::evt
ContextEvt_t evt() const
Definition: EventContext.h:40
HiveSlimEventLoopMgr::m_whiteboard
SmartIF< IHiveWhiteBoard > m_whiteboard
Reference to the Whiteboard.
Definition: HiveSlimEventLoopMgr.h:44
HiveSlimEventLoopMgr::m_schedulerSvc
SmartIF< IScheduler > m_schedulerSvc
A shortcut for the scheduler.
Definition: HiveSlimEventLoopMgr.h:55
StatusCode::RECOVERABLE
constexpr static const auto RECOVERABLE
Definition: StatusCode.h:87
std::binary_search
T binary_search(T... args)
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
HiveSlimEventLoopMgr::m_eventNumberBlacklist
Gaudi::Property< std::vector< unsigned int > > m_eventNumberBlacklist
Definition: HiveSlimEventLoopMgr.h:30
EventContext
This class represents an entry point to all the event specific data.
Definition: EventContext.h:24
Service::name
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:274
IIncidentSvc::fireIncident
virtual void fireIncident(const Incident &incident)=0
Fire an Incident.
VERBOSE_MSG
#define VERBOSE_MSG
Definition: HiveSlimEventLoopMgr.cpp:22
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
IScheduler::pushNewEvent
virtual StatusCode pushNewEvent(EventContext *eventContext)=0
Make an event available to the scheduler.
StatusCode::isSuccess
bool isSuccess() const
Definition: StatusCode.h:267
std::move
T move(T... args)
LIKELY
#define LIKELY(x)
Definition: Kernel.h:95
IAlgExecStateSvc::reset
virtual void reset(const EventContext &ctx)=0
HiveSlimEventLoopMgr::m_algExecStateSvc
SmartIF< IAlgExecStateSvc > m_algExecStateSvc
Reference to the AlgExecStateSvc.
Definition: HiveSlimEventLoopMgr.h:48
IHiveWhiteBoard::freeStore
virtual StatusCode freeStore(size_t partitionIndex)=0
Free a store partition.
CommonMessagingBase::fatal
MsgStream & fatal() const
shortcut for the method msgStream(MSG::FATAL)
Definition: CommonMessaging.h:92
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192

## ◆ executeRun()

StatusCode HiveSlimEventLoopMgr::executeRun | ( | int | maxevt | ) |
| override

implementation of IEventProcessor::executeRun()

Definition at line 309 of file HiveSlimEventLoopMgr.cpp.

309 {
310 StatusCode sc;
311 bool eventfailed = false;
312
313 if ( maxevt > 0 ) { // finite number of events to process
314 const unsigned int umaxevt = static_cast<unsigned int>( maxevt );
315 m_blackListBS = std::make_unique<boost::dynamic_bitset<>>( maxevt ); // all initialized to zero
316 for ( unsigned int i = 0; i < m_eventNumberBlacklist.size() && m_eventNumberBlacklist[i] <= umaxevt;
317 ++i ) { // black list is sorted in init
318 m_blackListBS->set( m_eventNumberBlacklist[i], true );
319 }
320 }
321
322 // Call now the nextEvent(...)
323 sc = nextEvent( maxevt );
324 if ( sc.isFailure() ) eventfailed = true;
325
326 m_blackListBS.reset( nullptr );
327
328 return eventfailed ? StatusCode::FAILURE : StatusCode::SUCCESS;
329 }
HiveSlimEventLoopMgr::m_blackListBS
std::unique_ptr< boost::dynamic_bitset<> > m_blackListBS
Definition: HiveSlimEventLoopMgr.h:70
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
HiveSlimEventLoopMgr::m_eventNumberBlacklist
Gaudi::Property< std::vector< unsigned int > > m_eventNumberBlacklist
Definition: HiveSlimEventLoopMgr.h:30
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
std::unique_ptr::reset
T reset(T... args)
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:86
StatusCode::isFailure
bool isFailure() const
Definition: StatusCode.h:130
maxevt
int maxevt
Definition: Bootstrap.cpp:260
HiveSlimEventLoopMgr::nextEvent
StatusCode nextEvent(int maxevt) override
implementation of IService::nextEvent
Definition: HiveSlimEventLoopMgr.cpp:351

## ◆ finalize()

StatusCode HiveSlimEventLoopMgr::finalize | ( |  | ) |
| override

implementation of IService::finalize

Definition at line 199 of file HiveSlimEventLoopMgr.cpp.

199 {
200
201 StatusCode scRet;
202 StatusCode sc = Service::finalize();
203
204 if ( sc.isFailure() ) {
205 scRet = StatusCode::FAILURE;
206 error() << "Problems finalizing Service base class" << endmsg;
207 }
208
209 // Save Histograms Now
210 if ( m_histoPersSvc ) {
211 HistogramAgent agent;
212 sc = m_histoDataMgrSvc->traverseTree( &agent );
213 if ( sc.isSuccess() ) {
214 const IDataSelector& objects = agent.selectedObjects();
215 // skip /stat entry!
216 sc = std::accumulate( begin( objects ), end( objects ), sc, [&]( StatusCode s, const auto& i ) {
217 IOpaqueAddress* pAddr = nullptr;
218 StatusCode iret = m_histoPersSvc->createRep( i, pAddr );
219 if ( iret.isSuccess() ) i->registry()->setAddress( pAddr );
220 return s.isFailure() ? s : iret;
221 } );
222 sc = std::accumulate( begin( objects ), end( objects ), sc, [&]( StatusCode s, const auto& i ) {
223 IRegistry* reg = i->registry();
224 StatusCode iret = m_histoPersSvc->fillRepRefs( reg->address(), i );
225 return s.isFailure() ? s : iret;
226 } );
227 if ( sc.isSuccess() ) {
228 info() << "Histograms converted successfully according to request." << endmsg;
229 } else {
230 error() << "Error while saving Histograms." << endmsg;
231 }
232 } else {
233 error() << "Error while traversing Histogram data store" << endmsg;
234 }
235 }
236
237 scRet = sc;
238
239 // Release event selector context
240 if ( m_evtSelector && m_evtContext ) {
241 m_evtSelector->releaseContext( m_evtContext ).ignore();
242 m_evtContext = nullptr;
243 }
244
245 m_incidentSvc.reset();
246
247 // Release all interfaces...
248 m_histoDataMgrSvc.reset();
249 m_histoPersSvc.reset();
250
251 m_evtSelector.reset();
252 m_whiteboard.reset();
253 m_evtDataMgrSvc.reset();
254
255 return scRet;
256 }
IDataManagerSvc::traverseTree
virtual StatusCode traverseTree(IDataStoreAgent *pAgent)=0
Analyse by traversing all data objects in the data store.
HiveSlimEventLoopMgr::m_incidentSvc
SmartIF< IIncidentSvc > m_incidentSvc
Reference to the incident service.
Definition: HiveSlimEventLoopMgr.h:67
HiveSlimEventLoopMgr::m_evtDataMgrSvc
SmartIF< IDataManagerSvc > m_evtDataMgrSvc
Reference to the Event Data Service's IDataManagerSvc interface.
Definition: HiveSlimEventLoopMgr.h:34
Service::finalize
StatusCode finalize() override
Definition: Service.cpp:164
HistogramAgent
HistogramAgent base in charge of collecting all the references to DataObjects in a transient store th...
Definition: HistogramAgent.h:18
HiveSlimEventLoopMgr::m_whiteboard
SmartIF< IHiveWhiteBoard > m_whiteboard
Reference to the Whiteboard.
Definition: HiveSlimEventLoopMgr.h:44
IConverter::createRep
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)=0
Convert the transient object to the requested representation.
CommonMessagingBase::info
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
Definition: CommonMessaging.h:104
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:98
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
IEvtSelector::releaseContext
virtual StatusCode releaseContext(Context *&) const =0
Release the Context object.
IRegistry
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
IOTest.end
def end
Definition: IOTest.py:112
StatusCode::isSuccess
bool isSuccess() const
Definition: StatusCode.h:267
IRegistry::address
virtual IOpaqueAddress * address() const =0
Retrieve opaque storage address.
StatusCode::ignore
const StatusCode & ignore() const
Ignore/check StatusCode.
Definition: StatusCode.h:153
std::vector< DataObject * >
HiveSlimEventLoopMgr::m_histoPersSvc
SmartIF< IConversionSvc > m_histoPersSvc
Reference to the Histogram Persistency Service.
Definition: HiveSlimEventLoopMgr.h:42
HiveSlimEventLoopMgr::m_histoDataMgrSvc
SmartIF< IDataManagerSvc > m_histoDataMgrSvc
Reference to the Histogram Data Service.
Definition: HiveSlimEventLoopMgr.h:40
HiveSlimEventLoopMgr::m_evtSelector
SmartIF< IEvtSelector > m_evtSelector
Reference to the Event Selector.
Definition: HiveSlimEventLoopMgr.h:36
gaudirun.s
string s
Definition: gaudirun.py:316
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:86
SmartIF::reset
void reset(TYPE *ptr=nullptr)
Set the internal pointer to the passed one disposing of the old one.
Definition: SmartIF.h:86
StatusCode::isFailure
bool isFailure() const
Definition: StatusCode.h:130
Gaudi::Utils::begin
AttribStringParser::Iterator begin(const AttribStringParser &parser)
Definition: AttribStringParser.h:120
std::accumulate
T accumulate(T... args)
IOpaqueAddress
Opaque address interface definition.
Definition: IOpaqueAddress.h:23
IConverter::fillRepRefs
virtual StatusCode fillRepRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Resolve the references of the converted object.
HistogramAgent::selectedObjects
const IDataSelector & selectedObjects() const
Return the set of selected DataObjects.
Definition: HistogramAgent.h:23
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192
HiveSlimEventLoopMgr::m_evtContext
IEvtSelector::Context * m_evtContext
Event Iterator.
Definition: HiveSlimEventLoopMgr.h:38

## ◆ getEventRoot()

StatusCode HiveSlimEventLoopMgr::getEventRoot | ( | IOpaqueAddress *& | refpAddr | ) |

Create event address using event selector.

Definition at line 437 of file HiveSlimEventLoopMgr.cpp.

437 {
438 refpAddr = nullptr;
439 StatusCode sc = m_evtSelector->next( *m_evtContext );
440 if ( sc.isFailure() ) return sc;
441 // Create root address and assign address to data service
442 sc = m_evtSelector->createAddress( *m_evtContext, refpAddr );
443 if ( sc.isSuccess() ) return sc;
444 sc = m_evtSelector->next( *m_evtContext );
445 if ( sc.isFailure() ) return sc;
446 sc = m_evtSelector->createAddress( *m_evtContext, refpAddr );
447 if ( !sc.isSuccess() ) warning() << "Error creating IOpaqueAddress." << endmsg;
448 return sc;
449 }
CommonMessagingBase::warning
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
Definition: CommonMessaging.h:101
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
IEvtSelector::next
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.
StatusCode::isSuccess
bool isSuccess() const
Definition: StatusCode.h:267
HiveSlimEventLoopMgr::m_evtSelector
SmartIF< IEvtSelector > m_evtSelector
Reference to the Event Selector.
Definition: HiveSlimEventLoopMgr.h:36
StatusCode::isFailure
bool isFailure() const
Definition: StatusCode.h:130
IEvtSelector::createAddress
virtual StatusCode createAddress(const Context &c, IOpaqueAddress *&iop) const =0
Create an IOpaqueAddress object from the event fetched.
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192
HiveSlimEventLoopMgr::m_evtContext
IEvtSelector::Context * m_evtContext
Event Iterator.
Definition: HiveSlimEventLoopMgr.h:38

## ◆ initialize()

StatusCode HiveSlimEventLoopMgr::initialize | ( |  | ) |
| override

implementation of IService::initialize

Definition at line 32 of file HiveSlimEventLoopMgr.cpp.

32 {
33 StatusCode sc = Service::initialize();
34 if ( !sc.isSuccess() ) {
35 error() << "Failed to initialize Service Base class." << endmsg;
36 return StatusCode::FAILURE;
37 }
38
39 // Get the references to the services that are needed by the ApplicationMgr itself
40 m_incidentSvc = serviceLocator()->service( "IncidentSvc" );
41 if ( !m_incidentSvc ) {
42 fatal() << "Error retrieving IncidentSvc." << endmsg;
43 return StatusCode::FAILURE;
44 }
45
46 // Setup access to event data services
47 m_evtDataMgrSvc = serviceLocator()->service( "EventDataSvc" );
48 if ( !m_evtDataMgrSvc ) {
49 fatal() << "Error retrieving EventDataSvc interface IDataManagerSvc." << endmsg;
50 return StatusCode::FAILURE;
51 }
52 m_whiteboard = serviceLocator()->service( "EventDataSvc" );
53 if ( !m_whiteboard ) {
54 fatal() << "Error retrieving EventDataSvc interface IHiveWhiteBoard." << endmsg;
55 return StatusCode::FAILURE;
56 }
57 m_schedulerSvc = serviceLocator()->service( m_schedulerName );
58 if ( !m_schedulerSvc ) {
59 fatal() << "Error retrieving SchedulerSvc interface IScheduler." << endmsg;
60 return StatusCode::FAILURE;
61 }
62 // Obtain the IProperty of the ApplicationMgr
63 m_appMgrProperty = serviceLocator();
64 if ( !m_appMgrProperty ) {
65 fatal() << "IProperty interface not found in ApplicationMgr." << endmsg;
66 return StatusCode::FAILURE;
67 }
68
69 // We do not expect a Event Selector necessarily being declared
70 setProperty( m_appMgrProperty->getProperty( "EvtSel" ) ).ignore();
71
72 if ( m_evtsel != "NONE" || m_evtsel.length() == 0 ) {
73 m_evtSelector = serviceLocator()->service( "EventSelector" );
74 if ( m_evtSelector ) {
75 // Setup Event Selector
76 sc = m_evtSelector->createContext( m_evtContext );
77 if ( !sc.isSuccess() ) {
78 fatal() << "Can not create the event selector Context." << endmsg;
79 return sc;
80 }
81 } else {
82 fatal() << "EventSelector not found." << endmsg;
83 return sc;
84 }
85 } else {
86 m_evtSelector = 0;
87 m_evtContext = 0;
88 if ( m_warnings ) {
89 warning() << "Unable to locate service \"EventSelector\" " << endmsg;
90 warning() << "No events will be processed from external input." << endmsg;
91 }
92 }
93
94 // Setup access to histogramming services
95 m_histoDataMgrSvc = serviceLocator()->service( "HistogramDataSvc" );
96 if ( !m_histoDataMgrSvc ) {
97 fatal() << "Error retrieving HistogramDataSvc." << endmsg;
98 return sc;
99 }
100 // Setup histogram persistency
101 m_histoPersSvc = serviceLocator()->service( "HistogramPersistencySvc" );
102 if ( !m_histoPersSvc ) {
103 warning() << "Histograms cannot not be saved - though required." << endmsg;
104 return sc;
105 }
106
107 // Setup algorithm resource pool
108 m_algResourcePool = serviceLocator()->service( "AlgResourcePool" );
109 if ( !m_algResourcePool ) {
110 fatal() << "Error retrieving AlgResourcePool" << endmsg;
111 return StatusCode::FAILURE;
112 }
113
114 m_algExecStateSvc = serviceLocator()->service( "AlgExecStateSvc" );
115 if ( !m_algExecStateSvc ) {
116 fatal() << "Error retrieving AlgExecStateSvc" << endmsg;
117 return StatusCode::FAILURE;
118 }
119
120 std::sort( m_eventNumberBlacklist.begin(), m_eventNumberBlacklist.end() );
121 info() << "Found " << m_eventNumberBlacklist.size() << " events in black list" << endmsg;
122
123 return StatusCode::SUCCESS;
124 }
Service::initialize
StatusCode initialize() override
Definition: Service.cpp:60
HiveSlimEventLoopMgr::m_evtsel
Gaudi::Property< std::string > m_evtsel
Definition: HiveSlimEventLoopMgr.h:26
HiveSlimEventLoopMgr::m_incidentSvc
SmartIF< IIncidentSvc > m_incidentSvc
Reference to the incident service.
Definition: HiveSlimEventLoopMgr.h:67
Service::serviceLocator
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: Service.cpp:277
HiveSlimEventLoopMgr::m_evtDataMgrSvc
SmartIF< IDataManagerSvc > m_evtDataMgrSvc
Reference to the Event Data Service's IDataManagerSvc interface.
Definition: HiveSlimEventLoopMgr.h:34
PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >::setProperty
StatusCode setProperty(const Gaudi::Details::PropertyBase &p) override
set the property form another property
Definition: PropertyHolder.h:145
CommonMessagingBase::warning
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
Definition: CommonMessaging.h:101
HiveSlimEventLoopMgr::m_whiteboard
SmartIF< IHiveWhiteBoard > m_whiteboard
Reference to the Whiteboard.
Definition: HiveSlimEventLoopMgr.h:44
HiveSlimEventLoopMgr::m_schedulerSvc
SmartIF< IScheduler > m_schedulerSvc
A shortcut for the scheduler.
Definition: HiveSlimEventLoopMgr.h:55
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
HiveSlimEventLoopMgr::m_eventNumberBlacklist
Gaudi::Property< std::vector< unsigned int > > m_eventNumberBlacklist
Definition: HiveSlimEventLoopMgr.h:30
CommonMessagingBase::info
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
Definition: CommonMessaging.h:104
HiveSlimEventLoopMgr::m_appMgrProperty
SmartIF< IProperty > m_appMgrProperty
Property interface of ApplicationMgr.
Definition: HiveSlimEventLoopMgr.h:50
HiveSlimEventLoopMgr::m_warnings
Gaudi::Property< bool > m_warnings
Definition: HiveSlimEventLoopMgr.h:27
ISvcLocator::service
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:76
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:98
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
IEvtSelector::createContext
virtual StatusCode createContext(Context *&c) const =0
Create and return a context object that will keep track of the state of selection.
IProperty::getProperty
virtual StatusCode getProperty(Gaudi::Details::PropertyBase *p) const =0
Get the property by property.
StatusCode::isSuccess
bool isSuccess() const
Definition: StatusCode.h:267
HiveSlimEventLoopMgr::m_algExecStateSvc
SmartIF< IAlgExecStateSvc > m_algExecStateSvc
Reference to the AlgExecStateSvc.
Definition: HiveSlimEventLoopMgr.h:48
HiveSlimEventLoopMgr::m_histoPersSvc
SmartIF< IConversionSvc > m_histoPersSvc
Reference to the Histogram Persistency Service.
Definition: HiveSlimEventLoopMgr.h:42
HiveSlimEventLoopMgr::m_schedulerName
Gaudi::Property< std::string > m_schedulerName
Definition: HiveSlimEventLoopMgr.h:28
HiveSlimEventLoopMgr::m_histoDataMgrSvc
SmartIF< IDataManagerSvc > m_histoDataMgrSvc
Reference to the Histogram Data Service.
Definition: HiveSlimEventLoopMgr.h:40
HiveSlimEventLoopMgr::m_evtSelector
SmartIF< IEvtSelector > m_evtSelector
Reference to the Event Selector.
Definition: HiveSlimEventLoopMgr.h:36
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:86
std::sort
T sort(T... args)
HiveSlimEventLoopMgr::m_algResourcePool
SmartIF< IAlgResourcePool > m_algResourcePool
Reference to the Algorithm resource pool.
Definition: HiveSlimEventLoopMgr.h:46
CommonMessagingBase::fatal
MsgStream & fatal() const
shortcut for the method msgStream(MSG::FATAL)
Definition: CommonMessaging.h:92
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192
HiveSlimEventLoopMgr::m_evtContext
IEvtSelector::Context * m_evtContext
Event Iterator.
Definition: HiveSlimEventLoopMgr.h:38

## ◆ nextEvent()

StatusCode HiveSlimEventLoopMgr::nextEvent | ( | int | maxevt | ) |
| override

implementation of IService::nextEvent

Definition at line 351 of file HiveSlimEventLoopMgr.cpp.

351 {
352
353 // Calculate runtime
354 using Clock = std::chrono::high_resolution_clock;
355
356 // Reset the application return code.
357 Gaudi::setAppReturnCode( m_appMgrProperty, Gaudi::ReturnCode::Success, true ).ignore();
358
359 int finishedEvts = 0;
360 int createdEvts = 0;
361 int skippedEvts = 0;
362 info() << "Starting loop on events" << endmsg;
363 // Loop until the finished events did not reach the maxevt number
364 bool loop_ended = false;
365 // Run the first event before spilling more than one
366 bool newEvtAllowed = false;
367
368 constexpr double oneOver1024 = 1. / 1024.;
369
370 uint iteration = 0;
371 auto start_time = Clock::now();
372 while ( !loop_ended && ( maxevt < 0 || ( finishedEvts + skippedEvts ) < maxevt ) ) {
373 DEBUG_MSG << "work loop iteration " << iteration++ << endmsg;
374 // if the created events did not reach maxevt, create an event
375 if ( ( newEvtAllowed || createdEvts == 0 ) && // Launch the first event alone
376 createdEvts >= 0 && // The events are not finished with an unlimited number of events
377 ( createdEvts < maxevt || maxevt < 0 ) && // The events are not finished with a limited number of events
378 m_schedulerSvc->freeSlots() > 0 && // There are still free slots in the scheduler
379 m_whiteboard->freeSlots() > 0 ) { // There are still free slots in the whiteboard
380
381 if ( 1 == createdEvts ) // reset counter to count from event 1
382 start_time = Clock::now();
383
384 DEBUG_MSG << "createdEvts: " << createdEvts << ", freeslots: " << m_schedulerSvc->freeSlots() << endmsg;
385 // DP remove to remove the syscalls...
386 // if (0!=createdEvts){
387 // info() << "Event Number = " << createdEvts
388 // << " WSS (MB) = " << System::mappedMemory(System::MemoryUnit::kByte)*oneOver1024
389 // << " Time (s) = " << secsFromStart(start_time) << endmsg;
390 // }
391
392 // TODO can we adapt the interface of executeEvent for a nicer solution?
393 StatusCode sc = StatusCode::RECOVERABLE;
394 while ( !sc.isSuccess() // we haven't created an event yet
395 && ( createdEvts < maxevt || maxevt < 0 ) ) { // redunant check for maxEvts, can we do better?
396 {
397 auto ctx = createEventContext();
398 if ( !ctx.valid() ) {
399 createdEvts = -1;
400 break; // invalid context means end of loop
401 }
402 sc = executeEvent( std::move( ctx ) );
403 }
404 if ( sc.isRecoverable() ) { // we skipped an event
405 ++skippedEvts;
406 } else if ( sc.isFailure() ) { // exit immediatly
407 return sc;
408 } // else we have an success --> exit loop
409 ++createdEvts;
410 }
411
412 } // end if condition createdEvts < maxevt
413 else {
414 // all the events were created but not all finished or the slots were
415 // all busy: the scheduler should finish its job
416
417 DEBUG_MSG << "Draining the scheduler" << endmsg;
418
419 // Pull out of the scheduler the finished events
420 if ( drainScheduler( finishedEvts ).isFailure() ) loop_ended = true;
421 newEvtAllowed = true;
422 }
423 } // end main loop on finished events
424 auto end_time = Clock::now();
425
426 info() << "---> Loop Finished (skipping 1st evt) - "
427 << " WSS " << System::mappedMemory( System::MemoryUnit::kByte ) * oneOver1024 << " total time "
428 << std::chrono::duration_cast<std::chrono::nanoseconds>( end_time - start_time ).count() << endmsg;
429 info() << skippedEvts << " events were SKIPed" << endmsg;
430
431 return StatusCode::SUCCESS;
432 }
DEBUG_MSG
#define DEBUG_MSG
Definition: HiveSlimEventLoopMgr.cpp:19
HiveSlimEventLoopMgr::createEventContext
EventContext createEventContext() override
implementation of IEventProcessor::createEventContext()
Definition: HiveSlimEventLoopMgr.cpp:475
HiveSlimEventLoopMgr::drainScheduler
StatusCode drainScheduler(int &finishedEvents)
Drain the scheduler from all actions that may be queued.
Definition: HiveSlimEventLoopMgr.cpp:493
HiveSlimEventLoopMgr::m_whiteboard
SmartIF< IHiveWhiteBoard > m_whiteboard
Reference to the Whiteboard.
Definition: HiveSlimEventLoopMgr.h:44
HiveSlimEventLoopMgr::m_schedulerSvc
SmartIF< IScheduler > m_schedulerSvc
A shortcut for the scheduler.
Definition: HiveSlimEventLoopMgr.h:55
StatusCode::RECOVERABLE
constexpr static const auto RECOVERABLE
Definition: StatusCode.h:87
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
IHiveWhiteBoard::freeSlots
virtual size_t freeSlots()=0
Get free slots number.
CommonMessagingBase::info
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
Definition: CommonMessaging.h:104
HiveSlimEventLoopMgr::m_appMgrProperty
SmartIF< IProperty > m_appMgrProperty
Property interface of ApplicationMgr.
Definition: HiveSlimEventLoopMgr.h:50
System::kByte
Definition: Memory.h:55
std::chrono::high_resolution_clock
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
StatusCode::isSuccess
bool isSuccess() const
Definition: StatusCode.h:267
Gaudi::setAppReturnCode
StatusCode setAppReturnCode(SmartIF< IProperty > &appmgr, int value, bool force=false)
Set the application return code.
Definition: AppReturnCode.h:49
std::move
T move(T... args)
System::mappedMemory
GAUDI_API long mappedMemory(MemoryUnit unit=kByte, InfoType fetch=Memory, long pid=-1)
Basic Process Information: priority boost.
Definition: Memory.cpp:187
StatusCode::ignore
const StatusCode & ignore() const
Ignore/check StatusCode.
Definition: StatusCode.h:153
StatusCode::isRecoverable
bool isRecoverable() const
Definition: StatusCode.h:272
HiveSlimEventLoopMgr::executeEvent
StatusCode executeEvent(EventContext &&ctx) override
implementation of IEventProcessor::executeEvent(EventContext&&)
Definition: HiveSlimEventLoopMgr.cpp:261
StatusCode::isFailure
bool isFailure() const
Definition: StatusCode.h:130
maxevt
int maxevt
Definition: Bootstrap.cpp:260
Gaudi::ReturnCode::Success
constexpr int Success
Definition: AppReturnCode.h:16
IScheduler::freeSlots
virtual unsigned int freeSlots()=0
Get the free event processing slots.
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192

## ◆ reinitialize()

StatusCode HiveSlimEventLoopMgr::reinitialize | ( |  | ) |
| override

implementation of IService::reinitialize

Definition at line 128 of file HiveSlimEventLoopMgr.cpp.

128 {
129
130 // Check to see whether a new Event Selector has been specified
131 setProperty( m_appMgrProperty->getProperty( "EvtSel" ) );
132 if ( m_evtsel != "NONE" || m_evtsel.empty() ) {
133 auto theSvc = serviceLocator()->service( "EventSelector" );
134 auto theEvtSel = theSvc.as<IEvtSelector>();
135 StatusCode sc;
136 if ( theEvtSel && ( theEvtSel.get() != m_evtSelector.get() ) ) {
137 // Setup Event Selector
138 if ( m_evtSelector.get() && m_evtContext ) {
139 // Need to release context before switching to new event selector
140 m_evtSelector->releaseContext( m_evtContext );
141 m_evtContext = nullptr;
142 }
143 m_evtSelector = theEvtSel;
144 if ( theSvc->FSMState() == Gaudi::StateMachine::INITIALIZED ) {
145 sc = theSvc->reinitialize();
146 if ( !sc.isSuccess() ) {
147 error() << "Failure Reinitializing EventSelector " << theSvc->name() << endmsg;
148 return sc;
149 }
150 } else {
151 sc = theSvc->sysInitialize();
152 if ( !sc.isSuccess() ) {
153 error() << "Failure Initializing EventSelector " << theSvc->name() << endmsg;
154 return sc;
155 }
156 }
157 sc = m_evtSelector->createContext( m_evtContext );
158 if ( !sc.isSuccess() ) {
159 error() << "Can not create Context " << theSvc->name() << endmsg;
160 return sc;
161 }
162
163 } else if ( m_evtSelector ) {
164 if ( m_evtContext ) {
165 m_evtSelector->releaseContext( m_evtContext );
166 m_evtContext = nullptr;
167 }
168 sc = m_evtSelector->createContext( m_evtContext );
169 if ( !sc.isSuccess() ) {
170 error() << "Can not create Context " << theSvc->name() << endmsg;
171 return sc;
172 }
173 }
174 } else if ( m_evtSelector && m_evtContext ) {
175 m_evtSelector->releaseContext( m_evtContext );
176 m_evtSelector = nullptr;
177 m_evtContext = nullptr;
178 }
179 return StatusCode::SUCCESS;
180 }
Gaudi::StateMachine::INITIALIZED
Definition: StateMachine.h:15
HiveSlimEventLoopMgr::m_evtsel
Gaudi::Property< std::string > m_evtsel
Definition: HiveSlimEventLoopMgr.h:26
Service::serviceLocator
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: Service.cpp:277
PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >::setProperty
StatusCode setProperty(const Gaudi::Details::PropertyBase &p) override
set the property form another property
Definition: PropertyHolder.h:145
IEvtSelector
The Event Selector Interface.
Definition: IEvtSelector.h:18
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
SmartIF::get
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:76
HiveSlimEventLoopMgr::m_appMgrProperty
SmartIF< IProperty > m_appMgrProperty
Property interface of ApplicationMgr.
Definition: HiveSlimEventLoopMgr.h:50
ISvcLocator::service
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:76
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:98
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
IEvtSelector::createContext
virtual StatusCode createContext(Context *&c) const =0
Create and return a context object that will keep track of the state of selection.
IProperty::getProperty
virtual StatusCode getProperty(Gaudi::Details::PropertyBase *p) const =0
Get the property by property.
IEvtSelector::releaseContext
virtual StatusCode releaseContext(Context *&) const =0
Release the Context object.
HiveSlimEventLoopMgr::m_evtSelector
SmartIF< IEvtSelector > m_evtSelector
Reference to the Event Selector.
Definition: HiveSlimEventLoopMgr.h:36
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192
HiveSlimEventLoopMgr::m_evtContext
IEvtSelector::Context * m_evtContext
Event Iterator.
Definition: HiveSlimEventLoopMgr.h:38

## ◆ stop()

StatusCode HiveSlimEventLoopMgr::stop | ( |  | ) |
| override

implementation of IService::stop

Definition at line 186 of file HiveSlimEventLoopMgr.cpp.

186 {
187 if ( !m_endEventFired ) {
188 // Fire pending EndEvent incident
189 m_incidentSvc->fireIncident( Incident( name(), IncidentType::EndEvent ) );
190 m_endEventFired = true;
191 }
192 return StatusCode::SUCCESS;
193 }
HiveSlimEventLoopMgr::m_incidentSvc
SmartIF< IIncidentSvc > m_incidentSvc
Reference to the incident service.
Definition: HiveSlimEventLoopMgr.h:67
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
Service::name
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:274
IIncidentSvc::fireIncident
virtual void fireIncident(const Incident &incident)=0
Fire an Incident.
Incident
Base class for all Incidents (computing events).
Definition: Incident.h:17
HiveSlimEventLoopMgr::m_endEventFired
bool m_endEventFired
Flag to avoid to fire the EnvEvent incident twice in a row (and also not before the first event)
Definition: HiveSlimEventLoopMgr.h:53

## ◆ stopRun()

StatusCode HiveSlimEventLoopMgr::stopRun | ( |  | ) |
| override

implementation of IEventProcessor::stopRun()

Definition at line 334 of file HiveSlimEventLoopMgr.cpp.

334 {
335 // Set the application return code
336 auto appmgr = serviceLocator()->as<IProperty>();
337 if ( Gaudi::setAppReturnCode( appmgr, Gaudi::ReturnCode::ScheduledStop ).isFailure() ) {
338 error() << "Could not set return code of the application (" << Gaudi::ReturnCode::ScheduledStop << ")" << endmsg;
339 }
340 m_scheduledStop = true;
341 return StatusCode::SUCCESS;
342 }
Service::serviceLocator
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: Service.cpp:277
HiveSlimEventLoopMgr::m_scheduledStop
bool m_scheduledStop
Scheduled stop of event processing.
Definition: HiveSlimEventLoopMgr.h:65
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
ISvcLocator::as
SmartIF< IFace > as()
Definition: ISvcLocator.h:103
Gaudi::ReturnCode::ScheduledStop
constexpr int ScheduledStop
Definition: AppReturnCode.h:25
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:98
Gaudi::setAppReturnCode
StatusCode setAppReturnCode(SmartIF< IProperty > &appmgr, int value, bool force=false)
Set the application return code.
Definition: AppReturnCode.h:49
StatusCode::isFailure
bool isFailure() const
Definition: StatusCode.h:130
IProperty
The IProperty is the basic interface for all components which have properties that can be set or get.
Definition: IProperty.h:20
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192

## Member Data Documentation

## ◆ m_abortEventListener

SmartIF<IIncidentListener> HiveSlimEventLoopMgr::m_abortEventListener
| protected

Instance of the incident listener waiting for AbortEvent.

Definition at line 63 of file HiveSlimEventLoopMgr.h.

## ◆ m_abortOnFailure

Gaudi::Property<bool> HiveSlimEventLoopMgr::m_abortOnFailure {this, "AbortOnFailure", true, "Abort job on event failure"}
| protected

Definition at line 31 of file HiveSlimEventLoopMgr.h.

## ◆ m_algExecStateSvc

SmartIF<IAlgExecStateSvc> HiveSlimEventLoopMgr::m_algExecStateSvc
| protected

Reference to the AlgExecStateSvc.

Definition at line 48 of file HiveSlimEventLoopMgr.h.

## ◆ m_algResourcePool

SmartIF<IAlgResourcePool> HiveSlimEventLoopMgr::m_algResourcePool
| protected

Reference to the Algorithm resource pool.

Definition at line 46 of file HiveSlimEventLoopMgr.h.

## ◆ m_appMgrProperty

SmartIF<IProperty> HiveSlimEventLoopMgr::m_appMgrProperty
| protected

Property interface of ApplicationMgr.

Definition at line 50 of file HiveSlimEventLoopMgr.h.

## ◆ m_blackListBS

std::unique_ptr<boost::dynamic_bitset<> > HiveSlimEventLoopMgr::m_blackListBS
| protected

Definition at line 70 of file HiveSlimEventLoopMgr.h.

## ◆ m_endEventFired

bool HiveSlimEventLoopMgr::m_endEventFired = false
| protected

Flag to avoid to fire the EnvEvent incident twice in a row (and also not before the first event)

Definition at line 53 of file HiveSlimEventLoopMgr.h.

## ◆ m_eventNumberBlacklist

Gaudi::Property<std::vector<unsigned int> > HiveSlimEventLoopMgr::m_eventNumberBlacklist {this, "EventNumberBlackList", {}, ""}
| protected

Definition at line 30 of file HiveSlimEventLoopMgr.h.

## ◆ m_evtContext

IEvtSelector::Context* HiveSlimEventLoopMgr::m_evtContext = nullptr
| protected

Event Iterator.

Definition at line 38 of file HiveSlimEventLoopMgr.h.

## ◆ m_evtDataMgrSvc

SmartIF<IDataManagerSvc> HiveSlimEventLoopMgr::m_evtDataMgrSvc
| protected

Reference to the Event Data Service's IDataManagerSvc interface.

Definition at line 34 of file HiveSlimEventLoopMgr.h.

## ◆ m_evtsel

Gaudi::Property<std::string> HiveSlimEventLoopMgr::m_evtsel {this, "EvtSel", "", ""}
| protected

Definition at line 26 of file HiveSlimEventLoopMgr.h.

## ◆ m_evtSelector

SmartIF<IEvtSelector> HiveSlimEventLoopMgr::m_evtSelector
| protected

Reference to the Event Selector.

Definition at line 36 of file HiveSlimEventLoopMgr.h.

## ◆ m_histoDataMgrSvc

SmartIF<IDataManagerSvc> HiveSlimEventLoopMgr::m_histoDataMgrSvc
| protected

Reference to the Histogram Data Service.

Definition at line 40 of file HiveSlimEventLoopMgr.h.

## ◆ m_histoPersSvc

SmartIF<IConversionSvc> HiveSlimEventLoopMgr::m_histoPersSvc
| protected

Reference to the Histogram Persistency Service.

Definition at line 42 of file HiveSlimEventLoopMgr.h.

## ◆ m_histPersName

Gaudi::Property<std::string> HiveSlimEventLoopMgr::m_histPersName {this, "HistogramPersistency", "", ""}
| protected

Definition at line 25 of file HiveSlimEventLoopMgr.h.

## ◆ m_incidentSvc

SmartIF<IIncidentSvc> HiveSlimEventLoopMgr::m_incidentSvc
| protected

Reference to the incident service.

Definition at line 67 of file HiveSlimEventLoopMgr.h.

## ◆ m_nevt

EventContext::ContextEvt_t HiveSlimEventLoopMgr::m_nevt {0}
| protected

Definition at line 72 of file HiveSlimEventLoopMgr.h.

## ◆ m_scheduledStop

bool HiveSlimEventLoopMgr::m_scheduledStop = false
| protected

Scheduled stop of event processing.

Definition at line 65 of file HiveSlimEventLoopMgr.h.

## ◆ m_schedulerName

Gaudi::Property<std::string> HiveSlimEventLoopMgr::m_schedulerName
| protected

Initial value:
{this, "SchedulerName", "AvalancheSchedulerSvc",
"Name of the scheduler to be used"}

Definition at line 28 of file HiveSlimEventLoopMgr.h.

## ◆ m_schedulerSvc

SmartIF<IScheduler> HiveSlimEventLoopMgr::m_schedulerSvc
| protected

A shortcut for the scheduler.

Definition at line 55 of file HiveSlimEventLoopMgr.h.

## ◆ m_warnings

Gaudi::Property<bool> HiveSlimEventLoopMgr::m_warnings {this, "Warnings", true, "Set this property to false to suppress warning messages"}
| protected

Definition at line 27 of file HiveSlimEventLoopMgr.h.

## ◆ m_whiteboard

SmartIF<IHiveWhiteBoard> HiveSlimEventLoopMgr::m_whiteboard
| protected

Reference to the Whiteboard.

Definition at line 44 of file HiveSlimEventLoopMgr.h.

The documentation for this class was generated from the following files:

- GaudiHive/GaudiHive/HiveSlimEventLoopMgr.h
- GaudiHive/src/HiveSlimEventLoopMgr.cpp