The Gaudi Framework  master (ff829712)
Loading...
Searching...
No Matches
AlgExecStateSvc Class Reference

A service that keeps track of the execution state of Algorithm. More...

#include </builds/gaudi/Gaudi/GaudiCoreSvc/src/AlgExecStateSvc/AlgExecStateSvc.h>

Inheritance diagram for AlgExecStateSvc:
Collaboration diagram for AlgExecStateSvc:

Classes

class  AlgExecStateInternal
 internal state of an algorithm More...
 

Public Member Functions

AlgExecStateRef algExecState (const IAlgorithm *iAlg, const EventContext &ctx) override
 
AlgExecStateRef algExecState (const std::string &algName, const EventContext &ctx) override
 
AlgExecStateRefConst algExecState (const IAlgorithm *iAlg, const EventContext &ctx) const override
 
AlgExecStateRefConst algExecState (const std::string &algName, const EventContext &ctx) const override
 
void reset (const EventContext &ctx) override
 
AlgExecStateRef::AlgKey addAlg (const Gaudi::StringKey &) override
 
const EventStatus::StatuseventStatus (const EventContext &ctx) const override
 
void setEventStatus (const EventStatus::Status &sc, const EventContext &ctx) override
 
void updateEventStatus (const bool &b, const EventContext &ctx) override
 
unsigned int algErrorCount (const IAlgorithm *iAlg) const override
 
void resetErrorCount () override
 
void resetErrorCount (const IAlgorithm *iAlg) override
 
unsigned int incrementErrorCount (const IAlgorithm *iAlg) override
 
void dump (std::ostream &ost, const EventContext &ctx) const override
 
void dump (std::ostream &, const EventContext &, AlgExecStateRef::AlgKey) const override
 
AlgExecStateRef::AlgKey addAlg (const IAlgorithm *iAlg)
 
- Public Member Functions inherited from extends< Service, IAlgExecStateSvc >
void const * i_cast (const InterfaceID &tid) const override
 Implementation of IInterface::i_cast.
 
StatusCode queryInterface (const InterfaceID &ti, void **pp) override
 Implementation of IInterface::queryInterface.
 
std::vector< std::string > getInterfaceNames () const override
 Implementation of IInterface::getInterfaceNames.
 
- Public Member Functions inherited from Service
const std::string & name () const override
 Retrieve name of the service.
 
StatusCode configure () override
 
StatusCode initialize () override
 
StatusCode start () override
 
StatusCode stop () override
 
StatusCode finalize () override
 
StatusCode terminate () override
 
Gaudi::StateMachine::State FSMState () const override
 
Gaudi::StateMachine::State targetFSMState () const override
 
StatusCode reinitialize () override
 
StatusCode restart () override
 
StatusCode sysInitialize () override
 Initialize Service.
 
StatusCode sysStart () override
 Initialize Service.
 
StatusCode sysStop () override
 Initialize Service.
 
StatusCode sysFinalize () override
 Finalize Service.
 
StatusCode sysReinitialize () override
 Re-initialize the Service.
 
StatusCode sysRestart () override
 Re-initialize the Service.
 
 Service (std::string name, ISvcLocator *svcloc)
 Standard Constructor.
 
SmartIF< ISvcLocator > & serviceLocator () const override
 Retrieve pointer to service locator.
 
template<typename IFace = IService>
SmartIF< IFace > service (const std::string &name, bool createIf=true) const
 
template<class T>
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, ToolHandle< T > &hndl, const std::string &doc="none")
 
template<class T>
StatusCode declareTool (ToolHandle< T > &handle, bool createIf=true)
 
template<class T>
StatusCode declareTool (ToolHandle< T > &handle, const std::string &toolTypeAndName, bool createIf=true)
 Declare used tool.
 
template<class T>
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, ToolHandleArray< T > &hndlArr, const std::string &doc="none")
 
template<class T>
void addToolsArray (ToolHandleArray< T > &hndlArr)
 
const std::vector< IAlgTool * > & tools () const
 
