ATLAS Offline Software
Loading...
Searching...
No Matches
AthRemoteExec::RemoteExecHiveEventLoopMgr Class Reference

#include <RemoteExecHiveEventLoopMgr.h>

Inheritance diagram for AthRemoteExec::RemoteExecHiveEventLoopMgr:
Collaboration diagram for AthRemoteExec::RemoteExecHiveEventLoopMgr:

Classes

struct  InFlight
 A request that has been given a slot and handed to the scheduler. More...
struct  Finished
 A finished event, from the scheduler's point of view. More...

Public Types

typedef IEvtSelector::Context EvtContext
typedef std::list< SmartIF< IAlgorithm > > ListAlg

Public Member Functions

 RemoteExecHiveEventLoopMgr (const std::string &name, ISvcLocator *svcLoc)
virtual ~RemoteExecHiveEventLoopMgr () override
virtual StatusCode initialize () override
 implementation of IAppMgrUI::initalize
virtual StatusCode finalize () override
 implementation of IAppMgrUI::finalize
virtual StatusCode nextEvent (int maxevt) override
 Serve requests.
virtual StatusCode stopRun () override
 Ask the loop to stop accepting work and drain what is in flight.
StatusCode getEventRoot (IOpaqueAddress *&refpAddr)
 Create event address using event selector.
virtual StatusCode executeEvent (EventContext &&ctx) override
 implementation of IEventProcessor::executeEvent(void* par)
virtual StatusCode executeRun (int maxevt) override
 implementation of IEventProcessor::executeRun(int maxevt)
virtual StatusCode stop () override
 implementation of IService::stop
virtual StatusCode seek (int evt) override
 Seek to a given event.
virtual int curEvent () const override
 Return the current event count.
virtual int size () override
 Return the size of the collection.
virtual void handle (const Incident &inc) override
 IIncidentListenet interfaces.
virtual const std::string & name () const override
virtual void modifyEventContext (EventContext &ctx, const EventID &eID, bool consume_modifier_stream)
MsgStream & msg () const
 The standard message stream.
MsgStream & msg (const MSG::Level lvl) const
 The standard message stream.
bool msgLvl (const MSG::Level lvl) const
 Test the output level.
void setLevel (MSG::Level lvl)
 Change the current logging level.

Protected Types

enum class  Take { Job , None , Stopped }
 Where the next request came from. More...
typedef ServiceHandle< IIncidentSvc > IIncidentSvc_t
typedef ServiceHandle< StoreGateSvc > StoreGateSvc_t
typedef ServiceHandle< IDataManagerSvc > IDataManagerSvc_t
typedef ServiceHandle< IConversionSvc > IConversionSvc_t
typedef ServiceHandle< IEvtIdModifierSvc > IEvtIdModifierSvc_t
typedef EventID::number_type number_type
typedef IAthenaEvtLoopPreSelectTool tool_type
typedef ToolHandleArray< tool_type > tool_store
typedef tool_store::const_iterator tool_iterator
typedef std::vector< unsigned int > tool_stats
typedef tool_stats::const_iterator tool_stats_iterator

Protected Member Functions

StatusCode eventFinished (const EventContext &ctx) override
 Process an event's result and decide whether the driving loop may continue.
bool clearStoreOnEndAlgorithms () const override
 Batch jobs clear in the algorithm context; external drivers can retain the store until eventFinished() has consumed their result.
virtual Take takeRequest (ExecuteRequest &request, std::unique_ptr< Server::Job > &job)
 Take the next request from the incoming event queue.
virtual StatusCode startServing ()
 Create and start the server.
void setupPreSelectTools (Gaudi::Details::PropertyBase &)
 property update handler:sets up the Pre-selection tools
virtual StatusCode writeHistograms (bool force=false)
 Dump out histograms as needed.
virtual StatusCode executeAlgorithms ()
 Run the algorithms for the current event.
StatusCode initializeAlgorithms ()
 Initialize all algorithms and output streams.
StatusCode clearWBSlot (int evtSlot)
 Clear a slot in the WB.
int declareEventRootAddress (EventContext &)
 Declare the root address of the event.
virtual EventContext createEventContext () override
 Create event context.
void setTimeout (Timeout &instance)
 Set timeout.
void resetTimeout (Timeout &instance)
 Reset timeout.
Event lifecycle for derived loop managers

Called on the driving thread, in the order declared below; executeEvent() is the reference composition:

  1. allocateEventContext() reserves and selects a whiteboard slot.
  2. The driver fills the slot and records the context in it (executeEvent() reads the next input event).
  3. submitEvent() hands the event to the scheduler.
  4. drainScheduler() collects finished events; finishEvent() calls the eventFinished() hook and releases the slot.
EventContext allocateEventContext (size_t eventNumber)
StatusCode submitEvent (EventContext &ctx)
 Submit a recorded context; the scheduler receives its own copy.
StatusCode finishEvent (const EventContext &ctx)
 Finish one scheduler-returned event on the driving thread.
int drainScheduler (int &finishedEvents)
 Drain the scheduler from all actions that may be queued.

Protected Attributes

IIncidentSvc_t m_incidentSvc
 Reference to the incident service.
StoreGateSvc_t m_eventStore
 Reference to StoreGateSvc;.
IEvtSelector * m_evtSelector
 Reference to the Event Selector.
EvtContext * m_evtContext
 Gaudi event selector Context (may be used as a cursor by the evt selector).
StringProperty m_evtsel
IDataManagerSvc_t m_histoDataMgrSvc
 Reference to the Histogram Data Service.
IConversionSvc_t m_histoPersSvc
IEvtIdModifierSvc_t m_evtIdModSvc
StringProperty m_histPersName
number_type m_currentRun
 current run number
bool m_firstRun
IntegerProperty m_failureMode
UnsignedIntegerProperty m_eventPrintoutInterval
tool_stats m_toolInvoke
 tool called counter
tool_stats m_toolReject
 tool returns StatusCode::FAILURE counter
tool_stats m_toolAccept
 tool returns StatusCode::SUCCESS counter
tool_store m_tools
 internal tool store
bool m_requireInputAttributeList {}
 require input attribute list
bool m_useSecondaryEventNumber {}
 read event number from secondary input
SmartIF< IHiveWhiteBoard > m_whiteboard
 Reference to the Whiteboard interface.
SmartIF< IAlgResourcePool > m_algResourcePool
 Reference to the Algorithm resource pool.
SmartIF< IAlgExecStateSvc > m_aess
 Reference to the Algorithm Execution State Svc.
SmartIF< IProperty > m_appMgrProperty
 Property interface of ApplicationMgr.
SmartIF< IScheduler > m_schedulerSvc
 A shortcut for the scheduler.
SmartIF< IIncidentListener > m_abortEventListener
 Instance of the incident listener waiting for AbortEvent.
std::string m_schedulerName
 Name of the scheduler to be used.
std::string m_whiteboardName
 Name of the Whiteboard to be used.
bool m_scheduledStop
 Scheduled stop of event processing.
bool m_terminateLoop { false }
unsigned int m_nev
 events processed
unsigned int m_proc
bool m_useTools
bool m_doEvtHeartbeat
EventContext m_lastEventContext

Private Types

using Clock = std::chrono::steady_clock

Private Member Functions

void inputLoop ()
 Loop and wait for incoming job.
void outputLoop ()
 Loop and wait for finished job.
void startHelpers ()
 Starts input/output loops.
void stopHelpers ()
 Stops input/output loops.
std::vector< Finished > takeFinished ()
 Take whatever the output thread has collected from finished event queue.
void drainPending ()
 Answer to anything that the loop did not manage to finish.
AthRemoteExec::Status validate (const ExecuteRequest &request, std::string &diagnostics) const
 Reject requests that cannot possibly run, before a slot is spent on them.
StatusCode dispatch (ExecuteRequest request, std::unique_ptr< Server::Job > job)
 Give a request a slot and push it to the scheduler.
StatusCode complete (const Finished &finished)
 Read the result of one finished event and release its slot.
ExecuteReply buildReply (const EventContext &ctx, const InFlight &entry)
 Turn a finished event into the reply for its request.
void expireDeadlines ()
 Reply to all request that passed their deadline.
void respond (InFlight &entry, ExecuteReply reply)
 Reply to the request.
void respondDirect (const ExecuteRequest &request, const std::unique_ptr< Server::Job > &job, AthRemoteExec::Status status, const std::string &diagnostics)
 Reply to the request that never got assigned to slot.
std::string failedAlgorithms (const EventContext &ctx)
 Names of the algorithms that failed in ctx. For the reply diagnostics.
std::string replyKeyFor (const std::string &sequence) const
 The reply key of sequence, or an empty string if it declares none.
void serverMessage (Server::Level level, const std::string &text)
 Thread-safe log sink handed to the RPC server.
void initMessaging () const
 Initialize our message level and MessageSvc.

Private Attributes

Gaudi::Property< std::vector< std::string > > m_sequences
Gaudi::Property< std::map< std::string, std::vector< std::string > > > m_inputKeys
Gaudi::Property< std::map< std::string, std::vector< std::string > > > m_outputKeys
Gaudi::Property< std::map< std::string, std::string > > m_replyKeys
Gaudi::Property< std::string > m_requestKey
Gaudi::Property< std::string > m_address
Gaudi::Property< int > m_port
Gaudi::Property< std::string > m_portFile
Gaudi::Property< int > m_maxMessageBytes
Gaudi::Property< size_t > m_queueLimit
Gaudi::Property< double > m_requestTimeout
Gaudi::Property< unsigned int > m_pollInterval
Gaudi::Property< bool > m_reportTiming
std::unique_ptr< Server > m_server
std::map< size_t, InFlight > m_inFlight
 keyed by whiteboard slot
size_t m_nextEvent = 0
size_t m_completed = 0
std::thread m_inputThread
std::thread m_outputThread
std::mutex m_pendingMutex
std::condition_variable m_pending
 loop waits here
std::condition_variable m_inFlightCv
 output thread waits here
std::condition_variable m_incomingRoom
 input thread waits here
std::deque< std::unique_ptr< Server::Job > > m_incoming
size_t m_incomingLimit = 1
std::deque< Finished > m_finishedEvents
size_t m_awaitingCompletion = 0
bool m_inputDone = false
bool m_helpersStopping = false
std::mutex m_messageMutex
std::atomic< bool > m_stopRequested {false}
unsigned int m_nevt
unsigned int m_timeStamp { 0 }
UnsignedIntegerProperty m_writeInterval
bool m_writeHists
bool m_firstEventAlone
unsigned int m_flmbi
unsigned int m_timeStampInt
ServiceHandle< Athena::IConditionsCleanerSvc > m_conditionsCleaner
std::string m_nm
 Message source name.
boost::thread_specific_ptr< MsgStream > m_msg_tls
 MsgStream instance (a std::cout like with print-out levels).
std::atomic< IMessageSvc * > m_imsg { nullptr }
 MessageSvc pointer.
std::atomic< MSG::Level > m_lvl { MSG::NIL }
 Current logging level.
std::atomic_flag m_initialized ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
 Messaging initialized (initMessaging).

Detailed Description

Definition at line 60 of file RemoteExecHiveEventLoopMgr.h.

Member Typedef Documentation

◆ Clock

using AthRemoteExec::RemoteExecHiveEventLoopMgr::Clock = std::chrono::steady_clock
private

Definition at line 94 of file RemoteExecHiveEventLoopMgr.h.

◆ EvtContext

typedef IEvtSelector::Context AthenaHiveEventLoopMgr::EvtContext
inherited

Definition at line 74 of file AthenaHiveEventLoopMgr.h.

◆ IConversionSvc_t

typedef ServiceHandle<IConversionSvc> AthenaHiveEventLoopMgr::IConversionSvc_t
protectedinherited

Definition at line 96 of file AthenaHiveEventLoopMgr.h.

◆ IDataManagerSvc_t

typedef ServiceHandle<IDataManagerSvc> AthenaHiveEventLoopMgr::IDataManagerSvc_t
protectedinherited

Definition at line 92 of file AthenaHiveEventLoopMgr.h.

◆ IEvtIdModifierSvc_t

◆ IIncidentSvc_t

typedef ServiceHandle<IIncidentSvc> AthenaHiveEventLoopMgr::IIncidentSvc_t
protectedinherited

Definition at line 77 of file AthenaHiveEventLoopMgr.h.

◆ ListAlg

typedef std::list<SmartIF<IAlgorithm> > AthenaHiveEventLoopMgr::ListAlg
inherited

Definition at line 291 of file AthenaHiveEventLoopMgr.h.

◆ number_type

Definition at line 107 of file AthenaHiveEventLoopMgr.h.

◆ StoreGateSvc_t

Definition at line 81 of file AthenaHiveEventLoopMgr.h.

◆ tool_iterator

typedef tool_store::const_iterator AthenaHiveEventLoopMgr::tool_iterator
protectedinherited

Definition at line 121 of file AthenaHiveEventLoopMgr.h.

◆ tool_stats

typedef std::vector<unsigned int> AthenaHiveEventLoopMgr::tool_stats
protectedinherited

Definition at line 122 of file AthenaHiveEventLoopMgr.h.

◆ tool_stats_iterator

typedef tool_stats::const_iterator AthenaHiveEventLoopMgr::tool_stats_iterator
protectedinherited

Definition at line 123 of file AthenaHiveEventLoopMgr.h.

◆ tool_store

typedef ToolHandleArray< tool_type > AthenaHiveEventLoopMgr::tool_store
protectedinherited

Definition at line 120 of file AthenaHiveEventLoopMgr.h.

◆ tool_type

Definition at line 119 of file AthenaHiveEventLoopMgr.h.

Member Enumeration Documentation

◆ Take

Where the next request came from.

Enumerator
Job 

got one

None 

none available right now

Stopped 

no more requests will ever come

Definition at line 80 of file RemoteExecHiveEventLoopMgr.h.

