| The Gaudi Framework v28r2p1 (f1a77ff4)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Private Attributes | List of all members
AlgoExecutionTask Class Reference

`#include <src/AlgoExecutionTask.h>`

Inheritance diagram for AlgoExecutionTask:
[legend]
Collaboration diagram for AlgoExecutionTask:
[legend]

## Public Member Functions
| AlgoExecutionTask (IAlgorithm *algorithm, unsigned int algoIndex, EventContext *ctx, ISvcLocator *svcLocator, IAlgExecStateSvc *aem)
tbb::task * | execute () override

## Private Attributes
SmartIF< IAlgorithm > | m_algorithm
EventContext * | m_evtCtx
const unsigned int | m_algoIndex
IAlgExecStateSvc * | m_aess
SmartIF< ISvcLocator > | m_serviceLocator

## Detailed Description

Definition at line 14 of file AlgoExecutionTask.h.

## Constructor & Destructor Documentation

AlgoExecutionTask::AlgoExecutionTask | ( | IAlgorithm * | algorithm,
|  | unsigned int | algoIndex,
|  | EventContext * | ctx,
|  | ISvcLocator * | svcLocator,
|  | IAlgExecStateSvc * | aem
| ) |  |
| inline

Definition at line 16 of file AlgoExecutionTask.h.

20 :
21 m_algorithm(algorithm),
22 m_evtCtx(ctx),
23 m_algoIndex(algoIndex),
24 m_aess(aem),
25 m_serviceLocator(svcLocator){};
AlgoExecutionTask::m_aess
IAlgExecStateSvc * m_aess
Definition: AlgoExecutionTask.h:31
AlgoExecutionTask::m_serviceLocator
SmartIF< ISvcLocator > m_serviceLocator
Definition: AlgoExecutionTask.h:32
AlgoExecutionTask::m_algorithm
SmartIF< IAlgorithm > m_algorithm
Definition: AlgoExecutionTask.h:28
AlgoExecutionTask::m_algoIndex
const unsigned int m_algoIndex
Definition: AlgoExecutionTask.h:30
AlgoExecutionTask::m_evtCtx
EventContext * m_evtCtx
Definition: AlgoExecutionTask.h:29

## Member Function Documentation

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

Definition at line 14 of file AlgoExecutionTask.cpp.