SmartIF< IAuditorSvc > & auditorSvc () const
 The standard auditor service.May not be invoked before sysInitialize() has been invoked.
 
- Public Member Functions inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
StatusCode setProperty (const Gaudi::Details::PropertyBase &p)
 Set the property from a property.
 
StatusCode setProperty (const std::string &name, const char *v)
 Special case for string literals.
 
StatusCode setProperty (const std::string &name, const std::string &v)
 Special case for std::string.
 
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value
 
 PropertyHolder ()=default
 
Gaudi::Details::PropertyBasedeclareProperty (Gaudi::Details::PropertyBase &prop)
 Declare a property.
 
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, TYPE &value, const std::string &doc="none")
 Helper to wrap a regular data member and use it as a regular property.
 
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, Gaudi::Property< TYPE, VERIFIER, HANDLERS > &prop, const std::string &doc="none")
 Declare a PropertyBase instance setting name and documentation.
 
Gaudi::Details::PropertyBasedeclareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="")
 Declare a remote property.
 
StatusCode setProperty (const std::string &name, const Gaudi::Details::PropertyBase &p) override
 set the property from another property with a different name
 
StatusCode setProperty (const std::string &s) override
 set the property from the formatted string
 
StatusCode setProperty (const Gaudi::Details::PropertyBase &p)
 Set the property from a property.
 
StatusCode setProperty (const std::string &name, const char *v)
 Special case for string literals.
 
StatusCode setProperty (const std::string &name, const std::string &v)
 Special case for std::string.
 
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value
 
StatusCode setPropertyRepr (const std::string &n, const std::string &r) override
 set the property from name and value string representation
 
StatusCode getProperty (Gaudi::Details::PropertyBase *p) const override
 get the property
 
const Gaudi::Details::PropertyBasegetProperty (std::string_view name) const override
 get the property by name
 
StatusCode getProperty (std::string_view n, std::string &v) const override
 convert the property to the string
 
const std::vector< Gaudi::Details::PropertyBase * > & getProperties () const override
 get all properties
 
bool hasProperty (std::string_view name) const override
 Return true if we have a property with the given name.
 
Gaudi::Details::PropertyBaseproperty (std::string_view name) const
 \fixme property and bindPropertiesTo should be protected
 
void bindPropertiesTo (Gaudi::Interfaces::IOptionsSvc &optsSvc)
 
 PropertyHolder (const PropertyHolder &)=delete
 
PropertyHolderoperator= (const PropertyHolder &)=delete
 
- Public Member Functions inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
MSG::Level msgLevel () const
 get the cached level (originally extracted from the embedded MsgStream)
 
bool msgLevel (MSG::Level lvl) const
 get the output level from the embedded MsgStream
 
- Public Member Functions inherited from CommonMessagingBase
virtual ~CommonMessagingBase ()=default
 Virtual destructor.
 
const SmartIF< IMessageSvc > & msgSvc () const
 The standard message service.
 
MsgStreammsgStream () const
 Return an uninitialized MsgStream.
 
MsgStreammsgStream (const MSG::Level level) const
 Predefined configurable message stream for the efficient printouts.
 
MsgStreamalways () const
 shortcut for the method msgStream(MSG::ALWAYS)
 
MsgStreamfatal () const
 shortcut for the method msgStream(MSG::FATAL)
 
MsgStreamerr () const
 shortcut for the method msgStream(MSG::ERROR)
 
MsgStreamerror () const
 shortcut for the method msgStream(MSG::ERROR)
 
MsgStreamwarning () const
 shortcut for the method msgStream(MSG::WARNING)
 
MsgStreaminfo () const
 shortcut for the method msgStream(MSG::INFO)
 
MsgStreamdebug () const
 shortcut for the method msgStream(MSG::DEBUG)
 
MsgStreamverbose () const
 shortcut for the method msgStream(MSG::VERBOSE)
 
MsgStreammsg () const
 shortcut for the method msgStream(MSG::INFO)
 

Private Types