82 None,
83 Stopped
84 };
@ None

Constructor & Destructor Documentation

◆ RemoteExecHiveEventLoopMgr()

AthRemoteExec::RemoteExecHiveEventLoopMgr::RemoteExecHiveEventLoopMgr ( const std::string & name,
ISvcLocator * svcLoc )

Definition at line 30 of file RemoteExecHiveEventLoopMgr.cxx.

32 : AthenaHiveEventLoopMgr(name, svcLoc) {
33 // This driver supplies events directly; it never reads a batch selector.
34 m_evtsel = "NONE";
35 m_schedulerName = "AvalancheSchedulerSvc";
36 declareProperty("EvtStore",
37 m_eventStore); // Preserve the RemoteExec property name.
38}
virtual const std::string & name() const override
std::string m_schedulerName
Name of the scheduler to be used.
StoreGateSvc_t m_eventStore
Reference to StoreGateSvc;.
AthenaHiveEventLoopMgr()=delete

◆ ~RemoteExecHiveEventLoopMgr()

AthRemoteExec::RemoteExecHiveEventLoopMgr::~RemoteExecHiveEventLoopMgr ( )
overridevirtualdefault

Member Function Documentation

◆ allocateEventContext()

EventContext AthenaHiveEventLoopMgr::allocateEventContext ( size_t eventNumber)
protectedinherited

Allocate/select a slot, with an index supplied by the driving loop.

Definition at line 1149 of file AthenaHiveEventLoopMgr.cxx.

1149 {
1150 const size_t slot = m_whiteboard->allocateStore(eventNumber);
1151 if (slot == std::string::npos) {
1152 ATH_MSG_ERROR("No free whiteboard slot");
1153 return EventContext{};
1154 }
1155 if (m_whiteboard->selectStore(slot).isFailure()) {
1156 ATH_MSG_ERROR("Could not select whiteboard slot {}", slot);
1157 m_whiteboard->freeStore(slot).ignore();
1158 return EventContext{};
1159 }
1160 EventContext ctx{eventNumber, slot};
1162 ctx, Atlas::ExtendedEventContext(m_eventStore->hiveProxyDict()));
1163 return ctx;
1164}
#define ATH_MSG_ERROR(x,...)
SmartIF< IHiveWhiteBoard > m_whiteboard
Reference to the Whiteboard interface.
void setExtendedEventContext(EventContext &ctx, ExtendedEventContext &&ectx)
Move an extended context into a context object.

◆ buildReply()

ExecuteReply AthRemoteExec::RemoteExecHiveEventLoopMgr::buildReply ( const EventContext & ctx,
const InFlight & entry )
private

Turn a finished event into the reply for its request.

Definition at line 646 of file RemoteExecHiveEventLoopMgr.cxx.

647 {
648 ExecuteReply reply;
649 reply.requestId = entry.request.requestId;
650
651 if (m_aess->eventStatus(ctx) != EventStatus::Success) {
652 std::ostringstream diagnostics;
653 diagnostics << "sequence '" << entry.request.sequence << "' failed ("
654 << m_aess->eventStatus(ctx) << ")";
655 const std::string failed = failedAlgorithms(ctx);
656 if (!failed.empty()) {
657 diagnostics << ": " << failed;
658 }
660 reply.diagnostics = diagnostics.str();
661 return reply;
662 }
663
664 const std::string replyKey = replyKeyFor(entry.request.sequence);
665 if (replyKey.empty()) {
666 // A fragment may legitimately return nothing at all.
667 reply.status = AthRemoteExec::Status::Ok;
668 return reply;
669 }
670
671 if (m_whiteboard->selectStore(ctx.slot()).isFailure()) {
673 reply.diagnostics =
674 "could not select the event slot to read the reply from";
675 return reply;
676 }
677
678 ReplyStaging* staged = nullptr;
679 if (m_eventStore->retrieve(staged, replyKey).isFailure() ||
680 staged == nullptr) {
682 reply.diagnostics = std::format(
683 "sequence '{}' staged no reply under '{}'; did its gate select it?",
684 entry.request.sequence, replyKey);
685 return reply;
686 }
687
688 reply = staged->takeReply();
689 reply.requestId = entry.request.requestId;
690 return reply;
691}
std::string replyKeyFor(const std::string &sequence) const
The reply key of sequence, or an empty string if it declares none.
std::string failedAlgorithms(const EventContext &ctx)
Names of the algorithms that failed in ctx. For the reply diagnostics.
SmartIF< IAlgExecStateSvc > m_aess
Reference to the Algorithm Execution State Svc.

◆ clearStoreOnEndAlgorithms()

bool AthRemoteExec::RemoteExecHiveEventLoopMgr::clearStoreOnEndAlgorithms ( ) const
inlineoverrideprotectedvirtual

Batch jobs clear in the algorithm context; external drivers can retain the store until eventFinished() has consumed their result.

Reimplemented from AthenaHiveEventLoopMgr.

Definition at line 77 of file RemoteExecHiveEventLoopMgr.h.

77{ return false; }

◆ clearWBSlot()

StatusCode AthenaHiveEventLoopMgr::clearWBSlot ( int evtSlot)
protectedinherited

Clear a slot in the WB.

Definition at line 1298 of file AthenaHiveEventLoopMgr.cxx.

1298 {
1299 return m_whiteboard->freeStore(evtSlot);
1300}

◆ complete()

StatusCode AthRemoteExec::RemoteExecHiveEventLoopMgr::complete ( const Finished & finished)
private

Read the result of one finished event and release its slot.

Definition at line 606 of file RemoteExecHiveEventLoopMgr.cxx.

606 {
607 if (finished.ctx == nullptr) {
608 ATH_MSG_FATAL("Scheduler returned a null context");
609 return StatusCode::FAILURE;
610 }
611 const std::unique_ptr<EventContext> ctx(finished.ctx);
612
613 const size_t slot = ctx->slot();
614 const auto entry = m_inFlight.find(slot);
615 if (entry == m_inFlight.end()) {
616 ATH_MSG_FATAL("Slot {} finished but no request was in flight on it", slot);
617 return StatusCode::FAILURE;
618 }
619
620 if (entry->second.job && entry->second.job->timing) {
621 entry->second.job->timing->finished = finished.at;
622 }
623
624 const StatusCode sc = finishEvent(*ctx);
625 if (sc.isFailure()) {
626 respond(entry->second, ExecuteReply{AthRemoteExec::Status::AlgFailure,
627 "could not finish the event",
628 {},
629 entry->second.request.requestId});
630 }
631
632 m_inFlight.erase(entry);
633 ++m_completed;
634 Gaudi::Hive::setCurrentContext(EventContext());
635 return sc;
636}
#define ATH_MSG_FATAL(x,...)
static Double_t sc
std::map< size_t, InFlight > m_inFlight
keyed by whiteboard slot
void respond(InFlight &entry, ExecuteReply reply)
Reply to the request.
StatusCode finishEvent(const EventContext &ctx)
Finish one scheduler-returned event on the driving thread.
::StatusCode StatusCode
StatusCode definition for legacy code.

◆ createEventContext()

EventContext AthenaHiveEventLoopMgr::createEventContext ( )
overrideprotectedvirtualinherited

Create event context.

Definition at line 1145 of file AthenaHiveEventLoopMgr.cxx.

1145 {
1147}
EventContext allocateEventContext(size_t eventNumber)

◆ curEvent()

int AthenaHiveEventLoopMgr::curEvent ( ) const
overridevirtualinherited

Return the current event count.

Definition at line 796 of file AthenaHiveEventLoopMgr.cxx.

797{
798 return m_nevt;
799}

◆ declareEventRootAddress()

int AthenaHiveEventLoopMgr::declareEventRootAddress ( EventContext & ctx)
protectedinherited

Declare the root address of the event.

FIXME ???

Definition at line 924 of file AthenaHiveEventLoopMgr.cxx.

924 {
925
926 // return codes:
927 // -1 : error
928 // 0 : no more events in selection
929 // 1 : ok
930
931 StatusCode sc(StatusCode::SUCCESS);
932
933 //-----------------------------------------------------------------------
934 // we need an EventInfo Object to fire the incidents.
935 //-----------------------------------------------------------------------
936 std::unique_ptr<const EventInfo> pEvent{};
937 if ( m_evtContext ) {
938 // Deal with the case when an EventSelector is provided
939 //
940 // FIXME: flow control if no more events in selector, etc.
941 //
942
943 IOpaqueAddress* addr{};
944
945 sc = m_evtSelector->next(*m_evtContext);
946
947 if ( !sc.isSuccess() ) {
948 // This is the end of the loop. No more events in the selection
949 ATH_MSG_INFO ( "No more events in event selection " );
950 return 0;
951 }
952
953 if (m_evtSelector->createAddress(*m_evtContext, addr).isFailure()) {
954 ATH_MSG_ERROR ( "Could not create an IOpaqueAddress" );
955 return -1;
956 }
957
958
959 // Most iterators provide the IOA of an event header (EventInfo, DataHeader)
960 if (0 != addr) {
961 //create its proxy
962 sc = m_eventStore->recordAddress(addr);
963 if( !sc.isSuccess() ) {
965 ATH_MSG_WARNING ( "Error declaring Event object" );
966 return 0;
967 }
968 } if ((sc=m_eventStore->loadEventProxies()).isFailure()) {
969 ATH_MSG_ERROR ( "Error loading Event proxies" );
970 return -1;
971 }
972
973 bool consume_modifier_stream = false;
974 // First try to build a legacy EventInfo object from the TAG information
975 // Read the attribute list
976 const AthenaAttributeList* pAttrList = m_eventStore->tryConstRetrieve<AthenaAttributeList>("Input");
977 if ( pAttrList != nullptr && pAttrList->size() > 6 ) { // Try making EventID-only EventInfo object from in-file TAG
978 try {
979 unsigned int runNumber = (*pAttrList)["RunNumber"].data<unsigned int>();
980 unsigned long long eventNumber = (*pAttrList)["EventNumber"].data<unsigned long long>();
981 unsigned int eventTime = (*pAttrList)["EventTime"].data<unsigned int>();
982 unsigned int eventTimeNS = (*pAttrList)["EventTimeNanoSec"].data<unsigned int>();
983 unsigned int lumiBlock = (*pAttrList)["LumiBlockN"].data<unsigned int>();
984 unsigned int bunchId = (*pAttrList)["BunchId"].data<unsigned int>();
985
986 ATH_MSG_DEBUG ( "use TAG with runNumber={}", runNumber );
987 consume_modifier_stream = true;
988 // an option to override primary eventNumber with the secondary one in case of DoubleEventSelector
990 unsigned long long eventNumberSecondary{};
991 if ( !(pAttrList->exists("hasSecondaryInput") && (*pAttrList)["hasSecondaryInput"].data<bool>()) ) {
992 ATH_MSG_FATAL ( "Secondary EventNumber requested, but secondary input does not exist!" );
993 return -1;
994 }
995 if ( pAttrList->exists("EventNumber_secondary") ) {
996 eventNumberSecondary = (*pAttrList)["EventNumber_secondary"].data<unsigned long long>();
997 }
998 else {
999 // try legacy EventInfo if secondary input did not have attribute list
1000 // primary input should not have this EventInfo type
1001 const EventInfo* pEventSecondary = m_eventStore->tryConstRetrieve<EventInfo>();
1002 if (pEventSecondary) {
1003 eventNumberSecondary = pEventSecondary->event_ID()->event_number();
1004 }
1005 else {
1006 ATH_MSG_FATAL ( "Secondary EventNumber requested, but it does not exist!" );
1007 return -1;
1008 }
1009 }
1010 if (eventNumberSecondary != 0) {
1011 m_doEvtHeartbeat = (m_eventPrintoutInterval.value() > 0 &&
1012 0 == (m_nev % m_eventPrintoutInterval.value()));
1013 if (m_doEvtHeartbeat) {
1014 ATH_MSG_INFO ( " ===>>> using secondary event #{} instead of #{} <<<===",
1015 eventNumberSecondary, eventNumber);
1016 }
1017 eventNumber = eventNumberSecondary;
1018 }
1019 }
1020
1021 pEvent = std::make_unique<EventInfo>(
1022 std::make_unique<EventID>(runNumber, eventNumber, eventTime,
1023 eventTimeNS, lumiBlock, bunchId),
1024 nullptr);
1025 } catch (...) {
1026 }
1027 } else if (m_requireInputAttributeList) {
1028 ATH_MSG_FATAL ( "Valid input attribute list required but not present!" );
1029 return -1;
1030 }
1031 // In the case that there is no TAG information
1032 const EventInfo* pEventObserver{pEvent.get()};
1033 if (!pEventObserver) {
1034 // Secondly try to retrieve a legacy EventInfo object from the input file
1035 // Again, m_nevt is incremented after executeEvent in the Hive manager so we don't need a -1
1037 pEventObserver = m_eventStore->tryConstRetrieve<EventInfo>();
1038 if (pEventObserver) {
1039 consume_modifier_stream = false; // stream will already have been consumed during EventInfo TP conversion
1040 ATH_MSG_DEBUG ( "use EventInfo" );
1041 } else {
1042 // Finally try to retrieve an xAOD::EventInfo object from the
1043 // input file and build a legacy EventInfo object from that.
1044 const xAOD::EventInfo* pXEvent{nullptr};
1045 sc = m_eventStore->retrieve(pXEvent);
1046 if( !sc.isSuccess() ) {
1047 ATH_MSG_ERROR ( "Unable to retrieve Event root object" );
1048 return -1;
1049 }
1050 consume_modifier_stream = true;
1051 ATH_MSG_DEBUG ( "use xAOD::EventInfo with runNumber={}", pXEvent->runNumber() );
1052 // Build the old-style Event Info object for those clients that still need it
1053 pEvent = std::make_unique<EventInfo>(
1054 std::make_unique<EventID>(eventIDFromxAOD(pXEvent)),
1055 std::make_unique<EventType>(eventTypeFromxAOD(pXEvent)));
1056 pEventObserver = pEvent.get();
1057 sc = m_eventStore->record(std::move(pEvent), "");
1058 if( !sc.isSuccess() ) {
1059 ATH_MSG_ERROR ( "Error declaring event data object" );
1060 return -1;
1061 }
1062 }
1063 }
1064
1065 modifyEventContext(ctx, *(pEventObserver->event_ID()),
1066 consume_modifier_stream);
1067
1068 }
1069 else {
1070 // No EventSelector is provided, so with no iterator it's up to us
1071 // to create an EventInfo
1072 // first event # == 1
1073 unsigned int runNmb{1}, evtNmb{m_nevt + 1};
1074
1075 // increment the run/lumiBlock number if desired
1076 if (m_flmbi != 0) {
1077 runNmb = m_nevt / m_flmbi + 1;
1078 evtNmb = m_nevt % m_flmbi + 1;
1079 }
1080 auto eid = std::make_unique<EventID> (runNmb,evtNmb, m_timeStamp);
1081 // Change lumiBlock# to match runNumber
1082 eid->set_lumi_block( runNmb );
1083
1085
1086 pEvent = std::make_unique<EventInfo>(std::move(eid),
1087 std::make_unique<EventType>());
1088
1089 bool consume_modifier_stream = true;
1090 // EventInfo TP Conversion not called in this case, so we would
1091 // want to consume the next IoV from the list in the
1092 // EvtIdModifierSvc.
1093 modifyEventContext(ctx,*(pEvent->event_ID()), consume_modifier_stream);
1094
1095 ATH_MSG_DEBUG ( "selecting store: {}", ctx.slot() );
1096
1097 m_whiteboard->selectStore( ctx.slot() ).ignore();
1098
1099 // EventInfo not working with format
1100 ATH_MSG_DEBUG ( "recording EventInfo " << *pEvent->event_ID() << " in "
1101 << m_eventStore->name() );
1102
1103 sc = m_eventStore->record(std::move(pEvent), "McEventInfo");
1104 if( !sc.isSuccess() ) {
1105 ATH_MSG_ERROR ( "Error declaring event data object" );
1106 return -1;
1107 }
1108 }
1109
1110 return 1;
1111}
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_WARNING(x,...)
#define ATH_MSG_INFO(x,...)
EventID eventIDFromxAOD(const xAOD::EventInfo *xaod)
Create EventID object from xAOD::EventInfo.
EventType eventTypeFromxAOD(const xAOD::EventInfo *xaod)
Create EventType object from xAOD::EventInfo.
EventInfo
UnsignedIntegerProperty m_eventPrintoutInterval
IEvtSelector * m_evtSelector
Reference to the Event Selector.
unsigned int m_nev
events processed
bool m_useSecondaryEventNumber
read event number from secondary input
bool m_requireInputAttributeList
require input attribute list
EvtContext * m_evtContext
Gaudi event selector Context (may be used as a cursor by the evt selector).
virtual void modifyEventContext(EventContext &ctx, const EventID &eID, bool consume_modifier_stream)
EventID * event_ID()
the unique identification of the event.
uint32_t runNumber() const
The current event's run number.
event_number_t eventIndex
EventInfo_v1 EventInfo
Definition of the latest event info version.
setTeId lumiBlock

