The Gaudi Framework  v40r0 (475e45c1)
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
 
virtual AlgExecStateRef::AlgKey addAlg (const Gaudi::StringKey &algName)=0
 adds a new algorithm to the service More...
 
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. More...
 
StatusCode queryInterface (const InterfaceID &ti, void **pp) override
 Implementation of IInterface::queryInterface. More...
 
std::vector< std::string > getInterfaceNames () const override
 Implementation of IInterface::getInterfaceNames. More...
 
- Public Member Functions inherited from Service
const std::string & name () const override
 Retrieve name of the service
More...
 
StatusCode configure () override
 
StatusCode initialize () override
 
StatusCode start () override
 
StatusCode stop () override
 
StatusCode finalize () override
 
StatusCode terminate () override
 
Gaudi::StateMachine::State FSMState () const override
 
Gaudi::StateMachine::State targetFSMState () const override
 
StatusCode reinitialize () override
 
StatusCode restart () override
 
StatusCode sysInitialize () override
 Initialize Service
More...
 
StatusCode sysStart () override
 Initialize Service
More...
 
StatusCode sysStop () override
 Initialize Service
More...
 
StatusCode sysFinalize () override
 Finalize Service
More...
 
StatusCode sysReinitialize () override
 Re-initialize the Service. More...
 
StatusCode sysRestart () override
 Re-initialize the Service. More...
 
 Service (std::string name, ISvcLocator *svcloc)
 Standard Constructor
More...
 
SmartIF< ISvcLocator > & serviceLocator () const override
 Retrieve pointer to service locator
More...
 
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. More...
 
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. More...
 
- Public Member Functions inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
 PropertyHolder ()=default
 
Gaudi::Details::PropertyBasedeclareProperty (Gaudi::Details::PropertyBase &prop)
 Declare a property. More...
 
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. More...
 
 requires (!Gaudi::Details::is_gaudi_property_v< TYPE >) Gaudi
 Helper to wrap a regular data member and use it as a regular property. More...
 
Gaudi::Details::PropertyBasedeclareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="")
 Declare a remote property. More...
 
StatusCode setProperty (const std::string &name, const Gaudi::Details::PropertyBase &p) override
 set the property from another property with a different name More...
 
StatusCode setProperty (const std::string &s) override
 set the property from the formatted string More...
 
StatusCode setProperty (const Gaudi::Details::PropertyBase &p)
 Set the property from a property. More...
 
virtual StatusCode setProperty (const std::string &name, const Gaudi::Details::PropertyBase &p)=0
 Set the property from a property with a different name. More...
 
virtual StatusCode setProperty (const std::string &s)=0
 Set the property by string. More...
 
StatusCode setProperty (const std::string &name, const char *v)
 Special case for string literals. More...
 
StatusCode setProperty (const std::string &name, const std::string &v)
 Special case for std::string. More...
 
StatusCode setPropertyRepr (const std::string &n, const std::string &r) override
 set the property from name and value string representation More...
 
StatusCode getProperty (Gaudi::Details::PropertyBase *p) const override
 get the property More...
 
const Gaudi::Details::PropertyBasegetProperty (std::string_view name) const override
 get the property by name More...
 
StatusCode getProperty (std::string_view n, std::string &v) const override
 convert the property to the string More...
 
const std::vector< Gaudi::Details::PropertyBase * > & getProperties () const override
 get all properties More...
 
bool hasProperty (std::string_view name) const override
 Return true if we have a property with the given name. More...
 
Gaudi::Details::PropertyBaseproperty (std::string_view name) const
 \fixme property and bindPropertiesTo should be protected More...
 
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) More...
 
bool msgLevel (MSG::Level lvl) const
 get the output level from the embedded MsgStream More...
 

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::AlgKeym_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 = extends
 Typedef to this class. More...
 
using extend_interfaces_base = extend_interfaces< Interfaces... >
 Typedef to the base of this class. More...
 