using AlgStates = std::vector<AlgExecStateInternal>
 
using AlgStatesWithSubSlot = std::unordered_map<AlgExecStateRef::AlgKey, AlgExecStateInternal>
 

Private Member Functions

bool filterPassed (const EventContext &, AlgExecStateRef::AlgKey) const override
 
void setFilterPassed (const EventContext &, AlgExecStateRef::AlgKey, bool) override
 
AlgExecStateRef::State state (const EventContext &, AlgExecStateRef::AlgKey) const override
 
void setState (const EventContext &, AlgExecStateRef::AlgKey, AlgExecStateRef::State) override
 
void setState (const EventContext &, AlgExecStateRef::AlgKey, AlgExecStateRef::State, const StatusCode &) override
 
const StatusCodeexecStatus (const EventContext &, AlgExecStateRef::AlgKey) const override
 
void setExecStatus (const EventContext &, AlgExecStateRef::AlgKey, const StatusCode &) override
 
const std::string & algName (AlgExecStateRef::AlgKey) const override
 
AlgExecStateInternalgetInternalState (const EventContext &ctx, AlgExecStateRef::AlgKey k)
 
AlgExecStateInternal const & getInternalState (const EventContext &ctx, AlgExecStateRef::AlgKey k) const
 
AlgExecStateRef::AlgKey algKey (const std::string &algName) const
 
void init ()
 
void checkInit () const
 

Private Attributes

std::vector< AlgStatesm_algStates
 
std::vector< std::vector< AlgStatesWithSubSlot > > m_algSubSlotStates
 
std::unordered_map< Gaudi::StringKey, AlgExecStateRef::AlgKey, Gaudi::StringKeyHash, std::equal_to<> > m_algNameToIndex
 
std::vector< EventStatus::Statusm_eventStatus
 
std::vector< Gaudi::StringKeym_preInitAlgs
 
std::vector< std::string > m_algNames
 
std::unordered_map< AlgExecStateRef::AlgKey, std::atomic< unsigned int > > m_errorCount
 
std::once_flag m_initFlag
 
bool m_isInit { false }
 
std::mutex m_mut
 

Additional Inherited Members

- Public Types inherited from extends< Service, IAlgExecStateSvc >
using base_class
 Typedef to this class.
 
using extend_interfaces_base
 Typedef to the base of this class.
 
- Public Types inherited from Service
using Factory = Gaudi::PluginService::Factory<IService*( const std::string&, ISvcLocator* )>
 
- Public Types inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
using PropertyHolderImpl
 Typedef used to refer to this class from derived classes, as in.
 
- Public Types inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
using base_class
 
- Public Types inherited from extend_interfaces< Interfaces... >
using ext_iids
 take union of the ext_iids of all Interfaces...
 
- Protected Member Functions inherited from Service
std::vector< IAlgTool * > & tools ()
 
 ~Service () override
 
int outputLevel () const
 get the Service's output level
 
- Protected Member Functions inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
MSG::Level setUpMessaging () const
 Set up local caches.
 
MSG::Level resetMessaging ()
 Reinitialize internal states.
 
void updateMsgStreamOutputLevel (int level)
 Update the output level of the cached MsgStream.
 
- Protected Attributes inherited from Service
Gaudi::StateMachine::State m_state = Gaudi::StateMachine::OFFLINE
 Service state.
 
Gaudi::StateMachine::State m_targetState = Gaudi::StateMachine::OFFLINE
 Service state.
 
Gaudi::Property< int > m_outputLevel { this, "OutputLevel", MSG::NIL, "output level" }
 flag indicating whether ToolHandle tools have been added to m_tools
 
Gaudi::Property< bool > m_auditorInitialize { this, "AuditInitialize", false, "trigger auditor on initialize()" }
 
Gaudi::Property< bool > m_auditorStart { this, "AuditStart", false, "trigger auditor on start()" }
 
Gaudi::Property< bool > m_auditorStop { this, "AuditStop", false, "trigger auditor on stop()" }
 
