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

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

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::Status & eventStatus (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::PropertyBase * declareProperty (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::PropertyBase * declareProperty (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::PropertyBase & declareProperty (Gaudi::Details::PropertyBase &prop)
 Declare a property.
Gaudi::Details::PropertyBase * declareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="")
 Declare a remote property.
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 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::PropertyBase * property (std::string_view name) const
 \fixme property and bindPropertiesTo should be protected
void bindPropertiesTo (Gaudi::Interfaces::IOptionsSvc &optsSvc)
PropertyHolder & operator= (const PropertyHolder &)=delete
Public Member Functions inherited from CommonMessagingBase
virtual ~CommonMessagingBase ()=default
 Virtual destructor.
const SmartIF< IMessageSvc > & msgSvc () const
 The standard message service.
MsgStream & msgStream () const
 Return an uninitialized MsgStream.
MsgStream & msgStream (const MSG::Level level) const
 Predefined configurable message stream for the efficient printouts.
MsgStream & always () const
 shortcut for the method msgStream(MSG::ALWAYS)
MsgStream & fatal () const
 shortcut for the method msgStream(MSG::FATAL)
MsgStream & err () const
 shortcut for the method msgStream(MSG::ERROR)
MsgStream & error () const
 shortcut for the method msgStream(MSG::ERROR)
MsgStream & warning () const
 shortcut for the method msgStream(MSG::WARNING)
MsgStream & info () const
 shortcut for the method msgStream(MSG::INFO)
MsgStream & debug () const
 shortcut for the method msgStream(MSG::DEBUG)
MsgStream & verbose () const
 shortcut for the method msgStream(MSG::VERBOSE)
MsgStream & msg () const
 shortcut for the method msgStream(MSG::INFO)
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

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 StatusCode & execStatus (const EventContext &, AlgExecStateRef::AlgKey) const override
void setExecStatus (const EventContext &, AlgExecStateRef::AlgKey, const StatusCode &) override
const std::string & algName (AlgExecStateRef::AlgKey) const override
AlgExecStateInternal & getInternalState (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< AlgStates > m_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::Status > m_eventStatus
std::vector< Gaudi::StringKey > m_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 override final
 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< IAuditorSvc > m_pAuditorSvc
 Auditor Service.

Detailed Description

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

Definition at line 35 of file AlgExecStateSvc.cpp.

Member Typedef Documentation

◆ AlgStates

◆ AlgStatesWithSubSlot

Member Function Documentation

◆ addAlg() [1/2]

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

Definition at line 168 of file AlgExecStateSvc.cpp.

168 {
169 if ( !m_isInit ) {
170 if ( msgLevel( MSG::DEBUG ) ) debug() << "preInit: will add Alg " << alg.str() << " later" << endmsg;
171 auto it = std::find( begin( m_preInitAlgs ), end( m_preInitAlgs ), alg );
172 if ( it == m_preInitAlgs.end() ) {
174 return static_cast<AlgExecStateRef::AlgKey>( m_preInitAlgs.size() - 1 );
175 } else {
176 return static_cast<AlgExecStateRef::AlgKey>( std::distance( begin( m_preInitAlgs ), it ) );
177 }
178 }
179 // try to create default state for first slot and retrieve the key
180 auto [it, b] =
181 m_algNameToIndex.try_emplace( alg, static_cast<AlgExecStateRef::AlgKey>( m_algStates.front().size() ) );
182 if ( b ) {
183 // create default state for all slots
184 for ( auto& a : m_algStates ) a.emplace_back();
185 m_errorCount.emplace( it->second, 0 );
186 m_algNames.push_back( alg );
187 if ( msgLevel( MSG::DEBUG ) )
188 debug() << "adding alg " << alg.str() << " to " << m_algStates.size() << " slots" << endmsg;
189 }
190 return it->second;
191}
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition MsgStream.h:198
constexpr _InputIterator find(_InputIterator __first, _InputIterator __last, const _Tp &__val)
constexpr iterator_traits< _InputIterator >::difference_type distance(_InputIterator __first, _InputIterator __last)
constexpr auto begin(_Container &__cont) -> decltype(__cont.begin())
constexpr void push_back(const value_type &__x)
constexpr const_iterator end() const noexcept
constexpr size_type size() const noexcept
std::pair< iterator, bool > emplace(_Args &&... __args)
pair< iterator, bool > try_emplace(const key_type &__k, _Args &&... __args)
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)
MSG::Level msgLevel() const
get the cached level (originally extracted from the embedded MsgStream)
@ DEBUG
Definition IMessageSvc.h:22

◆ addAlg() [2/2]

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 272 of file AlgExecStateSvc.cpp.

272 {
273 assert( m_isInit );
274 return m_errorCount.at( algKey( iAlg->name() ) );
275}
mapped_type & at(const key_type &__k)
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 84 of file AlgExecStateSvc.cpp.

84 {
85 return { *this, ctx, algKey( iAlg->name() ) };
86 }

◆ algExecState() [2/4]

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

Definition at line 78 of file AlgExecStateSvc.cpp.

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

◆ algExecState() [3/4]

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

Definition at line 87 of file AlgExecStateSvc.cpp.

87 {
88 return { *this, ctx, algKey( algName ) };
89 }
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 81 of file AlgExecStateSvc.cpp.

81 {
82 return { *this, ctx, algKey( algName ) };
83 }

◆ algKey()

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

Definition at line 119 of file AlgExecStateSvc.cpp.

119{ return m_algNameToIndex.at( algName ); }

◆ algName()

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

Definition at line 317 of file AlgExecStateSvc.cpp.

317 {
318 assert( m_isInit );
319 return m_algNames[static_cast<size_t>( k )];
320}

◆ 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 332 of file AlgExecStateSvc.cpp.

332 {
333 ost << getInternalState( ctx, k );
334}
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 322 of file AlgExecStateSvc.cpp.

322 {
323 const size_t slotID = ctx.valid() ? ctx.slot() : 0;
324 ost << " [slot: " << slotID << ", incident: " << m_eventStatus.at( slotID ) << "]:\n\n";
325 auto& algState = m_algStates.at( slotID );
326 auto ml = std::accumulate( begin( m_algNames ), end( m_algNames ), size_t{ 0 },
327 []( size_t m, const auto& as ) { return std::max( m, as.length() ); } );
328 for ( size_t k = 0; const auto& e : algState )
329 ost << " + " << std::setw( ml ) << algName( static_cast<AlgExecStateRef::AlgKey>( k++ ) ) << " " << e << '\n';
330}
constexpr const _Tp & max(const _Tp &__a, const _Tp &__b)
constexpr _Tp accumulate(_InputIterator __first, _InputIterator __last, _Tp __init)
_Setw setw(int __n)
constexpr reference at(size_type __n)
std::vector< EventStatus::Status > m_eventStatus
constexpr double m

◆ eventStatus()

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

Definition at line 245 of file AlgExecStateSvc.cpp.

245 {
246 assert( m_isInit );
247 return m_eventStatus.at( ctx.slot() );
248}

◆ execStatus()

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

Definition at line 309 of file AlgExecStateSvc.cpp.

309 {
310 assert( m_isInit );
311 return getInternalState( ctx, k ).execStatus();
312}
const StatusCode & execStatus() const

◆ filterPassed()

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

Definition at line 288 of file AlgExecStateSvc.cpp.

288 {
289 assert( m_isInit );
290 return getInternalState( ctx, k ).filterPassed();
291}

◆ getInternalState() [1/2]

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

Definition at line 193 of file AlgExecStateSvc.cpp.

194 {
196 // Sub-slots are dynamic
197 // Assuming the alg is known, look for a subslot
198 // Return the existing state, or create a new one
199 if ( ctx.usesSubSlot() ) {
200 // Use mutex since dynamic
201 std::scoped_lock lock( m_mut );
202
203 // Check that there is any sub-slot information for this slot
204 if ( ctx.slot() >= m_algSubSlotStates.size() ) m_algSubSlotStates.resize( ctx.slot() + 1 );
205
206 // Check that there is information for this sub-slot
207 auto& subSlots = m_algSubSlotStates[ctx.slot()];
208 if ( ctx.subSlot() >= subSlots.size() ) subSlots.resize( ctx.subSlot() + 1 );
209
210 // Find (and potentially extend) the AlgStates
211 return subSlots[ctx.subSlot()].try_emplace( k ).first->second;
212 }
213 // regular case with no subslot
214 assert( ctx.slot() < m_algStates.size() );
215 assert( static_cast<size_t>( k ) < m_algStates.at( ctx.slot() ).size() );
216 return m_algStates.at( ctx.slot() )[static_cast<size_t>( k )];
217}
void lock(_L1 &__l1, _L2 &__l2, _L3 &... __l3)
void call_once(once_flag &__once, _Callable &&__f, _Args &&... __args)
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 219 of file AlgExecStateSvc.cpp.

220 {
221 assert( m_isInit );
222
223 // Sub-slots are dynamic
224 // Assuming the alg is known, look for a subslot
225 // Return the existing state, or create a new one
226 if ( ctx.usesSubSlot() ) {
227 // Use mutex since dynamic
228 std::scoped_lock lock( m_mut );
229 // Check that there is any sub-slot information for this slot
230 if ( ctx.slot() >= m_algSubSlotStates.size() ) {
231 throw GaudiException( "Could not find slot in m_algSubSlotStates", "AlgExecStateSvc", StatusCode::FAILURE );
232 }
233 // Check that there is information for this sub-slot
234 auto& subSlots = m_algSubSlotStates[ctx.slot()];
235 if ( ctx.subSlot() >= subSlots.size() ) {
236 throw GaudiException( "Could not find subslot in m_algSubSlotStates", "AlgExecStateSvc", StatusCode::FAILURE );
237 }
238 // Find the AlgStates
239 return subSlots[ctx.subSlot()].at( k );
240 }
241 // regular case with no subslot
242 return m_algStates.at( ctx.slot() )[static_cast<size_t>( k )];
243}
GaudiException(std::string Message, std::string Tag, StatusCode Code)
Constructor (1).
constexpr static const auto FAILURE
Definition StatusCode.h:100

◆ incrementErrorCount()

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

Definition at line 284 of file AlgExecStateSvc.cpp.

284 {
286 return ++m_errorCount[algKey( iAlg->name() )];
287}

◆ init()

void AlgExecStateSvc::init ( )
private

Definition at line 146 of file AlgExecStateSvc.cpp.

146 {
147
148 const std::size_t slots = Gaudi::Concurrency::ConcurrencyFlags::concurrent()
150 : 1;
151 m_algStates.resize( slots );
152 m_eventStatus.resize( slots );
153
154 if ( msgLevel( MSG::DEBUG ) ) debug() << "resizing state containers to : " << slots << endmsg;
155
156 m_isInit = true;
157
158 // call addAlg for algorithms which called it too early.
159 for ( const auto& alg : m_preInitAlgs ) addAlg( alg );
160
161 if ( msgLevel( MSG::VERBOSE ) ) {
164 verbose() << "dumping state:\n" << ost.str() << endmsg;
165 }
166}
basic_ostringstream< char > ostringstream
__string_type str() const
constexpr void resize(size_type __new_size)
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 336 of file AlgExecStateSvc.cpp.

336 {
337 if ( msgLevel( MSG::VERBOSE ) ) verbose() << "reset(" << ctx.slot() << ")" << endmsg;
338
340 for ( auto& it : m_algStates.at( ctx.slot() ) ) it.reset();
341
342 // Also clear sub slots
343 if ( ctx.slot() < m_algSubSlotStates.size() ) {
344 for ( auto& subSlot : m_algSubSlotStates[ctx.slot()] ) {
345 for ( auto& it : subSlot ) it.second.reset();
346 }
347 }
348
349 std::atomic_ref{ m_eventStatus.at( ctx.slot() ) }.store( EventStatus::Invalid, std::memory_order_relaxed );
350}

◆ resetErrorCount() [1/2]

void AlgExecStateSvc::resetErrorCount ( )
override

Definition at line 276 of file AlgExecStateSvc.cpp.

276 {
278 for ( unsigned int k = 0; k < m_errorCount.size(); k++ ) m_errorCount[static_cast<AlgExecStateRef::AlgKey>( k )] = 0;
279}
size_type size() const noexcept

◆ resetErrorCount() [2/2]

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

Definition at line 280 of file AlgExecStateSvc.cpp.

280 {
282 m_errorCount[algKey( iAlg->name() )] = 0;
283}

◆ setEventStatus()

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

Definition at line 250 of file AlgExecStateSvc.cpp.

250 {
252 std::atomic_ref{ m_eventStatus.at( ctx.slot() ) }.store( sc, std::memory_order_relaxed );
253}

◆ setExecStatus()

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

Definition at line 313 of file AlgExecStateSvc.cpp.

313 {
315 getInternalState( ctx, k ).setExecStatus( s );
316}
void setExecStatus(const StatusCode &sc=StatusCode::SUCCESS)

◆ setFilterPassed()

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

Definition at line 292 of file AlgExecStateSvc.cpp.

◆ setState() [1/2]

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

Definition at line 300 of file AlgExecStateSvc.cpp.

300 {
302 getInternalState( ctx, k ).setState( s );
303}
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 304 of file AlgExecStateSvc.cpp.

305 {
307 getInternalState( ctx, k ).setState( s, sc );
308}

◆ state()

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

Definition at line 296 of file AlgExecStateSvc.cpp.

296 {
297 assert( m_isInit );
298 return getInternalState( ctx, k ).state();
299}
AlgExecStateRef::State state() const

◆ updateEventStatus()

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

Definition at line 255 of file AlgExecStateSvc.cpp.

255 {
257 // Called at the end of every algorithm, and algorithms of one event slot finish concurrently:
258 // update atomically so that a failure cannot be overwritten by a concurrent success.
259 std::atomic_ref status{ m_eventStatus.at( ctx.slot() ) };
260 auto current = status.load( std::memory_order_relaxed );
261 while ( true ) {
262 auto next = current;
263 if ( current == EventStatus::Success ) {
264 if ( fail ) next = EventStatus::AlgFail;
265 } else if ( current == EventStatus::Invalid ) {
266 next = ( fail ? EventStatus::AlgFail : EventStatus::Success );
267 }
268 if ( next == current || status.compare_exchange_weak( current, next, std::memory_order_relaxed ) ) { break; }
269 }
270}

Member Data Documentation

◆ m_algNames

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

Definition at line 131 of file AlgExecStateSvc.cpp.

◆ m_algNameToIndex

Definition at line 126 of file AlgExecStateSvc.cpp.

◆ m_algStates

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

Definition at line 122 of file AlgExecStateSvc.cpp.

◆ m_algSubSlotStates

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

Definition at line 124 of file AlgExecStateSvc.cpp.

◆ m_errorCount

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

Definition at line 134 of file AlgExecStateSvc.cpp.

◆ m_eventStatus

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

Definition at line 128 of file AlgExecStateSvc.cpp.

◆ m_initFlag

std::once_flag AlgExecStateSvc::m_initFlag
private

Definition at line 138 of file AlgExecStateSvc.cpp.

◆ m_isInit

bool AlgExecStateSvc::m_isInit { false }
private

Definition at line 139 of file AlgExecStateSvc.cpp.

◆ m_mut

std::mutex AlgExecStateSvc::m_mut
mutableprivate

Definition at line 141 of file AlgExecStateSvc.cpp.

◆ m_preInitAlgs

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

Definition at line 129 of file AlgExecStateSvc.cpp.


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