- Public Types inherited from Service
using Factory = Gaudi::PluginService::Factory< IService *(const std::string &, ISvcLocator *)>
 
- Public Types inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
using PropertyHolderImpl = PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
 Typedef used to refer to this class from derived classes, as in. More...
 
- Public Types inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
using base_class = CommonMessaging
 
- Public Types inherited from extend_interfaces< Interfaces... >
using ext_iids = typename Gaudi::interface_list_cat< typename Interfaces::ext_iids... >::type
 take union of the ext_iids of all Interfaces... More...
 
- Protected Member Functions inherited from Service
std::vector< IAlgTool * > & tools ()
 
 ~Service () override
 
int outputLevel () const
 get the Service's output level More...
 
- Protected Member Functions inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
MSG::Level setUpMessaging () const
 Set up local caches. More...
 
MSG::Level resetMessaging ()
 Reinitialize internal states. More...
 
void updateMsgStreamOutputLevel (int level)
 Update the output level of the cached MsgStream. More...
 
- Protected Attributes inherited from Service
Gaudi::StateMachine::State m_state = Gaudi::StateMachine::OFFLINE
 Service state
More...
 
Gaudi::StateMachine::State m_targetState = Gaudi::StateMachine::OFFLINE
 Service state
More...
 
Gaudi::Property< int > m_outputLevel { this, "OutputLevel", MSG::NIL, "output level" }
 flag indicating whether ToolHandle tools have been added to m_tools More...
 
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
More...
 

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/3]

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 }

◆ addAlg() [2/3]

virtual AlgExecStateRef::AlgKey IAlgExecStateSvc::addAlg

adds a new algorithm to the service

◆ addAlg() [3/3]

AlgExecStateRef::AlgKey IAlgExecStateSvc::addAlg
inline

Definition at line 120 of file IAlgExecStateSvc.h.

120 { return addAlg( iAlg->nameKey() ); }

◆ 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 }

◆ 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  }

◆ 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 }

◆ 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 }

◆ 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 }

◆ 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 }

◆ 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 }

◆ 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 }

◆ 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 
216  m_eventStatus.at( ctx.slot() ) = EventStatus::Invalid;
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 );
183 }

◆ 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 );
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 }

◆ 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 }

◆ 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> 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.