Gaudi::Property< bool > m_auditorFinalize { this, "AuditFinalize", false, "trigger auditor on finalize()" }
 
Gaudi::Property< bool > m_auditorReinitialize { this, "AuditReinitialize", false, "trigger auditor on reinitialize()" }
 
Gaudi::Property< bool > m_auditorRestart { this, "AuditRestart", false, "trigger auditor on restart()" }
 
Gaudi::Property< bool > m_autoRetrieveTools
 
Gaudi::Property< bool > m_checkToolDeps
 
SmartIF< IAuditorSvcm_pAuditorSvc
 Auditor Service.
 

Detailed Description

A service that keeps track of the execution state of Algorithm.

Definition at line 27 of file AlgExecStateSvc.h.

Member Typedef Documentation

◆ AlgStates

using AlgExecStateSvc::AlgStates = std::vector<AlgExecStateInternal>
private

Definition at line 64 of file AlgExecStateSvc.h.

◆ AlgStatesWithSubSlot

Definition at line 65 of file AlgExecStateSvc.h.

Member Function Documentation

◆ addAlg() [1/2]

AlgExecStateRef::AlgKey AlgExecStateSvc::addAlg ( const Gaudi::StringKey & alg)
override

Definition at line 42 of file AlgExecStateSvc.cpp.

42 {
43 if ( !m_isInit ) {
44 if ( msgLevel( MSG::DEBUG ) ) debug() << "preInit: will add Alg " << alg.str() << " later" << endmsg;
45 auto it = std::find( begin( m_preInitAlgs ), end( m_preInitAlgs ), alg );
46 if ( it == m_preInitAlgs.end() ) {
47 m_preInitAlgs.push_back( alg );
48 return static_cast<AlgExecStateRef::AlgKey>( m_preInitAlgs.size() - 1 );
49 } else {
50 return static_cast<AlgExecStateRef::AlgKey>( std::distance( begin( m_preInitAlgs ), it ) );
51 }
52 }
53 // try to create default state for first slot and retrieve the key
54 auto [it, b] =
55 m_algNameToIndex.try_emplace( alg, static_cast<AlgExecStateRef::AlgKey>( m_algStates.front().size() ) );
56 if ( b ) {
57 // create default state for all slots
58 for ( auto& a : m_algStates ) a.emplace_back();
59 m_errorCount.emplace( it->second, 0 );
60 m_algNames.push_back( alg );
61 if ( msgLevel( MSG::DEBUG ) )
62 debug() << "adding alg " << alg.str() << " to " << m_algStates.size() << " slots" << endmsg;
63 }
64 return it->second;
65}
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition MsgStream.h:198
std::vector< std::string > m_algNames
std::unordered_map< AlgExecStateRef::AlgKey, std::atomic< unsigned int > > m_errorCount
std::vector< Gaudi::StringKey > m_preInitAlgs
std::vector< AlgStates > m_algStates
std::unordered_map< Gaudi::StringKey, AlgExecStateRef::AlgKey, Gaudi::StringKeyHash, std::equal_to<> > m_algNameToIndex
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
AttribStringParser::Iterator begin(const AttribStringParser &parser)
@ DEBUG
Definition IMessageSvc.h:22

◆ addAlg() [2/2]

AlgExecStateRef::AlgKey IAlgExecStateSvc::addAlg ( const IAlgorithm * iAlg)
inline

Definition at line 120 of file IAlgExecStateSvc.h.

120{ return addAlg( iAlg->nameKey() ); }
AlgExecStateRef::AlgKey addAlg(const Gaudi::StringKey &) override
virtual const Gaudi::StringKey & nameKey() const =0
StringKey rep of name.

◆ algErrorCount()

unsigned int AlgExecStateSvc::algErrorCount ( const IAlgorithm * iAlg) const
override

Definition at line 139 of file AlgExecStateSvc.cpp.

139 {
140 assert( m_isInit );
141 return m_errorCount.at( algKey( iAlg->name() ) );
142}
AlgExecStateRef::AlgKey algKey(const std::string &algName) const