◆ dispatch()

StatusCode AthRemoteExec::RemoteExecHiveEventLoopMgr::dispatch ( ExecuteRequest request,
std::unique_ptr< Server::Job > job )
private

Give a request a slot and push it to the scheduler.

Definition at line 505 of file RemoteExecHiveEventLoopMgr.cxx.

506 {
507 std::string diagnostics;
508 if (const AthRemoteExec::Status early = validate(request, diagnostics);
509 early != AthRemoteExec::Status::Ok) {
510 respondDirect(request, job, early, diagnostics);
511 return StatusCode::SUCCESS;
512 }
513
514 EventContext ctx = allocateEventContext(m_nextEvent);
515 if (!ctx.valid()) {
517 "could not allocate an event slot");
518 return StatusCode::SUCCESS;
519 }
520 const size_t slot = ctx.slot();
521
522 const EventId& id = request.eventId;
523 ctx.setEventID(EventIDBase(
524 *id.runNumber, static_cast<EventIDBase::event_number_t>(*id.eventNumber),
525 *id.timeStamp, id.timeStampNsOffset, *id.lumiBlock, id.bunchCrossingId));
527 Gaudi::Hive::setCurrentContext(ctx);
528 m_aess->reset(ctx);
529
530 if (m_eventStore->record(std::make_unique<EventContext>(ctx), "EventContext")
531 .isFailure() ||
532 // The payloads are moved into the descriptor: nothing downstream reads
533 // request.inputs again (InFlight keeps the request only for its id and
534 // sequence name), and copying them here was a second duplicate of the
535 // whole payload on the critical path.
537 ->record(std::make_unique<RequestDescriptor>(
538 request.sequence, request.requestId,
539 std::move(request.inputs)),
541 .isFailure()) {
542 ATH_MSG_ERROR("Could not prepare slot {} for request {}", slot,
543 request.requestId);
545 "could not prepare the event store");
546 m_whiteboard->clearStore(slot).ignore();
547 m_whiteboard->freeStore(slot).ignore();
548 return StatusCode::SUCCESS;
549 }
550
551 if (job && job->timing) {
552 job->timing->recorded = Clock::now();
553 }
554
556 entry.request = std::move(request);
557 entry.job = std::move(job);
558 if (m_requestTimeout > 0.0) {
559 entry.hasDeadline = true;
560 entry.deadline =
561 Clock::now() +
562 std::chrono::milliseconds(static_cast<long>(m_requestTimeout * 1000.0));
563 }
564
566 "RemoteExec request {} ({}) dispatched to slot {} as run {} lb {} event "
567 "{}",
568 entry.request.requestId, entry.request.sequence, slot, *id.runNumber,
569 *id.lumiBlock, *id.eventNumber);
570
571 const uint64_t requestId = entry.request.requestId;
572 auto [placed, inserted] = m_inFlight.emplace(slot, std::move(entry));
573 if (!inserted) {
574 ATH_MSG_FATAL("Slot {} was already in flight", slot);
575 return StatusCode::FAILURE;
576 }
577
578 if (submitEvent(ctx).isFailure()) {
579 ATH_MSG_ERROR("Could not submit request " << requestId);
580 respond(placed->second, ExecuteReply{AthRemoteExec::Status::AlgFailure,
581 "could not submit the event",
582 {},
583 requestId});
584 m_whiteboard->clearStore(slot).ignore();
585 m_whiteboard->freeStore(slot).ignore();
586 m_inFlight.erase(placed);
587 Gaudi::Hive::setCurrentContext(EventContext());
588 return StatusCode::SUCCESS;
589 }
590
591 if (placed->second.job && placed->second.job->timing) {
592 placed->second.job->timing->pushed = Clock::now();
593 }
594
595 {
596 const std::lock_guard<std::mutex> lock(m_pendingMutex);
598 }
599 m_inFlightCv.notify_one();
600
601 ++m_nextEvent;
602 Gaudi::Hive::setCurrentContext(EventContext());
603 return StatusCode::SUCCESS;
604}
virtual void lock()=0
Interface to allow an object to lock itself when made const in SG.
void respondDirect(const ExecuteRequest &request, const std::unique_ptr< Server::Job > &job, AthRemoteExec::Status status, const std::string &diagnostics)
Reply to the request that never got assigned to slot.
std::condition_variable m_inFlightCv
output thread waits here
AthRemoteExec::Status validate(const ExecuteRequest &request, std::string &diagnostics) const
Reject requests that cannot possibly run, before a slot is spent on them.
StatusCode submitEvent(EventContext &ctx)
Submit a recorded context; the scheduler receives its own copy.
void setConditionsRun(EventIDBase::number_type conditionsRun)
Status
RPC reply status.
Definition Protocol.h:32
const ExtendedEventContext & getExtendedEventContext(const EventContext &ctx)
Retrieve an extended context from a context object.
A request that has been given a slot and handed to the scheduler.

◆ drainPending()

void AthRemoteExec::RemoteExecHiveEventLoopMgr::drainPending ( )
private

Answer to anything that the loop did not manage to finish.

Definition at line 318 of file RemoteExecHiveEventLoopMgr.cxx.

318 {
319 std::deque<std::unique_ptr<Server::Job>> leftover;
320 std::deque<Finished> uncollected;
321 {
322 const std::lock_guard<std::mutex> lock(m_pendingMutex);
323 leftover.swap(m_incoming);
324 uncollected.swap(m_finishedEvents);
325 }
326 const std::string msgStr{"the server stopped before this request was served"};
327 for (const std::unique_ptr<Server::Job>& job : leftover) {
328 // Reply to clients so they won't stay stuck waiting
329 ATH_MSG_WARNING("Request {} ({}) was still queued when the loop stopped",
330 job->request.requestId, job->request.sequence);
332 }
333
334 // Destroy finished events
335 for (const Finished& finished : uncollected) {
336 delete finished.ctx;
337 }
338}
std::deque< std::unique_ptr< Server::Job > > m_incoming
A finished event, from the scheduler's point of view.

◆ drainScheduler()

int AthenaHiveEventLoopMgr::drainScheduler ( int & finishedEvents)
protectedinherited

Drain the scheduler from all actions that may be queued.

Definition at line 1245 of file AthenaHiveEventLoopMgr.cxx.

1245 {
1246
1247 StatusCode sc(StatusCode::SUCCESS);
1248
1249 // maybe we can do better
1250 std::vector<std::unique_ptr<EventContext>> finishedEvtContexts;
1251
1252 EventContext* finishedEvtContext(nullptr);
1253
1254 // Here we wait not to loose cpu resources
1255 ATH_MSG_DEBUG ( "drainScheduler: [{}] Waiting for a context", finishedEvts);
1256 sc = m_schedulerSvc->popFinishedEvent(finishedEvtContext);
1257
1258 // We got past it: cache the pointer
1259 if (sc.isSuccess()){
1260 // EventContext not working with std::format
1261 ATH_MSG_DEBUG ( "drainScheduler: scheduler not empty: Context "
1262 << finishedEvtContext );
1263 finishedEvtContexts.emplace_back(finishedEvtContext);
1264 } else{
1265 // no more events left in scheduler to be drained
1266 ATH_MSG_DEBUG ( "drainScheduler: scheduler empty" );
1267 return 0;
1268 }
1269
1270 // Let's see if we can pop other event contexts
1271 while (m_schedulerSvc->tryPopFinishedEvent(finishedEvtContext).isSuccess()){
1272 finishedEvtContexts.emplace_back(finishedEvtContext);
1273 }
1274
1275 // Now we flush them
1276 bool fail(false);
1277 for (auto& thisFinishedEvtContext : finishedEvtContexts){
1278 if (!thisFinishedEvtContext) {
1279 ATH_MSG_FATAL ( "Detected nullptr ctxt while clearing WB!");
1280 fail = true;
1281 continue;
1282 }
1283
1284 if (finishEvent(*thisFinishedEvtContext).isFailure()) {
1285 fail = true;
1286 } else {
1287 ++finishedEvts;
1288 }
1289
1290 }
1291
1292 return ( fail ? -1 : 1 );
1293
1294}
SmartIF< IScheduler > m_schedulerSvc
A shortcut for the scheduler.
fail(message)

◆ eventFinished()

StatusCode AthRemoteExec::RemoteExecHiveEventLoopMgr::eventFinished ( const EventContext & ctx)
overrideprotectedvirtual

Process an event's result and decide whether the driving loop may continue.

Reimplemented from AthenaHiveEventLoopMgr.

Definition at line 638 of file RemoteExecHiveEventLoopMgr.cxx.

638 {
639 auto& entry = m_inFlight.at(ctx.slot());
640 respond(entry, buildReply(ctx, entry));
641
642 // An algorithm failure is a failed request, not a reason to stop serving!
643 return StatusCode::SUCCESS;
644}
ExecuteReply buildReply(const EventContext &ctx, const InFlight &entry)
Turn a finished event into the reply for its request.

◆ executeAlgorithms()

StatusCode AthenaHiveEventLoopMgr::executeAlgorithms ( )
protectedvirtualinherited

Run the algorithms for the current event.

Definition at line 479 of file AthenaHiveEventLoopMgr.cxx.

479 {
480
481 return StatusCode::SUCCESS;
482}

◆ executeEvent()

StatusCode AthenaHiveEventLoopMgr::executeEvent ( EventContext && ctx)
overridevirtualinherited

implementation of IEventProcessor::executeEvent(void* par)

Fire begin-Run incident if new run:

Definition at line 488 of file AthenaHiveEventLoopMgr.cxx.