14 {
15
16 IAlgorithm *ialg = m_algorithm.get();
17 Algorithm* this_algo = dynamic_cast<Algorithm*>(ialg);
18 if (!this_algo){
19 throw GaudiException ("Cast to Algorithm failed!","AlgoExecutionTask",
20 StatusCode::FAILURE);
21 }
22
23 bool eventfailed=false;
24 Gaudi::Hive::setCurrentContext( m_evtCtx );
25
26 // TODO reproduce the commented out functionality in a different service
27 //m_schedSvc->addAlg(this_algo, m_evtCtx, pthread_self());
28
29 // Get the IProperty interface of the ApplicationMgr to pass it to RetCodeGuard
30 const SmartIF<IProperty> appmgr(m_serviceLocator);
31
32 SmartIF<IMessageSvc> messageSvc (m_serviceLocator);
33 MsgStream log(messageSvc, "AlgoExecutionTask");
34
35 // select the appropriate store
36 this_algo->whiteboard()->selectStore(m_evtCtx->valid() ?
37 m_evtCtx->slot() : 0).ignore();
38
39 StatusCode sc(StatusCode::FAILURE);
40 try {
41 RetCodeGuard rcg(appmgr, Gaudi::ReturnCode::UnhandledException);
42 sc = m_algorithm->sysExecute(*m_evtCtx);
43 if (UNLIKELY(!sc.isSuccess())) {
44 log << MSG::WARNING << "Execution of algorithm "
45 << m_algorithm->name() << " failed" << endmsg;
46 eventfailed = true;
47 }
48 rcg.ignore(); // disarm the guard
49 } catch ( const GaudiException& Exception ) {
50 log << MSG::FATAL << ".executeEvent(): Exception with tag=" << Exception.tag()
51 << " thrown by " << m_algorithm->name() << endmsg;
52 log << MSG::ERROR << Exception << endmsg;
53 eventfailed = true;
54 } catch ( const std::exception& Exception ) {
55 log << MSG::FATAL << ".executeEvent(): Standard std::exception thrown by "
56 << m_algorithm->name() << endmsg;
57 log << MSG::ERROR << Exception.what() << endmsg;
58 eventfailed = true;
59 } catch(...) {
60 log << MSG::FATAL << ".executeEvent(): UNKNOWN Exception thrown by "
61 << m_algorithm->name() << endmsg;
62 eventfailed = true;
63 }
64
65 // Commit all DataHandles
66 this_algo->commitHandles();
67
68 // DP it is important to propagate the failure of an event.
69 // We need to stop execution when this happens so that execute run can
70 // then receive the FAILURE
71 m_aess->algExecState(ialg,*m_evtCtx).setExecuted(true);
72 m_aess->algExecState(ialg,*m_evtCtx).setExecStatus(sc);
73 m_aess->updateEventStatus(eventfailed,*m_evtCtx);
74
75 // TODO reproduce the commented out functionality in a different service
76 //m_schedSvc->delAlg(this_algo);
77
78 Gaudi::Hive::setCurrentContextEvt(-1);
79
80 return nullptr;
81 }
MsgStream
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
SmartIF< IProperty >
GaudiException
Define general base for Gaudi exception.
Definition: GaudiException.h:23
RetCodeGuard
Helper class to set the application return code in case of early exit (e.g.
Definition: RetCodeGuard.h:9
Algorithm::commitHandles
void commitHandles() override
Definition: Algorithm.cpp:937
StatusCode::FAILURE
Definition: StatusCode.h:29
EventContext::slot
ContextID_t slot() const
Definition: EventContext.h:41
AlgoExecutionTask::m_aess
IAlgExecStateSvc * m_aess
Definition: AlgoExecutionTask.h:31
AlgoExecutionTask::m_serviceLocator
SmartIF< ISvcLocator > m_serviceLocator
Definition: AlgoExecutionTask.h:32
AlgExecState::setExecStatus
void setExecStatus(const StatusCode &sc=StatusCode::SUCCESS)
Definition: IAlgExecStateSvc.h:39
UNLIKELY
#define UNLIKELY(x)
Definition: Kernel.h:126
AlgoExecutionTask::m_algorithm
SmartIF< IAlgorithm > m_algorithm
Definition: AlgoExecutionTask.h:28
Gaudi::ReturnCode::UnhandledException
constexpr int UnhandledException
Definition: AppReturnCode.h:29
SmartIF::get
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:76
MSG::FATAL
Definition: IMessageSvc.h:22
IHiveWhiteBoard::selectStore
virtual StatusCode selectStore(size_t partitionIndex)=0
Activate an given &#39;slot&#39; for all subsequent calls within the same thread id.
std::exception::what
T what(T...args)
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
IAlgExecStateSvc::algExecState
virtual const AlgExecState & algExecState(const Gaudi::StringKey &algName, const EventContext &ctx) const =0
IAlgorithm::sysExecute
virtual StatusCode sysExecute(const EventContext &)=0
System execution. This method invokes the execute() method of a concrete algorithm.
GaudiException::tag
virtual const std::string & tag() const
name tag for the exception, or exception type
Definition: GaudiException.h:119
AlgExecState::setExecuted
void setExecuted(bool e=true)
Definition: IAlgExecStateSvc.h:38
std::exception
STL class.
IAlgorithm
The IAlgorithm is the interface implemented by the Algorithm base class.
Definition: IAlgorithm.h:27
Gaudi::Hive::setCurrentContext
GAUDI_API void setCurrentContext(const EventContext *ctx)
Definition: ThreadLocalContext.cpp:45
IAlgExecStateSvc::updateEventStatus
virtual void updateEventStatus(const bool &b, const EventContext &ctx)=0
Algorithm::whiteboard
SmartIF< IHiveWhiteBoard > & whiteboard() const
Definition: Algorithm.cpp:785
Algorithm
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:78
Gaudi::Hive::setCurrentContextEvt
GAUDI_API void setCurrentContextEvt(long int evtN)
Definition: ThreadLocalContext.cpp:28
MSG::ERROR
Definition: IMessageSvc.h:21
AlgoExecutionTask::m_evtCtx
EventContext * m_evtCtx
Definition: AlgoExecutionTask.h:29
MSG::WARNING
Definition: IMessageSvc.h:20
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
Gaudi.Configuration.log
log
Definition: Configuration.py:13
EventContext::valid
bool valid() const
Definition: EventContext.h:42

## Member Data Documentation

IAlgExecStateSvc* AlgoExecutionTask::m_aess
| private

Definition at line 31 of file AlgoExecutionTask.h.

const unsigned int AlgoExecutionTask::m_algoIndex
| private

Definition at line 30 of file AlgoExecutionTask.h.

SmartIF<IAlgorithm> AlgoExecutionTask::m_algorithm
| private

Definition at line 28 of file AlgoExecutionTask.h.

EventContext* AlgoExecutionTask::m_evtCtx
| private

Definition at line 29 of file AlgoExecutionTask.h.

SmartIF<ISvcLocator> AlgoExecutionTask::m_serviceLocator
| private

Definition at line 32 of file AlgoExecutionTask.h.

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

- GaudiHive/src/AlgoExecutionTask.h
- GaudiHive/src/AlgoExecutionTask.cpp