◆ algExecState() [1/4]

AlgExecStateRefConst AlgExecStateSvc::algExecState ( const IAlgorithm * iAlg,
const EventContext & ctx ) const
inlineoverride

Definition at line 76 of file AlgExecStateSvc.h.

76 {
77 return { *this, ctx, algKey( iAlg->name() ) };
78 }

◆ algExecState() [2/4]

AlgExecStateRef AlgExecStateSvc::algExecState ( const IAlgorithm * iAlg,
const EventContext & ctx )
inlineoverride

Definition at line 70 of file AlgExecStateSvc.h.

70 {
71 return { *this, ctx, algKey( iAlg->name() ) };
72 }

◆ algExecState() [3/4]

AlgExecStateRefConst AlgExecStateSvc::algExecState ( const std::string & algName,
const EventContext & ctx ) const
inlineoverride

Definition at line 79 of file AlgExecStateSvc.h.

79 {
80 return { *this, ctx, algKey( algName ) };
81 }
const std::string & algName(AlgExecStateRef::AlgKey) const override

◆ algExecState() [4/4]

AlgExecStateRef AlgExecStateSvc::algExecState ( const std::string & algName,
const EventContext & ctx )
inlineoverride

Definition at line 73 of file AlgExecStateSvc.h.

73 {
74 return { *this, ctx, algKey( algName ) };
75 }

◆ algKey()

AlgExecStateRef::AlgKey AlgExecStateSvc::algKey ( const std::string & algName) const
inlineprivate

Definition at line 111 of file AlgExecStateSvc.h.

111{ return m_algNameToIndex.at( algName ); }

◆ algName()

const std::string & AlgExecStateSvc::algName ( AlgExecStateRef::AlgKey k) const
overrideprivate

Definition at line 184 of file AlgExecStateSvc.cpp.

184 {
185 assert( m_isInit );
186 return m_algNames[static_cast<size_t>( k )];
187}

◆ checkInit()

void AlgExecStateSvc::checkInit ( ) const
private

◆ dump() [1/2]

void AlgExecStateSvc::dump ( std::ostream & ost,
const EventContext & ctx,
AlgExecStateRef::AlgKey k ) const
override

Definition at line 199 of file AlgExecStateSvc.cpp.

199 {
200 ost << getInternalState( ctx, k );
201}
AlgExecStateInternal & getInternalState(const EventContext &ctx, AlgExecStateRef::AlgKey k)

◆ dump() [2/2]

void AlgExecStateSvc::dump ( std::ostream & ost,
const EventContext & ctx ) const
override

Definition at line 189 of file AlgExecStateSvc.cpp.

189 {
190 const size_t slotID = ctx.valid() ? ctx.slot() : 0;
191 ost << " [slot: " << slotID << ", incident: " << m_eventStatus.at( slotID ) << "]:\n\n";
192 auto& algState = m_algStates.at( slotID );
193 auto ml = std::accumulate( begin( m_algNames ), end( m_algNames ), size_t{ 0 },
194 []( size_t m, const auto& as ) { return std::max( m, as.length() ); } );
195 for ( size_t k = 0; const auto& e : algState )
196 ost << " + " << std::setw( ml ) << algName( static_cast<AlgExecStateRef::AlgKey>( k++ ) ) << " " << e << '\n';
197}
std::vector< EventStatus::Status > m_eventStatus
constexpr double m

◆ eventStatus()

const EventStatus::Status & AlgExecStateSvc::eventStatus ( const EventContext & ctx) const
override

Definition at line 119 of file AlgExecStateSvc.cpp.

119 {
120 assert( m_isInit );
121 return m_eventStatus.at( ctx.slot() );
122}

◆ execStatus()

const StatusCode & AlgExecStateSvc::execStatus ( const EventContext & ctx,
AlgExecStateRef::AlgKey k ) const
overrideprivate

Definition at line 176 of file AlgExecStateSvc.cpp.