489{
490
491 // An incident may schedule a stop, in which case is better to exit before the actual execution.
492 if ( m_scheduledStop ) {
493 ATH_MSG_ALWAYS ( "A stopRun was requested by an incidentListener. "
494 "Do not process this event." );
495 m_terminateLoop = true;
496 return (StatusCode::SUCCESS);
497 }
498
499 m_aess->reset( ctx );
500
501 // Make sure context with slot is set before calling es->next().
502 Gaudi::Hive::setCurrentContext ( ctx );
503
504 int declEvtRootSc = declareEventRootAddress( ctx );
505 if (declEvtRootSc == 0 ) { // We ran out of events!
506 m_terminateLoop = true; // we have finished!
507 return StatusCode::SUCCESS;
508 } else if ( declEvtRootSc == -1) {
509 // No std::format for EventContext
510 ATH_MSG_ERROR ( "declareEventRootAddress for context " << ctx << " failed" );
511 return StatusCode::FAILURE;
512 }
513
514 EventID::event_number_t evtNumber = ctx.eventID().event_number();
515 unsigned int conditionsRun = ctx.eventID().run_number();
516 if (!m_evtIdModSvc.isSet()) {
517 const AthenaAttributeList* attr = nullptr;
518 if (m_eventStore->contains<AthenaAttributeList> ("Input") &&
519 m_eventStore->retrieve(attr, "Input").isSuccess()) {
520 if (attr->exists ("ConditionsRun")) {
521 conditionsRun = (*attr)["ConditionsRun"].data<unsigned int>();
522 }
523 }
524 }
526 Gaudi::Hive::setCurrentContext ( ctx );
527
528 // Record EventContext in current whiteboard
529 if (m_eventStore->record(std::make_unique<EventContext> (ctx),
530 "EventContext").isFailure())
531 {
532 ATH_MSG_ERROR ( "Error recording event context object" );
533 return (StatusCode::FAILURE);
534 }
535
537 if (m_firstRun || (m_currentRun != ctx.eventID().run_number()) ) {
538 // Fire EndRun incident unless this is the first run
539 if (!m_firstRun) {
540 // FIXME!!!
541 m_incidentSvc->fireIncident(Incident(name(), IncidentType::EndRun));
542 }
543 m_firstRun=false;
544 m_currentRun = ctx.eventID().run_number();
545
546 ATH_MSG_INFO ( " ===>>> start of run {} <<<===", m_currentRun);
547
548 // FIXME!!! Fire BeginRun "Incident"
549 m_incidentSvc->fireIncident(Incident(name(),IncidentType::BeginRun,ctx));
550
551 }
552
553 bool toolsPassed=true;
554 // CGL: FIXME
555 // bool eventFailed = false;
556
557 // Call any attached tools to reject events early
558 unsigned int toolCtr=0;
559 if(m_useTools) {
560 tool_store::iterator theTool = m_tools.begin();
561 tool_store::iterator lastTool = m_tools.end();
562 while(toolsPassed && theTool!=lastTool )
563 {
564 toolsPassed = (*theTool)->passEvent(ctx.eventID());
565 m_toolInvoke[toolCtr]++;
566 {toolsPassed ? m_toolAccept[toolCtr]++ : m_toolReject[toolCtr]++;}
567 ++toolCtr;
568 ++theTool;
569 }
570 }
571
573 0 == (m_nev % m_eventPrintoutInterval.value()));
574 if (m_doEvtHeartbeat) {
575 if(!m_useTools) {
576 ATH_MSG_INFO ( " ===>>> start processing event #{}, run #{} on slot {}, {} events processed so far <<<===",
577 evtNumber, m_currentRun, ctx.slot(), m_proc);
578 }
579 else {
580 ATH_MSG_INFO ( " ===>>> start processing event #{}, run #{} on slot {}, {} events read and {} events processed so far <<<===",
581 evtNumber, m_currentRun, ctx.slot(), m_nev, m_proc);
582 }
583 }
584
585 if(toolsPassed) {
586
587 if (submitEvent(ctx).isFailure()) {
588 m_whiteboard->clearStore(ctx.slot()).ignore();
589 clearWBSlot(ctx.slot()).ignore();
590 Gaudi::Hive::setCurrentContext(EventContext());
591 return StatusCode::FAILURE;
592 }
593
594 } else {
595 ++m_nev;
596 ++m_nevt;
597 }
598
599 // invalidate thread local context once outside of event execute loop
600 Gaudi::Hive::setCurrentContext( EventContext() );
601
602 return StatusCode::SUCCESS;
603
604}
#define ATH_MSG_ALWAYS(x,...)
number_type m_currentRun
current run number
tool_stats m_toolAccept
tool returns StatusCode::SUCCESS counter
tool_stats m_toolInvoke
tool called counter
IIncidentSvc_t m_incidentSvc
Reference to the incident service.
int declareEventRootAddress(EventContext &)
Declare the root address of the event.
bool m_scheduledStop
Scheduled stop of event processing.
StatusCode clearWBSlot(int evtSlot)
Clear a slot in the WB.
tool_store m_tools
internal tool store
tool_stats m_toolReject
tool returns StatusCode::FAILURE counter
IEvtIdModifierSvc_t m_evtIdModSvc

◆ executeRun()

StatusCode AthenaHiveEventLoopMgr::executeRun ( int maxevt)
overridevirtualinherited

implementation of IEventProcessor::executeRun(int maxevt)

Definition at line 609 of file AthenaHiveEventLoopMgr.cxx.

610{
611
613 bool eventfailed = false;
614
615 // Call now the nextEvent(...)
616 sc = nextEvent(maxevt);
617 if (!sc.isSuccess())
618 eventfailed = true;
619
620 if (eventfailed)
621 return StatusCode::FAILURE;
622
623 m_incidentSvc->fireIncident(Incident(name(),"EndEvtLoop"));
624 return StatusCode::SUCCESS;
625}
virtual StatusCode nextEvent(int maxevt) override
implementation of IAppMgrUI::nextEvent. maxevt==0 returns immediately

◆ expireDeadlines()

void AthRemoteExec::RemoteExecHiveEventLoopMgr::expireDeadlines ( )
private

Reply to all request that passed their deadline.

The slot is kept until the event finishes.

Definition at line 693 of file RemoteExecHiveEventLoopMgr.cxx.

693 {
694 if (m_requestTimeout <= 0.0) {
695 return;
696 }
697
698 const Clock::time_point now = Clock::now();
699 for (auto& [slot, entry] : m_inFlight) {
700 if (entry.answered || !entry.hasDeadline || now < entry.deadline) {
701 continue;
702 }
703
705 "Request {} ({}) on slot {} exceeded {} s; answering the client now "
706 "and releasing the slot when the event finishes",
707 entry.request.requestId, entry.request.sequence, slot,
708 m_requestTimeout.value());
709 std::ostringstream diagnostics;
710 diagnostics << "the server did not finish within "
711 << m_requestTimeout.value() << " s";
712 ExecuteReply reply;
713 reply.status = AthRemoteExec::Status::Timeout;
714 reply.diagnostics = diagnostics.str();
715 respond(entry, std::move(reply));
716 }
717}

◆ failedAlgorithms()

std::string AthRemoteExec::RemoteExecHiveEventLoopMgr::failedAlgorithms ( const EventContext & ctx)
private

Names of the algorithms that failed in ctx. For the reply diagnostics.

Definition at line 763 of file RemoteExecHiveEventLoopMgr.cxx.

764 {
765 SmartIF<IAlgManager> algMgr = serviceLocator()->as<IAlgManager>();
766 if (!algMgr) {
767 return {};
768 }
769
770 std::ostringstream names;
771 for (IAlgorithm* alg : algMgr->getAlgorithms()) {
772 if (alg == nullptr) {
773 continue;
774 }
775
776 const AlgExecStateRef state = m_aess->algExecState(alg, ctx);
777 if (state.state() == AlgExecState::State::Done &&
778 state.execStatus().isFailure()) {
779 names << (names.tellp() == 0 ? "" : ", ") << alg->name();
780 }
781 }
782
783 return names.str();
784}

◆ finalize()

StatusCode AthRemoteExec::RemoteExecHiveEventLoopMgr::finalize ( )
overridevirtual

implementation of IAppMgrUI::finalize

Reimplemented from AthenaHiveEventLoopMgr.

Definition at line 88 of file RemoteExecHiveEventLoopMgr.cxx.

88 {
89 // Normally already done by nextEvent. This covers the paths where the loop
90 // never ran or threw, so the threads cannot outlive the services they use.
92 if (m_server) {
93 m_server->shutdown();
94 m_server.reset();
95 }
97}
virtual StatusCode finalize() override
implementation of IAppMgrUI::finalize

◆ finishEvent()

StatusCode AthenaHiveEventLoopMgr::finishEvent ( const EventContext & ctx)
protectedinherited

Finish one scheduler-returned event on the driving thread.

Calls the result hook with its store selected, then releases the slot even if the hook reports failure. Does not wait for or delete the context.

Definition at line 1197 of file AthenaHiveEventLoopMgr.cxx.

1197 {
1198 StatusCode result = m_whiteboard->selectStore(ctx.slot());
1199 if (result.isSuccess()) {
1200 Gaudi::Hive::setCurrentContext(ctx);
1201 result = eventFinished(ctx);
1202 m_incidentSvc->fireIncident(
1203 Incident(name(), IncidentType::EndProcessing, ctx));
1204 } else {
1205 ATH_MSG_ERROR("Could not select completed slot {}", ctx.slot());
1206 }
1207
1208 // Result handling may fail; the event has nevertheless left the scheduler
1209 // and must relinquish its slot. Successful batch jobs already cleared at
1210 // EndAlgorithms, but a failed/stalled graph may never fire that incident.
1211 // Clear failed events here as well so drivers which tolerate failure can
1212 // reuse the slot without stale EventInfo or payload objects.
1214 m_aess->eventStatus(ctx) != EventStatus::Success) {
1215 result &= m_whiteboard->clearStore(ctx.slot());
1216 }
1217 result &= clearWBSlot(ctx.slot());
1218 if (result.isFailure()) {
1219 Gaudi::Hive::setCurrentContext(EventContext());
1220 return result;
1221 }
1222 writeHistograms().ignore();
1223 ++m_proc;
1224 if (m_doEvtHeartbeat) {
1225 const auto n_evt = ctx.eventID().event_number();
1226 const auto n_run = ctx.eventID().run_number();
1227 ATH_MSG_INFO(" ===>>> done processing event #{}, run #{} on slot {}, {} events processed so far <<<===",
1228 n_evt, n_run, ctx.slot(), m_proc);
1229 std::ofstream outfile("eventLoopHeartBeat.txt");
1230 if (!outfile) {
1231 ATH_MSG_ERROR("Unable to open eventLoopHeartBeat.txt");
1232 Gaudi::Hive::setCurrentContext(EventContext());
1233 return StatusCode::FAILURE;
1234 }
1235 std::println(outfile, " done processing event #{}, run #{} {} events read so far <<<===",
1236 n_evt, n_run, m_nev);
1237 }
1238 Gaudi::Hive::setCurrentContext(EventContext());
1239 return StatusCode::SUCCESS;
1240}
virtual StatusCode eventFinished(const EventContext &ctx)
Process an event's result and decide whether the driving loop may continue.
virtual bool clearStoreOnEndAlgorithms() const
Batch jobs clear in the algorithm context; external drivers can retain the store until eventFinished(...
virtual StatusCode writeHistograms(bool force=false)
Dump out histograms as needed.

◆ getEventRoot()

StatusCode AthenaHiveEventLoopMgr::getEventRoot ( IOpaqueAddress *& refpAddr)
inherited

Create event address using event selector.

Definition at line 902 of file AthenaHiveEventLoopMgr.cxx.

902 {
903 refpAddr = 0;
905 if ( !sc.isSuccess() ) {
906 return sc;
907 }
908 // Create root address and assign address to data service
909 sc = m_evtSelector->createAddress(*m_evtContext,refpAddr);
910 if( !sc.isSuccess() ) {
911 sc = m_evtSelector->next(*m_evtContext);
912 if ( sc.isSuccess() ) {
913 sc = m_evtSelector->createAddress(*m_evtContext,refpAddr);
914 if ( !sc.isSuccess() ) {
915 ATH_MSG_WARNING ( "Error creating IOpaqueAddress." );
916 }
917 }
918 }
919 return sc;
920}

◆ handle()

void AthenaHiveEventLoopMgr::handle ( const Incident & inc)
overridevirtualinherited

IIncidentListenet interfaces.

Definition at line 826 of file AthenaHiveEventLoopMgr.cxx.

827{
828
829 if(inc.type() == "EndAlgorithms") {
830 if (!clearStoreOnEndAlgorithms()) return;
831 // Clear the store at the end of the event.
832 // Do it here so that it executes in an algorithm context and thus
833 // multiple stores can be cleared at the same time.
834 StatusCode sc = m_whiteboard->clearStore(inc.context().slot());
835 if( !sc.isSuccess() ) {
836 ATH_MSG_WARNING ( "Clear of Event data store failed" );
837 }
838 return;
839 }
840
841 if(inc.type()!="BeforeFork")
842 return;
843
844 if(!m_evtContext || !m_firstRun) {
845 ATH_MSG_WARNING ( "Skipping BeforeFork handler. Either no event selector is provided or begin run has already passed" );
846 }
847
848 // Initialize Algorithms and Output Streams
850 if(sc.isFailure()) {
851 ATH_MSG_ERROR ( "Failed to initialize Algorithms" );
852 return;
853 }
854
855 // Construct EventInfo
856 sc = m_evtSelector->next(*m_evtContext);
857 if(!sc.isSuccess()) {
858 ATH_MSG_INFO ( "No more events in event selection " );
859 return;
860 }
861 IOpaqueAddress* addr{nullptr};
862 sc = m_evtSelector->createAddress(*m_evtContext, addr);
863 if (sc.isFailure()) {
864 ATH_MSG_ERROR ( "Could not create an IOpaqueAddress" );
865 return;
866 }
867 if (0 != addr) {
868 //create its proxy
869 sc = m_eventStore->recordAddress(addr);
870 if(!sc.isSuccess()) {
871 ATH_MSG_ERROR ( "Error declaring Event object" );
872 return;
873 }
874 }
875
876 if(m_eventStore->loadEventProxies().isFailure()) {
877 ATH_MSG_WARNING ( "Error loading Event proxies" );
878 return;
879 }
880
881 // Retrieve the legacy EventInfo object
882 const EventInfo* pEvent{nullptr};
883 sc = m_eventStore->retrieve(pEvent);
884 if(!sc.isSuccess()) {
885 ATH_MSG_ERROR ( "Unable to retrieve Event root object" );
886 return;
887 }
888
889 m_firstRun=false;
890 m_currentRun = pEvent->event_ID()->run_number();
891
892 // Clear Store
893 sc = m_eventStore->clearStore();
894 if(!sc.isSuccess()) {
895 ATH_MSG_ERROR ( "Clear of Event data store failed" );
896 }
897}
StatusCode initializeAlgorithms()
Initialize all algorithms and output streams.

◆ initialize()

StatusCode AthRemoteExec::RemoteExecHiveEventLoopMgr::initialize ( )
overridevirtual

implementation of IAppMgrUI::initalize

Reimplemented from AthenaHiveEventLoopMgr.

Definition at line 42 of file RemoteExecHiveEventLoopMgr.cxx.

42 {
44
45 if (m_sequences.empty()) {
47 "No sequences configured; the server would have nothing to "
48 "offer. Set the Sequences property.");
49 return StatusCode::FAILURE;
50 }
51
52 const auto known = [this](const std::string& sequence) {
53 return std::find(m_sequences.begin(), m_sequences.end(), sequence) !=
54 m_sequences.end();
55 };
56 for (const auto& [sequence, keys] : m_outputKeys) {
57 if (!known(sequence)) {
58 ATH_MSG_ERROR("OutputKeys names sequence '{}', which is not in Sequences",
59 sequence);
60 return StatusCode::FAILURE;
61 }
62 }
63 for (const auto& [sequence, key] : m_replyKeys) {
64 if (!known(sequence)) {
65 ATH_MSG_ERROR("ReplyKeys names sequence '{}', which is not in Sequences",
66 sequence);
67 return StatusCode::FAILURE;
68 }
69 }
70 for (const auto& [sequence, keys] : m_outputKeys) {
71 if (!keys.empty() && m_replyKeys.value().count(sequence) == 0) {
72 ATH_MSG_ERROR("Sequence '{}' declares outputs but no entry in ReplyKeys",
73 sequence);
74 return StatusCode::FAILURE;
75 }
76 }
77
78 std::ostringstream menu;
79 for (const std::string& sequence : m_sequences) {
80 menu << (menu.tellp() == 0 ? "" : ", ") << sequence;
81 }
82 ATH_MSG_INFO("Serving {} sequence(s): {} over {} slot(s)", m_sequences.size(),
83 menu.str(), m_whiteboard->getNumberOfStores());
84
85 return StatusCode::SUCCESS;
86}
#define ATH_CHECK
Evaluate an expression and check for errors.
Gaudi::Property< std::map< std::string, std::vector< std::string > > > m_outputKeys
Gaudi::Property< std::vector< std::string > > m_sequences
Gaudi::Property< std::map< std::string, std::string > > m_replyKeys
virtual StatusCode initialize() override
implementation of IAppMgrUI::initalize

