| The Gaudi Framework v30r0 (c919700c)

- 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
IOBoundAlgTask Class Reference

Wrapper around I/O-bound Gaudi-algorithms. More...

`#include <GaudiHive/src/IOBoundAlgTask.h>`

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

## Public Member Functions
| IOBoundAlgTask (IAlgorithm *algorithm, EventContext *ctx, ISvcLocator *svcLocator, IAlgExecStateSvc *aem)
| ~IOBoundAlgTask () override
virtual StatusCode | execute () override
Public Member Functions inherited from IAlgTask
virtual | ~IAlgTask ()=default

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

## Detailed Description

Wrapper around I/O-bound Gaudi-algorithms.

It may also cover the accelerator-targeted algorithms. It must be used to prepare algorithms before sending them to I/O-bound scheduler.

Author
  Illya Shapoval

Version
  1.0

Definition at line 21 of file IOBoundAlgTask.h.

## Constructor & Destructor Documentation

IOBoundAlgTask::IOBoundAlgTask | ( | IAlgorithm * | algorithm,
|  | EventContext * | ctx,
|  | ISvcLocator * | svcLocator,
|  | IAlgExecStateSvc * | aem
| ) |  |
| inline

Definition at line 24 of file IOBoundAlgTask.h.

25 : m_algorithm( algorithm ), m_evtCtx( ctx ), m_aess( aem ), m_serviceLocator( svcLocator )
26 {
27 }
IOBoundAlgTask::m_algorithm
SmartIF< IAlgorithm > m_algorithm
Definition: IOBoundAlgTask.h:34
IOBoundAlgTask::m_evtCtx
EventContext * m_evtCtx
Definition: IOBoundAlgTask.h:35
IOBoundAlgTask::m_serviceLocator
SmartIF< ISvcLocator > m_serviceLocator
Definition: IOBoundAlgTask.h:37
IOBoundAlgTask::m_aess
IAlgExecStateSvc * m_aess
Definition: IOBoundAlgTask.h:36

IOBoundAlgTask::~IOBoundAlgTask | ( |  | ) |
| inline override

Definition at line 29 of file IOBoundAlgTask.h.

29 {}

## Member Function Documentation

StatusCode IOBoundAlgTask::execute | ( |  | ) |
| override virtual

Implements IAlgTask.