176 {
177 assert( m_isInit );
178 return getInternalState( ctx, k ).execStatus();
179}
const StatusCode & execStatus() const

◆ filterPassed()

bool AlgExecStateSvc::filterPassed ( const EventContext & ctx,
AlgExecStateRef::AlgKey k ) const
overrideprivate

Definition at line 155 of file AlgExecStateSvc.cpp.

155 {
156 assert( m_isInit );
157 return getInternalState( ctx, k ).filterPassed();
158}

◆ getInternalState() [1/2]

AlgExecStateSvc::AlgExecStateInternal & AlgExecStateSvc::getInternalState ( const EventContext & ctx,
AlgExecStateRef::AlgKey k )
private

Definition at line 67 of file AlgExecStateSvc.cpp.

68 {
69 std::call_once( m_initFlag, &AlgExecStateSvc::init, this );
70 // Sub-slots are dynamic
71 // Assuming the alg is known, look for a subslot
72 // Return the existing state, or create a new one
73 if ( ctx.usesSubSlot() ) {
74 // Use mutex since dynamic
75 std::scoped_lock lock( m_mut );
76
77 // Check that there is any sub-slot information for this slot
78 if ( ctx.slot() >= m_algSubSlotStates.size() ) m_algSubSlotStates.resize( ctx.slot() + 1 );
79
80 // Check that there is information for this sub-slot
81 auto& subSlots = m_algSubSlotStates[ctx.slot()];
82 if ( ctx.subSlot() >= subSlots.size() ) subSlots.resize( ctx.subSlot() + 1 );
83
84 // Find (and potentially extend) the AlgStates
85 return subSlots[ctx.subSlot()].try_emplace( k ).first->second;
86 }
87 // regular case with no subslot
88 assert( ctx.slot() < m_algStates.size() );
89 assert( static_cast<size_t>( k ) < m_algStates.at( ctx.slot() ).size() );
90 return m_algStates.at( ctx.slot() )[static_cast<size_t>( k )];
91}
std::vector< std::vector< AlgStatesWithSubSlot > > m_algSubSlotStates
std::once_flag m_initFlag

◆ getInternalState() [2/2]

AlgExecStateSvc::AlgExecStateInternal const & AlgExecStateSvc::getInternalState ( const EventContext & ctx,
AlgExecStateRef::AlgKey k ) const
private

Definition at line 93 of file AlgExecStateSvc.cpp.

94 {
95 assert( m_isInit );
96
97 // Sub-slots are dynamic
98 // Assuming the alg is known, look for a subslot
99 // Return the existing state, or create a new one
100 if ( ctx.usesSubSlot() ) {
101 // Use mutex since dynamic
102 std::scoped_lock lock( m_mut );
103 // Check that there is any sub-slot information for this slot
104 if ( ctx.slot() >= m_algSubSlotStates.size() ) {
105 throw GaudiException( "Could not find slot in m_algSubSlotStates", "AlgExecStateSvc", StatusCode::FAILURE );
106 }
107 // Check that there is information for this sub-slot
108 auto& subSlots = m_algSubSlotStates[ctx.slot()];
109 if ( ctx.subSlot() >= subSlots.size() ) {
110 throw GaudiException( "Could not find subslot in m_algSubSlotStates", "AlgExecStateSvc", StatusCode::FAILURE );
111 }
112 // Find the AlgStates
113 return subSlots[ctx.subSlot()].at( k );
114 }
115 // regular case with no subslot
116 return m_algStates.at( ctx.slot() )[static_cast<size_t>( k )];
117}
constexpr static const auto FAILURE
Definition StatusCode.h:100

◆ incrementErrorCount()

unsigned int AlgExecStateSvc::incrementErrorCount ( const IAlgorithm * iAlg)
override

Definition at line 151 of file AlgExecStateSvc.cpp.

151 {
152 std::call_once( m_initFlag, &AlgExecStateSvc::init, this );
153 return ++m_errorCount[algKey( iAlg->name() )];
154}