◆ initializeAlgorithms()

StatusCode AthenaHiveEventLoopMgr::initializeAlgorithms ( )
protectedinherited

Initialize all algorithms and output streams.

Definition at line 471 of file AthenaHiveEventLoopMgr.cxx.

471 {
472
473 return StatusCode::SUCCESS;
474}

◆ initMessaging()

void AthMessaging::initMessaging ( ) const
privateinherited

Initialize our message level and MessageSvc.

This method should only be called once.

Definition at line 39 of file AthMessaging.cxx.

40{
42 // If user did not set an explicit level, set a default
43 if (m_lvl == MSG::NIL) {
44 m_lvl = m_imsg ?
45 static_cast<MSG::Level>( m_imsg.load()->outputLevel(m_nm) ) :
46 MSG::INFO;
47 }
48}
std::string m_nm
Message source name.
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
std::atomic< MSG::Level > m_lvl
Current logging level.
IMessageSvc * getMessageSvc(bool quiet=false)
int outputLevel(const IMessageSvc *ims, const std::string &source)

◆ inputLoop()

void AthRemoteExec::RemoteExecHiveEventLoopMgr::inputLoop ( )
private

Loop and wait for incoming job.

Push it onto incoming event queue and notify main loop.

Definition at line 340 of file RemoteExecHiveEventLoopMgr.cxx.

340 {
341 std::unique_ptr<Server::Job> job;
342 while (m_server->pop(job)) {
343 {
344 std::unique_lock<std::mutex> lock(m_pendingMutex);
345 // Wait until there is space for a new job
346 m_incomingRoom.wait(lock, [this] {
348 });
349 m_incoming.push_back(std::move(job));
350 }
351 m_pending.notify_one();
352 }
353 {
354 const std::lock_guard<std::mutex> lock(m_pendingMutex);
355 m_inputDone = true;
356 }
357 m_pending.notify_one();
358}
std::condition_variable m_pending
loop waits here
std::condition_variable m_incomingRoom
input thread waits here

◆ modifyEventContext()

void AthenaHiveEventLoopMgr::modifyEventContext ( EventContext & ctx,
const EventID & eID,
bool consume_modifier_stream )
virtualinherited

Definition at line 1115 of file AthenaHiveEventLoopMgr.cxx.

1115 {
1116
1117 if(m_evtIdModSvc.isSet()) {
1118 EventID new_eID(eID);
1119 // In Hive EventLoopMgr ctx.evt() gets set to m_nevt and *then* m_nevt is
1120 // incremented later so it's zero-indexed and we don't need to subtract one
1121 m_evtIdModSvc->modify_evtid(new_eID, ctx.evt(), consume_modifier_stream);
1122 if (msgLevel(MSG::DEBUG)) {
1123 unsigned int oldrunnr=eID.run_number();
1124 unsigned int oldLB=eID.lumi_block();
1125 unsigned int oldTS=eID.time_stamp();
1126 unsigned int oldTSno=eID.time_stamp_ns_offset();
1127 ATH_MSG_DEBUG ( "modifyEventContext: use evtIdModSvc runnr={} -> {}",
1128 oldrunnr, new_eID.run_number());
1129 ATH_MSG_DEBUG ( "modifyEventContext: use evtIdModSvc LB={} -> {}",
1130 oldLB, new_eID.lumi_block());
1131 ATH_MSG_DEBUG ( "modifyEventContext: use evtIdModSvc TimeStamp={} -> {}",
1132 oldTS, new_eID.time_stamp());
1133 ATH_MSG_DEBUG ( "modifyEventContext: use evtIdModSvc TimeStamp ns Offset={} -> {}",
1134 oldTSno, new_eID.time_stamp_ns_offset());
1135 }
1136 ctx.setEventID( new_eID );
1137 Atlas::getExtendedEventContext(ctx).setConditionsRun( ctx.eventID().run_number() );
1138 return;
1139 }
1140
1141 ctx.setEventID( eID );
1142}

◆ msg() [1/2]

MsgStream & AthMessaging::msg ( ) const
inlineinherited

The standard message stream.

Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 92 of file AthMessaging.h.

168{
169 MsgStream* ms = m_msg_tls.get();
170 if (!ms) {
171 if (!m_initialized.test_and_set()) initMessaging();
172 ms = new MsgStream(m_imsg,m_nm);
173 m_msg_tls.reset( ms );
174 }
175
176 ms->setLevel (m_lvl);
177 return *ms;
178}
boost::thread_specific_ptr< MsgStream > m_msg_tls
MsgStream instance (a std::cout like with print-out levels).
void initMessaging() const
Initialize our message level and MessageSvc.

◆ msg() [2/2]

MsgStream & AthMessaging::msg ( const MSG::Level lvl) const
inlineinherited

The standard message stream.

Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 99 of file AthMessaging.h.

183{ return msg() << lvl; }
MsgStream & msg() const
The standard message stream.

◆ msgLvl()

bool AthMessaging::msgLvl ( const MSG::Level lvl) const
inlineinherited

Test the output level.

Parameters
lvlThe message level to test against
Returns
boolean Indicating if messages at given level will be printed
Return values
trueMessages at level "lvl" will be printed

Definition at line 86 of file AthMessaging.h.

152{
153 // If user did not set explicit message level we have to initialize
154 // the messaging and retrieve the default via the MessageSvc.
155 if (m_lvl==MSG::NIL && !m_initialized.test_and_set()) initMessaging();
156
157 if (m_lvl <= lvl) {
158 msg() << lvl;
159 return true;
160 } else {
161 return false;
162 }
163}

◆ name()

virtual const std::string & AthenaHiveEventLoopMgr::name ( ) const
inlineoverridevirtualinherited

Definition at line 255 of file AthenaHiveEventLoopMgr.h.

255{ return Service::name(); } //FIXME

◆ nextEvent()

StatusCode AthRemoteExec::RemoteExecHiveEventLoopMgr::nextEvent ( int maxevt)
overridevirtual

Serve requests.

maxevt < 0 serves until the server is stopped, otherwise at most maxevt requests are accepted.

Reimplemented from AthenaHiveEventLoopMgr.

Definition at line 168 of file RemoteExecHiveEventLoopMgr.cxx.

168 {
169 if (maxevt == 0) {
170 return StatusCode::SUCCESS;
171 }
173
174 const size_t limit = maxevt < 0 ? std::numeric_limits<size_t>::max()
175 : static_cast<size_t>(maxevt);
176 const size_t slots = m_whiteboard->getNumberOfStores();
177 const std::chrono::milliseconds poll(m_pollInterval);
178 size_t accepted = 0;
179
180 ATH_MSG_INFO("Starting the request loop");
181 std::optional<Clock::time_point> firstAccepted;
182 startHelpers();
183
184 const auto canAccept = [&] {
185 return !m_stopRequested && accepted < limit && m_inFlight.size() < slots &&
186 m_schedulerSvc->freeSlots() > 0;
187 };
188
189 while (true) {
190 if (m_inFlight.empty() && (m_stopRequested || accepted >= limit)) {
191 break;
192 }
193
194 bool progressed = false;
195
196 while (canAccept()) {
197 ExecuteRequest request;
198 std::unique_ptr<Server::Job> job;
199 const Take taken = takeRequest(request, job);
200 if (taken == Take::None) {
201 break;
202 }
203 if (taken == Take::Stopped) {
204 m_stopRequested = true;
205 progressed = true;
206 break;
207 }
208 ++accepted;
209 if (!firstAccepted) {
210 firstAccepted = Clock::now();
211 }
212 ATH_CHECK(dispatch(std::move(request), std::move(job)));
213 progressed = true;
214 }
215
216 // Complete everything the output thread has collected.
217 for (const Finished& finished : takeFinished()) {
218 ATH_CHECK(complete(finished));
219 progressed = true;
220 }
221
223
224 if (progressed) {
225 continue;
226 }
227
228 // Wait until we can accept new request or there are finished events OR
229 // periodically check if events passed their deadline
230 std::unique_lock<std::mutex> lock(m_pendingMutex);
231 const auto nothingToDo = [&] {
232 return (m_incoming.empty() || !canAccept()) && m_finishedEvents.empty();
233 };
234 if (nothingToDo()) {
235 if (m_requestTimeout > 0.0) {
236 m_pending.wait_for(lock, poll);
237 } else {
238 m_pending.wait(lock, [&] { return !nothingToDo(); });
239 }
240 }
241 }
242
243 stopHelpers();
244
245 ATH_MSG_INFO("Request loop finished: {} request(s) accepted, {} event(s) run",
246 accepted, m_completed);
247
248 // Cakculate throughput
249 if (firstAccepted && m_completed > 0) {
250 const double seconds =
251 std::chrono::duration<double>(Clock::now() - *firstAccepted).count();
252 if (seconds > 0.0) {
254 "Throughput: {} request(s) in {} s = {} request/s over {} slot(s)",
255 m_completed, seconds, (m_completed / seconds),
256 m_whiteboard->getNumberOfStores());
257 }
258 }
259
260 if (m_server) {
261 if (m_reportTiming) {
262 const std::string report = m_server->timingReport();
263 if (!report.empty()) {
264 ATH_MSG_ALWAYS('\n' << report);
265 }
266 }
267 m_server->shutdown();
268 }
269
270 return StatusCode::SUCCESS;
271}
StatusCode complete(const Finished &finished)
Read the result of one finished event and release its slot.
StatusCode dispatch(ExecuteRequest request, std::unique_ptr< Server::Job > job)
Give a request a slot and push it to the scheduler.
void expireDeadlines()
Reply to all request that passed their deadline.
virtual Take takeRequest(ExecuteRequest &request, std::unique_ptr< Server::Job > &job)
Take the next request from the incoming event queue.
virtual StatusCode startServing()
Create and start the server.
std::vector< Finished > takeFinished()
Take whatever the output thread has collected from finished event queue.
list report
Definition checkTP.py:125

◆ outputLoop()

void AthRemoteExec::RemoteExecHiveEventLoopMgr::outputLoop ( )
private

Loop and wait for finished job.

Push it onto finished event queue and notify main loop.

Definition at line 360 of file RemoteExecHiveEventLoopMgr.cxx.

360 {
361 while (true) {
362 {
363 std::unique_lock<std::mutex> lock(m_pendingMutex);
364 m_inFlightCv.wait(lock, [this] {
366 });
367 if (m_awaitingCompletion == 0) {
368 return;
369 }
370 }
371
372 // Wait until there is a finished job to collect
373 EventContext* finished = nullptr;
374 if (m_schedulerSvc->popFinishedEvent(finished).isFailure()) {
375 std::this_thread::sleep_for(std::chrono::milliseconds(1));
376 continue;
377 }
378 const Clock::time_point at = Clock::now();
379
380 {
381 const std::lock_guard<std::mutex> lock(m_pendingMutex);
383 m_finishedEvents.push_back(Finished{finished, at});
384 }
385 m_pending.notify_one();
386 }
387}
mapped_type at(key_type key) const
Look up an element in the map.

◆ replyKeyFor()

std::string AthRemoteExec::RemoteExecHiveEventLoopMgr::replyKeyFor ( const std::string & sequence) const
private

The reply key of sequence, or an empty string if it declares none.

Definition at line 786 of file RemoteExecHiveEventLoopMgr.cxx.

787 {
788 const auto found = m_replyKeys.value().find(sequence);
789 return found == m_replyKeys.value().end() ? std::string{} : found->second;
790}

◆ resetTimeout()