Definition at line 13 of file IOBoundAlgTask.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", StatusCode::FAILURE );
20 }
21
22 bool eventfailed = false;
23 Gaudi::Hive::setCurrentContext( m_evtCtx );
24
25 // TODO reproduce the commented out functionality in a different service
26 // m_schedSvc->addAlg(this_algo, m_evtCtx, pthread_self());
27
28 // Get the IProperty interface of the ApplicationMgr to pass it to RetCodeGuard
29 const SmartIF<IProperty> appmgr( m_serviceLocator );
30
31 SmartIF<IMessageSvc> messageSvc( m_serviceLocator );
32 MsgStream log( messageSvc, "AccelAlgoExecutionTask" );
33
34 // select the appropriate store
35 this_algo->whiteboard()->selectStore( m_evtCtx->valid() ? m_evtCtx->slot() : 0 ).ignore();
36
37 StatusCode sc( StatusCode::FAILURE );
38 try {
39 RetCodeGuard rcg( appmgr, Gaudi::ReturnCode::UnhandledException );
40 log << MSG::DEBUG << "Starting execution of algorithm " << m_algorithm->name() << endmsg;
41 m_aess->algExecState( ialg, *m_evtCtx ).setState( AlgExecState::State::Executing );
42 sc = m_algorithm->sysExecute( *m_evtCtx );
43 if ( UNLIKELY( !sc.isSuccess() ) ) {
44 log << MSG::WARNING << "Execution of algorithm " << m_algorithm->name() << " failed" << endmsg;
45 eventfailed = true;
46 }
47 log << MSG::DEBUG << "Stopped execution of algorithm " << m_algorithm->name() << endmsg;
48 rcg.ignore(); // disarm the guard
49 } catch ( const GaudiException& Exception ) {
50 log << MSG::FATAL << ".executeEvent(): Exception with tag=" << Exception.tag() << " thrown by "
51 << 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 " << m_algorithm->name() << endmsg;
56 log << MSG::ERROR << Exception.what() << endmsg;
57 eventfailed = true;
58 } catch ( ... ) {
59 log << MSG::FATAL << ".executeEvent(): UNKNOWN Exception thrown by " << m_algorithm->name() << endmsg;
60 eventfailed = true;
61 }
62
63 // Commit all DataHandles
64 this_algo->commitHandles();
65
66 // DP it is important to propagate the failure of an event.
67 // We need to stop execution when this happens so that execute run can
68 // then receive the FAILURE
69 m_aess->algExecState( ialg, *m_evtCtx ).setState( AlgExecState::State::Done, sc );
70 m_aess->updateEventStatus( eventfailed, *m_evtCtx );
71
72 // TODO reproduce the commented out functionality in a different service
73 // m_schedSvc->delAlg(this_algo);
74
75 Gaudi::Hive::setCurrentContextEvt( -1 );
76
77 return sc;
78 }
UNLIKELY
#define UNLIKELY(x)
Definition: Kernel.h:128
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:22
IOBoundAlgTask::m_algorithm
SmartIF< IAlgorithm > m_algorithm
Definition: IOBoundAlgTask.h:34
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:971
EventContext::slot
ContextID_t slot() const
Definition: EventContext.h:40
IOBoundAlgTask::m_evtCtx
EventContext * m_evtCtx
Definition: IOBoundAlgTask.h:35
MSG::DEBUG
Definition: IMessageSvc.h:16
AlgExecState::setState
void setState(State s)
Definition: IAlgExecStateSvc.h:37
Gaudi::ReturnCode::UnhandledException
constexpr int UnhandledException
Definition: AppReturnCode.h:29
SmartIF::get
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:82
MSG::FATAL
Definition: IMessageSvc.h:16
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.
IOBoundAlgTask::m_serviceLocator
SmartIF< ISvcLocator > m_serviceLocator
Definition: IOBoundAlgTask.h:37
GaudiException::tag
virtual const std::string & tag() const
name tag for the exception, or exception type
Definition: GaudiException.h:109
std::exception
STL class.
IAlgorithm
The IAlgorithm is the interface implemented by the Algorithm base class.
Definition: IAlgorithm.h:28
Gaudi::Hive::setCurrentContext
GAUDI_API void setCurrentContext(const EventContext *ctx)
Definition: ThreadLocalContext.cpp:35
IAlgExecStateSvc::updateEventStatus
virtual void updateEventStatus(const bool &b, const EventContext &ctx)=0
Algorithm::whiteboard
SmartIF< IHiveWhiteBoard > & whiteboard() const
Definition: Algorithm.cpp:813
IOBoundAlgTask::m_aess
IAlgExecStateSvc * m_aess
Definition: IOBoundAlgTask.h:36
Algorithm
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:79
Gaudi::Hive::setCurrentContextEvt
GAUDI_API void setCurrentContextEvt(long int evtN)
Definition: ThreadLocalContext.cpp:26
MSG::ERROR
Definition: IMessageSvc.h:16
MSG::WARNING
Definition: IMessageSvc.h:16
StatusCode::FAILURE
Definition: StatusCode.h:29
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
Gaudi.Configuration.log
log
Definition: Configuration.py:13
EventContext::valid
bool valid() const
Definition: EventContext.h:41

## Member Data Documentation

IAlgExecStateSvc* IOBoundAlgTask::m_aess
| private

Definition at line 36 of file IOBoundAlgTask.h.

SmartIF<IAlgorithm> IOBoundAlgTask::m_algorithm
| private

Definition at line 34 of file IOBoundAlgTask.h.

EventContext* IOBoundAlgTask::m_evtCtx
| private

Definition at line 35 of file IOBoundAlgTask.h.

SmartIF<ISvcLocator> IOBoundAlgTask::m_serviceLocator
| private

Definition at line 37 of file IOBoundAlgTask.h.

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

- GaudiHive/src/IOBoundAlgTask.h
- GaudiHive/src/IOBoundAlgTask.cpp