◆ init()

void AlgExecStateSvc::init ( )
private

Definition at line 20 of file AlgExecStateSvc.cpp.

20 {
21
22 const std::size_t slots = Gaudi::Concurrency::ConcurrencyFlags::concurrent()
24 : 1;
25 m_algStates.resize( slots );
26 m_eventStatus.resize( slots );
27
28 if ( msgLevel( MSG::DEBUG ) ) debug() << "resizing state containers to : " << slots << endmsg;
29
30 m_isInit = true;
31
32 // call addAlg for algorithms which called it too early.
33 for ( const auto& alg : m_preInitAlgs ) addAlg( alg );
34
35 if ( msgLevel( MSG::VERBOSE ) ) {
36 std::ostringstream ost;
38 verbose() << "dumping state:\n" << ost.str() << endmsg;
39 }
40}
void dump(std::ostream &ost, const EventContext &ctx) const override
MsgStream & verbose() const
shortcut for the method msgStream(MSG::VERBOSE)
static GAUDI_API std::size_t numConcurrentEvents()
number of Concurrent Events (for MT)
static GAUDI_API bool concurrent()
serial operation, or some form of concurrency
GAUDI_API const EventContext & currentContext()
@ VERBOSE
Definition IMessageSvc.h:22

◆ reset()

void AlgExecStateSvc::reset ( const EventContext & ctx)
override

Definition at line 203 of file AlgExecStateSvc.cpp.

203 {
204 if ( msgLevel( MSG::VERBOSE ) ) verbose() << "reset(" << ctx.slot() << ")" << endmsg;
205
206 std::call_once( m_initFlag, &AlgExecStateSvc::init, this );
207 for ( auto& it : m_algStates.at( ctx.slot() ) ) it.reset();
208
209 // Also clear sub slots
210 if ( ctx.slot() < m_algSubSlotStates.size() ) {
211 for ( auto& subSlot : m_algSubSlotStates[ctx.slot()] ) {
212 for ( auto& it : subSlot ) it.second.reset();
213 }
214 }
215
217}

◆ resetErrorCount() [1/2]

void AlgExecStateSvc::resetErrorCount ( )
override

Definition at line 143 of file AlgExecStateSvc.cpp.

143 {
144 std::call_once( m_initFlag, &AlgExecStateSvc::init, this );
145 for ( unsigned int k = 0; k < m_errorCount.size(); k++ ) m_errorCount[static_cast<AlgExecStateRef::AlgKey>( k )] = 0;
146}

◆ resetErrorCount() [2/2]

void AlgExecStateSvc::resetErrorCount ( const IAlgorithm * iAlg)
override

Definition at line 147 of file AlgExecStateSvc.cpp.

147 {
148 std::call_once( m_initFlag, &AlgExecStateSvc::init, this );
149 m_errorCount[algKey( iAlg->name() )] = 0;
150}

◆ setEventStatus()

void AlgExecStateSvc::setEventStatus ( const EventStatus::Status & sc,
const EventContext & ctx )
override

Definition at line 124 of file AlgExecStateSvc.cpp.

124 {
125 std::call_once( m_initFlag, &AlgExecStateSvc::init, this );
126 m_eventStatus.at( ctx.slot() ) = sc;
127}

◆ setExecStatus()

void AlgExecStateSvc::setExecStatus ( const EventContext & ctx,
AlgExecStateRef::AlgKey k,
const StatusCode & s )
overrideprivate

Definition at line 180 of file AlgExecStateSvc.cpp.

180 {
181 std::call_once( m_initFlag, &AlgExecStateSvc::init, this );
182 getInternalState( ctx, k ).setExecStatus( s );
183}
void setExecStatus(const StatusCode &sc=StatusCode::SUCCESS)

◆ setFilterPassed()

void AlgExecStateSvc::setFilterPassed ( const EventContext & ctx,
AlgExecStateRef::AlgKey k,
bool b )
overrideprivate

Definition at line 159 of file AlgExecStateSvc.cpp.