void Athena::TimeoutMaster::resetTimeout ( Timeout & instance)
inlineprotectedinherited

Reset timeout.

Definition at line 83 of file Timeout.h.

83{ instance.reset(); }
std::map< std::string, double > instance

◆ respond()

void AthRemoteExec::RemoteExecHiveEventLoopMgr::respond ( InFlight & entry,
ExecuteReply reply )
private

Reply to the request.

Definition at line 719 of file RemoteExecHiveEventLoopMgr.cxx.

719 {
720 if (entry.answered) {
721 return;
722 }
723 entry.answered = true;
724 reply.requestId = entry.request.requestId;
725
726 if (reply.status != AthRemoteExec::Status::Ok) {
728 "RemoteExec request {} ({}) -> {}{}", reply.requestId,
729 entry.request.sequence, toString(reply.status),
730 !reply.diagnostics.empty() ? " : " + reply.diagnostics : "");
731 } else {
732 ATH_MSG_DEBUG("RemoteExec request {} ({}) -> {}{}", reply.requestId,
733 entry.request.sequence, toString(reply.status),
734 !reply.diagnostics.empty() ? " : " + reply.diagnostics : "");
735 for (const Payload& output : reply.outputs) {
736 ATH_MSG_DEBUG(" output " << output.key << " = " << describe(output));
737 }
738 }
739
740 if (entry.job) {
741 if (entry.job->timing) {
742 entry.job->timing->replied = Clock::now();
743 }
744 entry.job->reply.set_value(std::move(reply));
745 }
746}
constexpr std::string_view toString(Status status)
String representation of Status enum.
Definition Protocol.h:49
std::string describe(const Payload &payload)
Human-readable rendering of a payload, for log messages.
Definition Protocol.h:80
output
Definition merge.py:16

◆ respondDirect()

void AthRemoteExec::RemoteExecHiveEventLoopMgr::respondDirect ( const ExecuteRequest & request,
const std::unique_ptr< Server::Job > & job,
AthRemoteExec::Status status,
const std::string & diagnostics )
private

Reply to the request that never got assigned to slot.

Definition at line 748 of file RemoteExecHiveEventLoopMgr.cxx.

750 {
751 ATH_MSG_INFO("RemoteExec request {} ({}) -> {}{}", request.requestId,
752 request.sequence, toString(status),
753 !diagnostics.empty() ? " : " + diagnostics : "");
754 if (job) {
755 ExecuteReply reply;
756 reply.status = status;
757 reply.diagnostics = diagnostics;
758 reply.requestId = request.requestId;
759 job->reply.set_value(std::move(reply));
760 }
761}
status
Definition merge.py:16

◆ seek()

StatusCode AthenaHiveEventLoopMgr::seek ( int evt)
overridevirtualinherited

Seek to a given event.

Definition at line 764 of file AthenaHiveEventLoopMgr.cxx.

765{
766 IEvtSelectorSeek* is = dynamic_cast<IEvtSelectorSeek*> (m_evtSelector);
767 if (is == 0) {
768 ATH_MSG_ERROR ( "Seek failed; unsupported by event selector" );
769 return StatusCode::FAILURE;
770 }
771 //cppcheck-suppress nullPointerRedundantCheck
772 if (!m_evtContext) {
773 if (m_evtSelector->createContext(m_evtContext).isFailure()) {
774 ATH_MSG_FATAL ( "Can not create the event selector Context." );
775 return StatusCode::FAILURE;
776 }
777 }
778 //m_evtContext cannot be null if createContext succeeded
779 //cppcheck-suppress nullPointerRedundantCheck
780 StatusCode sc = is->seek (*m_evtContext, evt);
781 if (sc.isSuccess()) {
782 m_incidentSvc->fireIncident(ContextIncident<std::tuple<int, int>>(
783 name(), "SkipEvents", std::tuple<int, int>(m_nevt, evt)));
784 m_nevt = evt;
785 }
786 else {
787 ATH_MSG_ERROR ( "Seek failed." );
788 }
789 return sc;
790}
virtual StatusCode seek(IEvtSelector::Context &c, int evtnum) const =0
Seek to a given event number.

◆ serverMessage()

void AthRemoteExec::RemoteExecHiveEventLoopMgr::serverMessage ( Server::Level level,
const std::string & text )
private

Thread-safe log sink handed to the RPC server.

Definition at line 792 of file RemoteExecHiveEventLoopMgr.cxx.

793 {
794 std::lock_guard<std::mutex> lock(m_messageMutex);
795 msg(static_cast<MSG::Level>(level)) << "[gRPC] " << text << endmsg;
796}
#define endmsg

◆ setLevel()

void AthMessaging::setLevel ( MSG::Level lvl)
inherited

Change the current logging level.

Use this rather than msg().setLevel() for proper operation with MT.

Definition at line 28 of file AthMessaging.cxx.

29{
30 m_lvl = lvl;
31}

◆ setTimeout()

void Athena::TimeoutMaster::setTimeout ( Timeout & instance)
inlineprotectedinherited

Set timeout.

Definition at line 80 of file Timeout.h.

80{ instance.set(); }

◆ setupPreSelectTools()

void AthenaHiveEventLoopMgr::setupPreSelectTools ( Gaudi::Details::PropertyBase & )
protectedinherited

property update handler:sets up the Pre-selection tools

Definition at line 323 of file AthenaHiveEventLoopMgr.cxx.

323 {
324
325 m_toolInvoke.clear();
326 m_toolReject.clear();
327 m_toolAccept.clear();
328
329 m_tools.retrieve().ignore();
330 if(m_tools.size() > 0) {
331 m_useTools=true;
332 m_toolInvoke.resize(m_tools.size());
333 m_toolReject.resize(m_tools.size());
334 m_toolAccept.resize(m_tools.size());
335
336 tool_iterator firstTool = m_tools.begin();
337 tool_iterator lastTool = m_tools.end();
338 unsigned int toolCtr = 0;
339 for ( ; firstTool != lastTool; ++firstTool )
340 {
341 // reset statistics
342 m_toolInvoke[toolCtr] = 0;
343 m_toolReject[toolCtr] = 0;
344 m_toolAccept[toolCtr] = 0;
345 toolCtr++;
346 }
347 }
348
349 return;
350
351}
tool_store::const_iterator tool_iterator

◆ size()

int AthenaHiveEventLoopMgr::size ( )
overridevirtualinherited

Return the size of the collection.

Definition at line 804 of file AthenaHiveEventLoopMgr.cxx.

805{
806 IEvtSelectorSeek* cs = dynamic_cast<IEvtSelectorSeek*> (m_evtSelector);
807 if (cs == 0) {
808 ATH_MSG_ERROR ( "Collection size unsupported by event selector" );
809 return -1;
810 }
811 //cppcheck-suppress nullPointerRedundantCheck
812 if (!m_evtContext) {
813 if (m_evtSelector->createContext(m_evtContext).isFailure()) {
814 ATH_MSG_FATAL ( "Can not create the event selector Context." );
815 return -1;
816 }
817 }
818 //m_evtContext cannot be null if createContext succeeded
819 //cppcheck-suppress nullPointerRedundantCheck
820 return cs->size (*m_evtContext);
821}
virtual int size(IEvtSelector::Context &c) const =0
Return the size of the collection, or -1 if we can't get the size.

◆ startHelpers()

void AthRemoteExec::RemoteExecHiveEventLoopMgr::startHelpers ( )
private

Starts input/output loops.

Definition at line 273 of file RemoteExecHiveEventLoopMgr.cxx.

273 {
274 {
275 const std::lock_guard<std::mutex> lock(m_pendingMutex);
276 m_helpersStopping = false;
277 // One work spot per slot, so the loop never waits on the input thread
278 m_incomingLimit = std::max<size_t>(1, m_whiteboard->getNumberOfStores());
279 m_inputDone = (m_server == nullptr);
280 }
281 if (m_server && !m_inputThread.joinable()) {
282 m_inputThread = std::thread([this] { inputLoop(); });
283 }
284 if (!m_outputThread.joinable()) {
285 m_outputThread = std::thread([this] { outputLoop(); });
286 }
287}
void inputLoop()
Loop and wait for incoming job.
void outputLoop()
Loop and wait for finished job.

◆ startServing()

StatusCode AthRemoteExec::RemoteExecHiveEventLoopMgr::startServing ( )
protectedvirtual

Create and start the server.

Definition at line 109 of file RemoteExecHiveEventLoopMgr.cxx.

109 {
110 // Started here rather than in initialize() so that threads survives any
111 // future fork.
112 m_server = std::make_unique<Server>();
113
114 std::vector<SequenceInfo> menu;
115 menu.reserve(m_sequences.size());
116 for (const std::string& sequence : m_sequences) {
117 SequenceInfo info;
118 info.name = sequence;
119 // Advertise key#encoding#schema, so a client can discover what server is
120 // capable of receiving and replying. This is the same declaration the gate
121 // and pack algorithms parse.
122 const auto advertise = [](const std::vector<std::string>& specs,
123 std::vector<BoundaryInfo>& out) {
124 for (const std::string& spec : specs) {
125 const auto boundary = parseBoundary(spec);
126 if (boundary.has_value()) {
127 out.push_back(std::move(*boundary));
128 }
129 }
130 };
131 if (auto inputs = m_inputKeys.value().find(sequence);
132 inputs != m_inputKeys.value().end()) {
133 advertise(inputs->second, info.inputs);
134 }
135 if (auto outputs = m_outputKeys.value().find(sequence);
136 outputs != m_outputKeys.value().end()) {
137 advertise(outputs->second, info.outputs);
138 }
139 menu.push_back(std::move(info));
140 }
141 m_server->setMenu(std::move(menu));
142
143 const int boundPort =
145 [this](Server::Level level, const std::string& text) {
146 serverMessage(level, text);
147 });
148 if (boundPort < 0) {
149 ATH_MSG_ERROR("Could not start the gRPC server");
150 return StatusCode::FAILURE;
151 }
152 ATH_MSG_INFO("gRPC server listening on {}:{}", m_address.value(), boundPort);
153
154 if (!m_portFile.empty()) {
155 const std::string temporary = m_portFile + ".tmp";
156 {
157 std::ofstream out(temporary);
158 out << boundPort << '\n';
159 }
160 if (std::rename(temporary.c_str(), m_portFile.value().c_str()) != 0) {
161 ATH_MSG_ERROR("Could not write the port file " << m_portFile.value());
162 return StatusCode::FAILURE;
163 }
164 }
165 return StatusCode::SUCCESS;
166}
Gaudi::Property< std::map< std::string, std::vector< std::string > > > m_inputKeys
void serverMessage(Server::Level level, const std::string &text)
Thread-safe log sink handed to the RPC server.
Level
Severity levels, matching MSG::Level so the funnel can forward them.
Definition Server.h:42
std::optional< BoundaryInfo > parseBoundary(std::string_view spec)
Parse "key#encoding#schema" into BoundaryInfo.
Definition Protocol.h:155

◆ stop()

StatusCode AthenaHiveEventLoopMgr::stop ( )
overridevirtualinherited

implementation of IService::stop

Definition at line 644 of file AthenaHiveEventLoopMgr.cxx.

645{
646 // To enable conditions access during stop we set an invalid EventContext
647 // (no event/slot number) but with valid EventID (and extended EventContext).
648 m_lastEventContext.setValid(false);
649 Gaudi::Hive::setCurrentContext( m_lastEventContext );
650
651 StatusCode sc = MinimalEventLoopMgr::stop();
652
653 // If we exit the event loop early due to an error, some event stores
654 // may not have been cleared. This can lead to segfaults later,
655 // as DetectorStore will usually get finalized before HiveSvcMgr.
656 // So make sure that all stores have been cleared at this point.
657 size_t nslot = m_whiteboard ? m_whiteboard->getNumberOfStores() : 0;
658 for (size_t islot = 0; islot < nslot; islot++) {
659 sc &= clearWBSlot (islot);
660 }
661
662 Gaudi::Hive::setCurrentContext( EventContext() );
663 return sc;
664}

◆ stopHelpers()

void AthRemoteExec::RemoteExecHiveEventLoopMgr::stopHelpers ( )
private

Stops input/output loops.

Definition at line 289 of file RemoteExecHiveEventLoopMgr.cxx.

289 {
290 {
291 const std::lock_guard<std::mutex> lock(m_pendingMutex);
292 m_helpersStopping = true;
293 }
294 m_inFlightCv.notify_all();
295 m_pending.notify_all();
296 m_incomingRoom.notify_all();
297
298 // Stop accepting new request first...
299 if (m_inputThread.joinable()) {
300 if (m_server) {
301 m_server->stopAccepting();
302 }
303 m_inputThread.join();
304 }
305
306 // ...reply to client about all unfinished jobs...
307 drainPending();
308
309 // ... and stop replying
310 if (m_server) {
311 m_server->shutdown();
312 }
313 if (m_outputThread.joinable()) {
314 m_outputThread.join();
315 }
316}
void drainPending()
Answer to anything that the loop did not manage to finish.

◆ stopRun()

StatusCode AthRemoteExec::RemoteExecHiveEventLoopMgr::stopRun ( )
overridevirtual

Ask the loop to stop accepting work and drain what is in flight.

Reimplemented from AthenaHiveEventLoopMgr.

Definition at line 99 of file RemoteExecHiveEventLoopMgr.cxx.

99 {
100 ATH_MSG_INFO("Stop requested, draining the server");
101 m_stopRequested = true;
102 if (m_server) {
103 m_server->shutdown();
104 }
105 m_scheduledStop = true;
106 return StatusCode::SUCCESS;
107}

◆ submitEvent()

StatusCode AthenaHiveEventLoopMgr::submitEvent ( EventContext & ctx)
protectedinherited

Submit a recorded context; the scheduler receives its own copy.

On success ctx is invalidated, as the scheduler now owns the slot. On failure ctx stays valid and the caller still owns the slot; no scheduler context is leaked and BeginProcessing is balanced.