◆ 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:
MSG::DEBUG
@ DEBUG
Definition: IMessageSvc.h:22
AlgExecStateSvc::init
void init()
Definition: AlgExecStateSvc.cpp:20
AlgExecStateSvc::AlgExecStateInternal::setFilterPassed
void setFilterPassed(bool f=true)
Definition: AlgExecStateSvc.h:35
Gaudi::Hive::currentContext
GAUDI_API const EventContext & currentContext()
Definition: ThreadLocalContext.cpp:30
AlgExecStateSvc::m_algNameToIndex
std::unordered_map< Gaudi::StringKey, AlgExecStateRef::AlgKey > m_algNameToIndex
Definition: AlgExecStateSvc.h:118
AlgExecStateSvc::dump
void dump(std::ostream &ost, const EventContext &ctx) const override
Definition: AlgExecStateSvc.cpp:189
gaudirun.s
string s
Definition: gaudirun.py:346
AlgExecStateSvc::m_eventStatus
std::vector< EventStatus::Status > m_eventStatus
Definition: AlgExecStateSvc.h:120
AlgExecStateSvc::getInternalState
AlgExecStateInternal & getInternalState(const EventContext &ctx, AlgExecStateRef::AlgKey k)
Definition: AlgExecStateSvc.cpp:67
GaudiException
Definition: GaudiException.h:29
EventStatus::Success
@ Success
Definition: IAlgExecStateSvc.h:75
AlgExecStateSvc::AlgExecStateInternal::execStatus
const StatusCode & execStatus() const
Definition: AlgExecStateSvc.h:42
AlgExecStateSvc::AlgExecStateInternal::setState
void setState(AlgExecStateRef::State s)
Definition: AlgExecStateSvc.h:37
AlgExecStateSvc::m_preInitAlgs
std::vector< Gaudi::StringKey > m_preInitAlgs
Definition: AlgExecStateSvc.h:121
AlgExecStateSvc::addAlg
AlgExecStateRef::AlgKey addAlg(const Gaudi::StringKey &) override
Definition: AlgExecStateSvc.cpp:42
EventStatus::Invalid
@ Invalid
Definition: IAlgExecStateSvc.h:75
CommonMessaging< implements< IService, IProperty, IStateful > >::msgLevel
MSG::Level msgLevel() const
get the cached level (originally extracted from the embedded MsgStream)
Definition: CommonMessaging.h:147
AlgExecStateSvc::m_mut
std::mutex m_mut
Definition: AlgExecStateSvc.h:133
AlgExecStateSvc::AlgExecStateInternal::filterPassed
bool filterPassed() const
Definition: AlgExecStateSvc.h:34
ManySmallAlgs.alg
alg
Definition: ManySmallAlgs.py:81
Gaudi::Concurrency::ConcurrencyFlags::numConcurrentEvents
static GAUDI_API std::size_t numConcurrentEvents()
number of Concurrent Events (for MT)
Definition: ConcurrencyFlags.h:56
Gaudi::Concurrency::ConcurrencyFlags::concurrent
static GAUDI_API bool concurrent()
serial operation, or some form of concurrency
Definition: ConcurrencyFlags.h:64
AlgExecStateSvc::m_algSubSlotStates
std::vector< std::vector< AlgStatesWithSubSlot > > m_algSubSlotStates
Definition: AlgExecStateSvc.h:116
Gaudi::Utils::begin
AttribStringParser::Iterator begin(const AttribStringParser &parser)
Definition: AttribStringParser.h:135
GaudiPython.Pythonizations.ctx
ctx
Definition: Pythonizations.py:578
Gaudi::Units::m
constexpr double m
Definition: SystemOfUnits.h:107
AlgExecStateSvc::m_isInit
bool m_isInit
Definition: AlgExecStateSvc.h:131
AlgExecStateSvc::m_algNames
std::vector< std::string > m_algNames
Definition: AlgExecStateSvc.h:123
AlgExecStateSvc::AlgExecStateInternal::setExecStatus
void setExecStatus(const StatusCode &sc=StatusCode::SUCCESS)
Definition: AlgExecStateSvc.h:43
genconfuser.verbose
verbose
Definition: genconfuser.py:28
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:198
EventStatus::AlgFail
@ AlgFail
Definition: IAlgExecStateSvc.h:75
AlgExecStateSvc::m_initFlag
std::once_flag m_initFlag
Definition: AlgExecStateSvc.h:130
AlgExecStateSvc::m_errorCount
std::unordered_map< AlgExecStateRef::AlgKey, std::atomic< unsigned int > > m_errorCount
Definition: AlgExecStateSvc.h:126
MSG::VERBOSE
@ VERBOSE
Definition: IMessageSvc.h:22
AlgExecStateSvc::AlgExecStateInternal::state
AlgExecStateRef::State state() const
Definition: AlgExecStateSvc.h:36
AlgExecStateRef::AlgKey
AlgKey
Definition: IAlgExecStateSvc.h:35
AlgExecStateSvc::algName
const std::string & algName(AlgExecStateRef::AlgKey) const override
Definition: AlgExecStateSvc.cpp:184
AlgExecStateSvc::algKey
AlgExecStateRef::AlgKey algKey(const std::string &algName) const
Definition: AlgExecStateSvc.h:111
IOTest.end
end
Definition: IOTest.py:125
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:100
Gaudi::Accumulators::accumulate
void accumulate(Counter &counter, const Container &container, Fun f=Identity{})
A helper function for accumulating data from a container into a counter This is internally using buff...
Definition: Accumulators.h:1229
AlgExecStateSvc::m_algStates
std::vector< AlgStates > m_algStates
Definition: AlgExecStateSvc.h:114