159 {
160 std::call_once( m_initFlag, &AlgExecStateSvc::init, this );
161 getInternalState( ctx, k ).setFilterPassed( b );
162}

◆ setState() [1/2]

void AlgExecStateSvc::setState ( const EventContext & ctx,
AlgExecStateRef::AlgKey k,
AlgExecStateRef::State s )
overrideprivate

Definition at line 167 of file AlgExecStateSvc.cpp.

167 {
168 std::call_once( m_initFlag, &AlgExecStateSvc::init, this );
169 getInternalState( ctx, k ).setState( s );
170}
void setState(AlgExecStateRef::State s)

◆ setState() [2/2]

void AlgExecStateSvc::setState ( const EventContext & ctx,
AlgExecStateRef::AlgKey k,
AlgExecStateRef::State s,
const StatusCode & sc )
overrideprivate

Definition at line 171 of file AlgExecStateSvc.cpp.

172 {
173 std::call_once( m_initFlag, &AlgExecStateSvc::init, this );
174 getInternalState( ctx, k ).setState( s, sc );
175}

◆ state()

AlgExecStateRef::State AlgExecStateSvc::state ( const EventContext & ctx,
AlgExecStateRef::AlgKey k ) const
overrideprivate

Definition at line 163 of file AlgExecStateSvc.cpp.

163 {
164 assert( m_isInit );
165 return getInternalState( ctx, k ).state();
166}
AlgExecStateRef::State state() const

◆ updateEventStatus()

void AlgExecStateSvc::updateEventStatus ( const bool & b,
const EventContext & ctx )
override

Definition at line 129 of file AlgExecStateSvc.cpp.

129 {
130 std::call_once( m_initFlag, &AlgExecStateSvc::init, this );
131 auto& status = m_eventStatus.at( ctx.slot() );
132 if ( status == EventStatus::Success ) {
133 if ( fail ) status = EventStatus::AlgFail;
134 } else if ( status == EventStatus::Invalid ) {
135 status = ( fail ? EventStatus::AlgFail : EventStatus::Success );
136 }
137}

Member Data Documentation

◆ m_algNames

std::vector<std::string> AlgExecStateSvc::m_algNames
private

Definition at line 123 of file AlgExecStateSvc.h.

◆ m_algNameToIndex

std::unordered_map<Gaudi::StringKey, AlgExecStateRef::AlgKey, Gaudi::StringKeyHash, std::equal_to<> > AlgExecStateSvc::m_algNameToIndex
private

Definition at line 118 of file AlgExecStateSvc.h.

◆ m_algStates

std::vector<AlgStates> AlgExecStateSvc::m_algStates
private

Definition at line 114 of file AlgExecStateSvc.h.

◆ m_algSubSlotStates

std::vector<std::vector<AlgStatesWithSubSlot> > AlgExecStateSvc::m_algSubSlotStates
private

Definition at line 116 of file AlgExecStateSvc.h.

◆ m_errorCount

std::unordered_map<AlgExecStateRef::AlgKey, std::atomic<unsigned int> > AlgExecStateSvc::m_errorCount
private

Definition at line 126 of file AlgExecStateSvc.h.

◆ m_eventStatus

std::vector<EventStatus::Status> AlgExecStateSvc::m_eventStatus
private

Definition at line 120 of file AlgExecStateSvc.h.

◆ m_initFlag

std::once_flag AlgExecStateSvc::m_initFlag
private

Definition at line 130 of file AlgExecStateSvc.h.

◆ m_isInit

bool AlgExecStateSvc::m_isInit { false }
private

Definition at line 131 of file AlgExecStateSvc.h.

131{ false };

◆ m_mut

std::mutex AlgExecStateSvc::m_mut
mutableprivate

Definition at line 133 of file AlgExecStateSvc.h.

◆ m_preInitAlgs

std::vector<Gaudi::StringKey> AlgExecStateSvc::m_preInitAlgs
private

Definition at line 121 of file AlgExecStateSvc.h.


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