Definition at line 1166 of file AthenaHiveEventLoopMgr.cxx.

1166 {
1167 CHECK(m_conditionsCleaner->event(ctx, true));
1169 m_lastEventContext = ctx;
1170
1171 auto submitted = std::make_unique<EventContext>(ctx);
1172 m_incidentSvc->fireIncident(
1173 Incident(name(), IncidentType::BeginProcessing, ctx));
1174 if (m_schedulerSvc->pushNewEvent(submitted.get()).isFailure()) {
1175 m_incidentSvc->fireIncident(
1176 Incident(name(), IncidentType::EndProcessing, ctx));
1177 ATH_MSG_ERROR("Scheduler refused event {}", ctx.evt());
1178 return StatusCode::FAILURE;
1179 }
1180 submitted.release(); // Ownership transferred to the scheduler.
1181 ++m_nev;
1182 ++m_nevt;
1183 ctx = EventContext();
1184 return StatusCode::SUCCESS;
1185}
#define CHECK(...)
Evaluate an expression and check for errors.
ServiceHandle< Athena::IConditionsCleanerSvc > m_conditionsCleaner
void resetTimeout(Timeout &instance)
Reset timeout.
Definition Timeout.h:83
static Timeout & instance()
Get reference to Timeout singleton.
Definition Timeout.h:64

◆ takeFinished()

std::vector< RemoteExecHiveEventLoopMgr::Finished > AthRemoteExec::RemoteExecHiveEventLoopMgr::takeFinished ( )
private

Take whatever the output thread has collected from finished event queue.

Definition at line 390 of file RemoteExecHiveEventLoopMgr.cxx.

390 {
391 std::vector<Finished> finished;
392 const std::lock_guard<std::mutex> lock(m_pendingMutex);
393 finished.assign(m_finishedEvents.begin(), m_finishedEvents.end());
394 m_finishedEvents.clear();
395 return finished;
396}

◆ takeRequest()

RemoteExecHiveEventLoopMgr::Take AthRemoteExec::RemoteExecHiveEventLoopMgr::takeRequest ( ExecuteRequest & request,
std::unique_ptr< Server::Job > & job )
protectedvirtual

Take the next request from the incoming event queue.

Definition at line 398 of file RemoteExecHiveEventLoopMgr.cxx.

399 {
400 std::unique_lock<std::mutex> lock(m_pendingMutex);
401 if (m_incoming.empty()) {
403 }
404 job = std::move(m_incoming.front());
405 m_incoming.pop_front();
406
407 request = std::move(job->request);
408 if (job->timing) {
409 job->timing->taken = Clock::now();
410 }
411 lock.unlock();
412
413 m_incomingRoom.notify_one();
414
415 return Take::Job;
416}

◆ validate()

AthRemoteExec::Status AthRemoteExec::RemoteExecHiveEventLoopMgr::validate ( const ExecuteRequest & request,
std::string & diagnostics ) const
private

Reject requests that cannot possibly run, before a slot is spent on them.

Definition at line 418 of file RemoteExecHiveEventLoopMgr.cxx.

419 {
420 if (std::find(m_sequences.begin(), m_sequences.end(), request.sequence) ==
421 m_sequences.end()) {
422 diagnostics = "no sequence named '" + request.sequence + "'";
424 }
425
426 if (const std::vector<std::string> absent = request.eventId.missing();
427 !absent.empty()) {
428 std::ostringstream text;
429 text << "request carries no usable event identity; missing ";
430 for (size_t i = 0; i < absent.size(); ++i) {
431 text << (i == 0 ? "" : ", ") << absent[i];
432 }
433 diagnostics = text.str();
435 }
436
437 const auto declared = m_inputKeys.value().find(request.sequence);
438 std::vector<BoundaryInfo> boundaries;
439 if (declared != m_inputKeys.value().end()) {
440 for (const std::string& spec : declared->second) {
441 const auto boundary = parseBoundary(spec);
442 if (boundary.has_value()) {
443 boundaries.push_back(std::move(*boundary));
444 }
445 }
446 }
447
448 for (auto payload = request.inputs.begin(); payload != request.inputs.end();
449 ++payload) {
450 if (payload->key.empty()) {
451 diagnostics = "payload with an empty StoreGate key";
453 }
454
455 if (payload->encoding.empty()) {
456 diagnostics =
457 std::format("payload '{}' carries no encoding", payload->key);
459 }
460
461 if (std::any_of(request.inputs.begin(), payload,
462 [&payload](const Payload& earlier) {
463 return earlier.key == payload->key;
464 })) {
465 diagnostics =
466 std::format("payload '{}' is supplied more than once", payload->key);
468 }
469
470 const auto boundary =
471 std::find_if(boundaries.begin(), boundaries.end(),
472 [&payload](const BoundaryInfo& candidate) {
473 return candidate.key == payload->key;
474 });
475 if (boundary == boundaries.end()) {
476 diagnostics = std::format("sequence '{}' declares no input '{}'",
477 request.sequence, payload->key);
479 }
480
481 if (payload->encoding != boundary->encoding ||
482 payload->schema != boundary->schema) {
483 diagnostics = std::format(
484 "input '{}' arrived as {} [{}] but sequence '{}' declares {} [{}]",
485 payload->key, payload->schema, payload->encoding, request.sequence,
486 boundary->schema, boundary->encoding);
488 }
489 }
490
491 for (const BoundaryInfo& boundary : boundaries) {
492 const auto supplied = std::find_if(
493 request.inputs.begin(), request.inputs.end(),
494 [&boundary](const Payload& p) { return p.key == boundary.key; });
495 if (supplied == request.inputs.end()) {
496 diagnostics = std::format("sequence '{}' requires input '{}'",
497 request.sequence, boundary.key);
499 }
500 }
501
503}

◆ writeHistograms()

StatusCode AthenaHiveEventLoopMgr::writeHistograms ( bool force = false)
protectedvirtualinherited

Dump out histograms as needed.

Definition at line 415 of file AthenaHiveEventLoopMgr.cxx.

415 {
416
417 StatusCode sc (StatusCode::SUCCESS);
418
419 if ( 0 != m_histoPersSvc && m_writeHists ) {
420 std::vector<DataObject*> objects;
421 sc = m_histoDataMgrSvc->traverseTree( [&objects]( IRegistry* reg, int ) {
422 DataObject* obj = reg->object();
423 if ( !obj || obj->clID() == CLID_StatisticsFile ) return false;
424 objects.push_back( obj );
425 return true;
426 } );
427
428 if ( !sc.isSuccess() ) {
429 ATH_MSG_ERROR ( "Error while traversing Histogram data store" );
430 return sc;
431 }
432
433 if ( objects.size() > 0) {
434 int writeInterval(m_writeInterval.value());
435
436 if ( m_nevt == 1 || force ||
437 (writeInterval != 0 && m_nevt%writeInterval == 0) ) {
438
439 // skip /stat entry!
440 sc = std::accumulate( begin( objects ), end( objects ), sc, [&]( StatusCode isc, auto& i ) {
441 IOpaqueAddress* pAddr = nullptr;
442 StatusCode iret = m_histoPersSvc->createRep( i, pAddr );
443 if ( iret.isFailure() ) return iret;
444 i->registry()->setAddress( pAddr );
445 return isc;
446 } );
447 sc = std::accumulate( begin( objects ), end( objects ), sc, [&]( StatusCode isc, auto& i ) {
448 IRegistry* reg = i->registry();
449 StatusCode iret = m_histoPersSvc->fillRepRefs( reg->address(), i );
450 return iret.isFailure() ? iret : isc;
451 } );
452 if ( ! sc.isSuccess() ) {
453 ATH_MSG_ERROR ( "Error while saving Histograms." );
454 }
455 }
456
457 if (force || (writeInterval != 0 && m_nevt%writeInterval == 0) ) {
458 ATH_MSG_DEBUG ( "committing Histograms" );
459 m_histoPersSvc->conversionSvc()->commitOutput("",true).ignore();
460 }
461 }
462
463 }
464
465 return sc;
466}
UnsignedIntegerProperty m_writeInterval
IDataManagerSvc_t m_histoDataMgrSvc
Reference to the Histogram Data Service.

Member Data Documentation

◆ ATLAS_THREAD_SAFE

std::atomic_flag m_initialized AthMessaging::ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
mutableprivateinherited

Messaging initialized (initMessaging).

Definition at line 141 of file AthMessaging.h.

◆ m_abortEventListener

SmartIF< IIncidentListener > AthenaHiveEventLoopMgr::m_abortEventListener
protectedinherited

Instance of the incident listener waiting for AbortEvent.

Definition at line 203 of file AthenaHiveEventLoopMgr.h.

◆ m_address

Gaudi::Property<std::string> AthRemoteExec::RemoteExecHiveEventLoopMgr::m_address
private
Initial value:
{
this, "Address", "0.0.0.0", "Interface the server binds to"}

Definition at line 185 of file RemoteExecHiveEventLoopMgr.h.

185 {
186 this, "Address", "0.0.0.0", "Interface the server binds to"};

◆ m_aess

SmartIF<IAlgExecStateSvc> AthenaHiveEventLoopMgr::m_aess
protectedinherited

Reference to the Algorithm Execution State Svc.

Definition at line 160 of file AthenaHiveEventLoopMgr.h.

◆ m_algResourcePool

SmartIF<IAlgResourcePool> AthenaHiveEventLoopMgr::m_algResourcePool
protectedinherited

Reference to the Algorithm resource pool.

Definition at line 157 of file AthenaHiveEventLoopMgr.h.

◆ m_appMgrProperty

SmartIF<IProperty> AthenaHiveEventLoopMgr::m_appMgrProperty
protectedinherited

Property interface of ApplicationMgr.

Definition at line 163 of file AthenaHiveEventLoopMgr.h.

◆ m_awaitingCompletion

size_t AthRemoteExec::RemoteExecHiveEventLoopMgr::m_awaitingCompletion = 0
private

Definition at line 220 of file RemoteExecHiveEventLoopMgr.h.

◆ m_completed

size_t AthRemoteExec::RemoteExecHiveEventLoopMgr::m_completed = 0
private

Definition at line 209 of file RemoteExecHiveEventLoopMgr.h.

◆ m_conditionsCleaner

ServiceHandle<Athena::IConditionsCleanerSvc> AthenaHiveEventLoopMgr::m_conditionsCleaner
privateinherited

Definition at line 297 of file AthenaHiveEventLoopMgr.h.

◆ m_currentRun

number_type AthenaHiveEventLoopMgr::m_currentRun
protectedinherited

current run number

Definition at line 109 of file AthenaHiveEventLoopMgr.h.

◆ m_doEvtHeartbeat

bool AthenaHiveEventLoopMgr::m_doEvtHeartbeat
protectedinherited

Definition at line 278 of file AthenaHiveEventLoopMgr.h.

◆ m_eventPrintoutInterval

UnsignedIntegerProperty AthenaHiveEventLoopMgr::m_eventPrintoutInterval
protectedinherited

Definition at line 116 of file AthenaHiveEventLoopMgr.h.

◆ m_eventStore

StoreGateSvc_t AthenaHiveEventLoopMgr::m_eventStore
protectedinherited

Reference to StoreGateSvc;.

Property

Definition at line 83 of file AthenaHiveEventLoopMgr.h.

◆ m_evtContext

EvtContext* AthenaHiveEventLoopMgr::m_evtContext
protectedinherited

Gaudi event selector Context (may be used as a cursor by the evt selector).

Definition at line 88 of file AthenaHiveEventLoopMgr.h.

◆ m_evtIdModSvc

IEvtIdModifierSvc_t AthenaHiveEventLoopMgr::m_evtIdModSvc
protectedinherited

Definition at line 102 of file AthenaHiveEventLoopMgr.h.

◆ m_evtsel

StringProperty AthenaHiveEventLoopMgr::m_evtsel
protectedinherited

Definition at line 90 of file AthenaHiveEventLoopMgr.h.

◆ m_evtSelector

IEvtSelector* AthenaHiveEventLoopMgr::m_evtSelector
protectedinherited

Reference to the Event Selector.

Definition at line 86 of file AthenaHiveEventLoopMgr.h.

◆ m_failureMode

IntegerProperty AthenaHiveEventLoopMgr::m_failureMode
protectedinherited

Definition at line 113 of file AthenaHiveEventLoopMgr.h.

◆ m_finishedEvents

std::deque<Finished> AthRemoteExec::RemoteExecHiveEventLoopMgr::m_finishedEvents
private

Definition at line 219 of file RemoteExecHiveEventLoopMgr.h.

◆ m_firstEventAlone

bool AthenaHiveEventLoopMgr::m_firstEventAlone
privateinherited

Definition at line 285 of file AthenaHiveEventLoopMgr.h.

◆ m_firstRun

bool AthenaHiveEventLoopMgr::m_firstRun
protectedinherited

Definition at line 110 of file AthenaHiveEventLoopMgr.h.

◆ m_flmbi

unsigned int AthenaHiveEventLoopMgr::m_flmbi
privateinherited

Definition at line 287 of file AthenaHiveEventLoopMgr.h.

◆ m_helpersStopping

bool AthRemoteExec::RemoteExecHiveEventLoopMgr::m_helpersStopping = false
private

Definition at line 222 of file RemoteExecHiveEventLoopMgr.h.

◆ m_histoDataMgrSvc

IDataManagerSvc_t AthenaHiveEventLoopMgr::m_histoDataMgrSvc
protectedinherited

Reference to the Histogram Data Service.

Definition at line 94 of file AthenaHiveEventLoopMgr.h.

◆ m_histoPersSvc

IConversionSvc_t AthenaHiveEventLoopMgr::m_histoPersSvc
protectedinherited

Definition at line 98 of file AthenaHiveEventLoopMgr.h.

◆ m_histPersName

StringProperty AthenaHiveEventLoopMgr::m_histPersName
protectedinherited

