The Gaudi Framework  v30r3 (a5ef0a68)
AlgoExecutionTask Class Reference

#include <src/AlgoExecutionTask.h>

Inheritance diagram for AlgoExecutionTask:
Collaboration diagram for AlgoExecutionTask:

Public Member Functions

 AlgoExecutionTask (IAlgorithm *algorithm, EventContext *ctx, ISvcLocator *svcLocator, IAlgExecStateSvc *aem, std::function< StatusCode()> promote2ExecutedClosure)
 
tbb::task * execute () override
 

Private Attributes

SmartIF< IAlgorithmm_algorithm
 
EventContextm_evtCtx
 
IAlgExecStateSvcm_aess
 
SmartIF< ISvcLocatorm_serviceLocator
 
std::function< StatusCode()> m_promote2ExecutedClosure
 

Detailed Description

Definition at line 14 of file AlgoExecutionTask.h.

Constructor & Destructor Documentation

AlgoExecutionTask::AlgoExecutionTask ( IAlgorithm algorithm,
EventContext ctx,
ISvcLocator svcLocator,
IAlgExecStateSvc aem,
std::function< StatusCode()>  promote2ExecutedClosure 
)
inline

Definition at line 17 of file AlgoExecutionTask.h.

19  : m_algorithm( algorithm )
20  , m_evtCtx( ctx )
21  , m_aess( aem )
22  , m_serviceLocator( svcLocator )
23  , m_promote2ExecutedClosure( std::move( promote2ExecutedClosure ) ){};
IAlgExecStateSvc * m_aess
SmartIF< ISvcLocator > m_serviceLocator
SmartIF< IAlgorithm > m_algorithm
T move(T...args)
EventContext * m_evtCtx
std::function< StatusCode()> m_promote2ExecutedClosure

Member Function Documentation

tbb::task * AlgoExecutionTask::execute ( )
override

Definition at line 14 of file AlgoExecutionTask.cpp.

15 {
16 
17  IAlgorithm* ialg = m_algorithm.get();
18  Algorithm* this_algo = dynamic_cast<Algorithm*>( ialg );
19  if ( !this_algo ) {
20  throw GaudiException( "Cast to Algorithm failed!", "AlgoExecutionTask", StatusCode::FAILURE );
21  }
22 
23  bool eventfailed = false;
25 
26  // Get the IProperty interface of the ApplicationMgr to pass it to RetCodeGuard
27  const SmartIF<IProperty> appmgr( m_serviceLocator );
28 
30  MsgStream log( messageSvc, "AlgoExecutionTask" );
31 
32  // select the appropriate store
33  this_algo->whiteboard()->selectStore( m_evtCtx->valid() ? m_evtCtx->slot() : 0 ).ignore();
34 
36  try {
39  if ( UNLIKELY( !sc.isSuccess() ) ) {
40  log << MSG::WARNING << "Execution of algorithm " << m_algorithm->name() << " failed" << endmsg;
41  eventfailed = true;
42  }
43  rcg.ignore(); // disarm the guard
44  } catch ( const GaudiException& Exception ) {
45  log << MSG::FATAL << ".executeEvent(): Exception with tag=" << Exception.tag() << " thrown by "
46  << m_algorithm->name() << endmsg;
47  log << MSG::ERROR << Exception << endmsg;
48  eventfailed = true;
49  } catch ( const std::exception& Exception ) {
50  log << MSG::FATAL << ".executeEvent(): Standard std::exception thrown by " << m_algorithm->name() << endmsg;
51  log << MSG::ERROR << Exception.what() << endmsg;
52  eventfailed = true;
53  } catch ( ... ) {
54  log << MSG::FATAL << ".executeEvent(): UNKNOWN Exception thrown by " << m_algorithm->name() << endmsg;
55  eventfailed = true;
56  }
57 
58  // DP it is important to propagate the failure of an event.
59  // We need to stop execution when this happens so that execute run can
60  // then receive the FAILURE
61  m_aess->updateEventStatus( eventfailed, *m_evtCtx );
62 
63  // update scheduler state
65 
67 
68  return nullptr;
69 }
#define UNLIKELY(x)
Definition: Kernel.h:122
constexpr static const auto FAILURE
Definition: StatusCode.h:88
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
Define general base for Gaudi exception.
Helper class to set the application return code in case of early exit (e.g.
Definition: RetCodeGuard.h:9
ContextID_t slot() const
Definition: EventContext.h:40
IAlgExecStateSvc * m_aess
SmartIF< ISvcLocator > m_serviceLocator
SmartIF< IAlgorithm > m_algorithm
constexpr int UnhandledException
Definition: AppReturnCode.h:29
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:82
virtual StatusCode selectStore(size_t partitionIndex)=0
Activate an given &#39;slot&#39; for all subsequent calls within the same thread id.
T what(T...args)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
virtual StatusCode sysExecute(const EventContext &)=0
System execution. This method invokes the execute() method of a concrete algorithm.
virtual const std::string & tag() const
name tag for the exception, or exception type
STL class.
The IAlgorithm is the interface implemented by the Algorithm base class.
Definition: IAlgorithm.h:28
GAUDI_API void setCurrentContext(const EventContext *ctx)
virtual void updateEventStatus(const bool &b, const EventContext &ctx)=0
SmartIF< IHiveWhiteBoard > & whiteboard() const
Definition: Algorithm.cpp:832
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:78
GAUDI_API void setCurrentContextEvt(long int evtN)
EventContext * m_evtCtx
std::function< StatusCode()> m_promote2ExecutedClosure
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
bool valid() const
Definition: EventContext.h:41

Member Data Documentation

IAlgExecStateSvc* AlgoExecutionTask::m_aess
private

Definition at line 29 of file AlgoExecutionTask.h.

SmartIF<IAlgorithm> AlgoExecutionTask::m_algorithm
private

Definition at line 27 of file AlgoExecutionTask.h.

EventContext* AlgoExecutionTask::m_evtCtx
private

Definition at line 28 of file AlgoExecutionTask.h.

std::function<StatusCode()> AlgoExecutionTask::m_promote2ExecutedClosure
private

Definition at line 31 of file AlgoExecutionTask.h.

SmartIF<ISvcLocator> AlgoExecutionTask::m_serviceLocator
private

Definition at line 30 of file AlgoExecutionTask.h.


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