Definition at line 105 of file AthenaHiveEventLoopMgr.h.

◆ m_imsg

std::atomic<IMessageSvc*> AthMessaging::m_imsg { nullptr }
mutableprivateinherited

MessageSvc pointer.

Definition at line 135 of file AthMessaging.h.

135{ nullptr };

◆ m_incidentSvc

IIncidentSvc_t AthenaHiveEventLoopMgr::m_incidentSvc
protectedinherited

Reference to the incident service.

Definition at line 79 of file AthenaHiveEventLoopMgr.h.

◆ m_incoming

std::deque<std::unique_ptr<Server::Job> > AthRemoteExec::RemoteExecHiveEventLoopMgr::m_incoming
private

Definition at line 217 of file RemoteExecHiveEventLoopMgr.h.

◆ m_incomingLimit

size_t AthRemoteExec::RemoteExecHiveEventLoopMgr::m_incomingLimit = 1
private

Definition at line 218 of file RemoteExecHiveEventLoopMgr.h.

◆ m_incomingRoom

std::condition_variable AthRemoteExec::RemoteExecHiveEventLoopMgr::m_incomingRoom
private

input thread waits here

Definition at line 216 of file RemoteExecHiveEventLoopMgr.h.

◆ m_inFlight

std::map<size_t, InFlight> AthRemoteExec::RemoteExecHiveEventLoopMgr::m_inFlight
private

keyed by whiteboard slot

Definition at line 207 of file RemoteExecHiveEventLoopMgr.h.

◆ m_inFlightCv

std::condition_variable AthRemoteExec::RemoteExecHiveEventLoopMgr::m_inFlightCv
private

output thread waits here

Definition at line 215 of file RemoteExecHiveEventLoopMgr.h.

◆ m_inputDone

bool AthRemoteExec::RemoteExecHiveEventLoopMgr::m_inputDone = false
private

Definition at line 221 of file RemoteExecHiveEventLoopMgr.h.

◆ m_inputKeys

Gaudi::Property<std::map<std::string, std::vector<std::string> > > AthRemoteExec::RemoteExecHiveEventLoopMgr::m_inputKeys
private
Initial value:
{
this, "Decoders", {}, "Per sequence, The boundaries the client must supply."}

Definition at line 176 of file RemoteExecHiveEventLoopMgr.h.

176 {
177 this, "Decoders", {}, "Per sequence, The boundaries the client must supply."};

◆ m_inputThread

std::thread AthRemoteExec::RemoteExecHiveEventLoopMgr::m_inputThread
private

Definition at line 211 of file RemoteExecHiveEventLoopMgr.h.

◆ m_lastEventContext

EventContext AthenaHiveEventLoopMgr::m_lastEventContext
protectedinherited

Definition at line 282 of file AthenaHiveEventLoopMgr.h.

◆ m_lvl

std::atomic<MSG::Level> AthMessaging::m_lvl { MSG::NIL }
mutableprivateinherited

Current logging level.

Definition at line 138 of file AthMessaging.h.

138{ MSG::NIL };

◆ m_maxMessageBytes

Gaudi::Property<int> AthRemoteExec::RemoteExecHiveEventLoopMgr::m_maxMessageBytes
private
Initial value:
{
this, "MaxMessageBytes", 256 * 1024 * 1024, "Largest request or reply the server will accept."}

Definition at line 191 of file RemoteExecHiveEventLoopMgr.h.

191 {
192 this, "MaxMessageBytes", 256 * 1024 * 1024, "Largest request or reply the server will accept."};

◆ m_messageMutex

std::mutex AthRemoteExec::RemoteExecHiveEventLoopMgr::m_messageMutex
private

Definition at line 224 of file RemoteExecHiveEventLoopMgr.h.

◆ m_msg_tls

boost::thread_specific_ptr<MsgStream> AthMessaging::m_msg_tls
mutableprivateinherited

MsgStream instance (a std::cout like with print-out levels).

Definition at line 132 of file AthMessaging.h.

◆ m_nev

unsigned int AthenaHiveEventLoopMgr::m_nev
protectedinherited

events processed

Definition at line 275 of file AthenaHiveEventLoopMgr.h.

◆ m_nevt

unsigned int AthenaHiveEventLoopMgr::m_nevt
privateinherited

Definition at line 264 of file AthenaHiveEventLoopMgr.h.

◆ m_nextEvent

size_t AthRemoteExec::RemoteExecHiveEventLoopMgr::m_nextEvent = 0
private

Definition at line 208 of file RemoteExecHiveEventLoopMgr.h.

◆ m_nm

std::string AthMessaging::m_nm
privateinherited

Message source name.

Definition at line 129 of file AthMessaging.h.

◆ m_outputKeys

Gaudi::Property<std::map<std::string, std::vector<std::string> > > AthRemoteExec::RemoteExecHiveEventLoopMgr::m_outputKeys
private
Initial value:
{
this, "Encoders", {}, "Per sequence, the boundaries returned to the client."}

Definition at line 178 of file RemoteExecHiveEventLoopMgr.h.

178 {
179 this, "Encoders", {}, "Per sequence, the boundaries returned to the client."};

◆ m_outputThread

std::thread AthRemoteExec::RemoteExecHiveEventLoopMgr::m_outputThread
private

Definition at line 212 of file RemoteExecHiveEventLoopMgr.h.

◆ m_pending

std::condition_variable AthRemoteExec::RemoteExecHiveEventLoopMgr::m_pending
private

loop waits here

Definition at line 214 of file RemoteExecHiveEventLoopMgr.h.

◆ m_pendingMutex

std::mutex AthRemoteExec::RemoteExecHiveEventLoopMgr::m_pendingMutex
private

Definition at line 213 of file RemoteExecHiveEventLoopMgr.h.

◆ m_pollInterval

Gaudi::Property<unsigned int> AthRemoteExec::RemoteExecHiveEventLoopMgr::m_pollInterval
private
Initial value:
{
this, "PollInterval", 5, "Milliseconds between scheduler polls."}

Definition at line 198 of file RemoteExecHiveEventLoopMgr.h.

198 {
199 this, "PollInterval", 5, "Milliseconds between scheduler polls."};

◆ m_port

Gaudi::Property<int> AthRemoteExec::RemoteExecHiveEventLoopMgr::m_port
private
Initial value:
{
this, "Port", 0, "TCP port to bind. 0 lets the OS choose."}

Definition at line 187 of file RemoteExecHiveEventLoopMgr.h.

187 {
188 this, "Port", 0, "TCP port to bind. 0 lets the OS choose."};

◆ m_portFile

Gaudi::Property<std::string> AthRemoteExec::RemoteExecHiveEventLoopMgr::m_portFile
private
Initial value:
{
this, "PortFile", "", "If set, the bound port is written to this file once the server is up. Lets a test client discover a port chosen by the OS"}

Definition at line 189 of file RemoteExecHiveEventLoopMgr.h.

189 {
190 this, "PortFile", "", "If set, the bound port is written to this file once the server is up. Lets a test client discover a port chosen by the OS"};

◆ m_proc

unsigned int AthenaHiveEventLoopMgr::m_proc
protectedinherited

Definition at line 276 of file AthenaHiveEventLoopMgr.h.

◆ m_queueLimit

Gaudi::Property<size_t> AthRemoteExec::RemoteExecHiveEventLoopMgr::m_queueLimit
private
Initial value:
{
this, "QueueLimit", 128, "Maximum number of queued requests before clients are told the server is overloaded"}

Definition at line 193 of file RemoteExecHiveEventLoopMgr.h.

193 {
194 this, "QueueLimit", 128, "Maximum number of queued requests before clients are told the server is overloaded"};

◆ m_replyKeys

Gaudi::Property<std::map<std::string, std::string> > AthRemoteExec::RemoteExecHiveEventLoopMgr::m_replyKeys
private
Initial value:
{
this, "ReplyKeys", {}, "Per sequence, the key its pack algorithm stages the reply under."}

Definition at line 180 of file RemoteExecHiveEventLoopMgr.h.

180 {
181 this, "ReplyKeys", {}, "Per sequence, the key its pack algorithm stages the reply under."};

◆ m_reportTiming

Gaudi::Property<bool> AthRemoteExec::RemoteExecHiveEventLoopMgr::m_reportTiming
private
Initial value:
{
this, "ReportTiming", true, ""}

Definition at line 201 of file RemoteExecHiveEventLoopMgr.h.

201 {
202 this, "ReportTiming", true, ""};

◆ m_requestKey

Gaudi::Property<std::string> AthRemoteExec::RemoteExecHiveEventLoopMgr::m_requestKey
private
Initial value:
{
this, "RequestKey", "RemoteExecRequest", "StoreGate key that the request is recorded under."}

Definition at line 182 of file RemoteExecHiveEventLoopMgr.h.

182 {
183 this, "RequestKey", "RemoteExecRequest", "StoreGate key that the request is recorded under."};

◆ m_requestTimeout

Gaudi::Property<double> AthRemoteExec::RemoteExecHiveEventLoopMgr::m_requestTimeout
private
Initial value:
{
this, "RequestTimeout", 0.0, "Seconds before an in-flight request is answered with TIMEOUT. 0 disables the timeout."}

Definition at line 196 of file RemoteExecHiveEventLoopMgr.h.

196 {
197 this, "RequestTimeout", 0.0, "Seconds before an in-flight request is answered with TIMEOUT. 0 disables the timeout."};

◆ m_requireInputAttributeList

bool AthenaHiveEventLoopMgr::m_requireInputAttributeList {}
protectedinherited

require input attribute list

Definition at line 134 of file AthenaHiveEventLoopMgr.h.

134{};

◆ m_scheduledStop

bool AthenaHiveEventLoopMgr::m_scheduledStop
protectedinherited

Scheduled stop of event processing.

Definition at line 209 of file AthenaHiveEventLoopMgr.h.

◆ m_schedulerName

std::string AthenaHiveEventLoopMgr::m_schedulerName
protectedinherited

Name of the scheduler to be used.

Definition at line 205 of file AthenaHiveEventLoopMgr.h.

◆ m_schedulerSvc

SmartIF<IScheduler> AthenaHiveEventLoopMgr::m_schedulerSvc
protectedinherited

A shortcut for the scheduler.

Definition at line 166 of file AthenaHiveEventLoopMgr.h.

◆ m_sequences

Gaudi::Property<std::vector<std::string> > AthRemoteExec::RemoteExecHiveEventLoopMgr::m_sequences
private
Initial value:
{
this, "Sequences", {}, "Names of the algorithm sequences (fragments) this server offers"}

Definition at line 174 of file RemoteExecHiveEventLoopMgr.h.

174 {
175 this, "Sequences", {}, "Names of the algorithm sequences (fragments) this server offers"};

◆ m_server

std::unique_ptr<Server> AthRemoteExec::RemoteExecHiveEventLoopMgr::m_server
private

Definition at line 206 of file RemoteExecHiveEventLoopMgr.h.

◆ m_stopRequested

std::atomic<bool> AthRemoteExec::RemoteExecHiveEventLoopMgr::m_stopRequested {false}
private

Definition at line 225 of file RemoteExecHiveEventLoopMgr.h.

225{false};

◆ m_terminateLoop

bool AthenaHiveEventLoopMgr::m_terminateLoop { false }
protectedinherited

Definition at line 273 of file AthenaHiveEventLoopMgr.h.

273{ false };

◆ m_timeStamp

unsigned int AthenaHiveEventLoopMgr::m_timeStamp { 0 }
privateinherited

Definition at line 265 of file AthenaHiveEventLoopMgr.h.

265{ 0 };

◆ m_timeStampInt

unsigned int AthenaHiveEventLoopMgr::m_timeStampInt
privateinherited

Definition at line 287 of file AthenaHiveEventLoopMgr.h.

◆ m_toolAccept

tool_stats AthenaHiveEventLoopMgr::m_toolAccept
protectedinherited

tool returns StatusCode::SUCCESS counter

Definition at line 127 of file AthenaHiveEventLoopMgr.h.

◆ m_toolInvoke

tool_stats AthenaHiveEventLoopMgr::m_toolInvoke
protectedinherited

tool called counter

Definition at line 125 of file AthenaHiveEventLoopMgr.h.

◆ m_toolReject

tool_stats AthenaHiveEventLoopMgr::m_toolReject
protectedinherited

tool returns StatusCode::FAILURE counter

Definition at line 126 of file AthenaHiveEventLoopMgr.h.

◆ m_tools

tool_store AthenaHiveEventLoopMgr::m_tools
protectedinherited

internal tool store

Definition at line 128 of file AthenaHiveEventLoopMgr.h.

◆ m_useSecondaryEventNumber

bool AthenaHiveEventLoopMgr::m_useSecondaryEventNumber {}
protectedinherited

read event number from secondary input

Definition at line 137 of file AthenaHiveEventLoopMgr.h.

137{};

◆ m_useTools

bool AthenaHiveEventLoopMgr::m_useTools
protectedinherited

Definition at line 277 of file AthenaHiveEventLoopMgr.h.

◆ m_whiteboard

SmartIF<IHiveWhiteBoard> AthenaHiveEventLoopMgr::m_whiteboard
protectedinherited

Reference to the Whiteboard interface.

Definition at line 154 of file AthenaHiveEventLoopMgr.h.

◆ m_whiteboardName

std::string AthenaHiveEventLoopMgr::m_whiteboardName
protectedinherited

Name of the Whiteboard to be used.

Definition at line 207 of file AthenaHiveEventLoopMgr.h.

◆ m_writeHists

bool AthenaHiveEventLoopMgr::m_writeHists
privateinherited

Definition at line 268 of file AthenaHiveEventLoopMgr.h.

◆ m_writeInterval

UnsignedIntegerProperty AthenaHiveEventLoopMgr::m_writeInterval
privateinherited

Definition at line 267 of file AthenaHiveEventLoopMgr.h.


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