Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v31r0 (aeb156f0)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
IOBoundAlgTask.cpp
Go to the documentation of this file.
1 // local includes
2 #include "IOBoundAlgTask.h"
3 #include "RetCodeGuard.h"
4 
5 // Framework
10 
12 
13  IAlgorithm* ialg = m_algorithm.get();
14  Algorithm* this_algo = dynamic_cast<Algorithm*>( ialg );
15  if ( !this_algo ) { throw GaudiException( "Cast to Algorithm failed!", "AlgoExecutionTask", StatusCode::FAILURE ); }
16 
17  bool eventfailed = false;
19 
20  // Get the IProperty interface of the ApplicationMgr to pass it to RetCodeGuard
21  const SmartIF<IProperty> appmgr( m_serviceLocator );
22 
24  MsgStream log( messageSvc, "AccelAlgoExecutionTask" );
25 
26  // select the appropriate store
27  this_algo->whiteboard()->selectStore( m_evtCtx.valid() ? m_evtCtx.slot() : 0 ).ignore();
28 
30  try {
32  log << MSG::DEBUG << "Starting execution of algorithm " << m_algorithm->name() << endmsg;
34  if ( UNLIKELY( !sc.isSuccess() ) ) {
35  log << MSG::WARNING << "Execution of algorithm " << m_algorithm->name() << " failed" << endmsg;
36  eventfailed = true;
37  }
38  log << MSG::DEBUG << "Stopped execution of algorithm " << m_algorithm->name() << endmsg;
39  rcg.ignore(); // disarm the guard
40  } catch ( const GaudiException& Exception ) {
41  log << MSG::FATAL << ".executeEvent(): Exception with tag=" << Exception.tag() << " thrown by "
42  << m_algorithm->name() << endmsg;
43  log << MSG::ERROR << Exception << endmsg;
44  eventfailed = true;
45  } catch ( const std::exception& Exception ) {
46  log << MSG::FATAL << ".executeEvent(): Standard std::exception thrown by " << m_algorithm->name() << endmsg;
47  log << MSG::ERROR << Exception.what() << endmsg;
48  eventfailed = true;
49  } catch ( ... ) {
50  log << MSG::FATAL << ".executeEvent(): UNKNOWN Exception thrown by " << m_algorithm->name() << endmsg;
51  eventfailed = true;
52  }
53 
54  // DP it is important to propagate the failure of an event.
55  // We need to stop execution when this happens so that execute run can
56  // then receive the FAILURE
57  m_aess->updateEventStatus( eventfailed, m_evtCtx );
58 
59  // update scheduler state
61 
63 
64  return sc;
65 }
#define UNLIKELY(x)
Definition: Kernel.h:89
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
Define general base for Gaudi exception.
SmartIF< IAlgorithm > m_algorithm
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:48
bool isSuccess() const
Definition: StatusCode.h:267
StatusCode execute() override final
SmartIF< IHiveWhiteBoard > & whiteboard() const
Definition: Algorithm.cpp:677
constexpr int UnhandledException
Definition: AppReturnCode.h:27
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:76
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:50
const EventContext & m_evtCtx
virtual StatusCode sysExecute(const EventContext &)=0
System execution. This method invokes the execute() method of a concrete algorithm.
SmartIF< ISvcLocator > m_serviceLocator
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
IAlgExecStateSvc * m_aess
Alias for backward compatibility.
Definition: Algorithm.h:56
constexpr static const auto FAILURE
Definition: StatusCode.h:86
GAUDI_API void setCurrentContextEvt(long int evtN)
std::function< StatusCode()> m_promote2ExecutedClosure
void ignore()
Definition: RetCodeGuard.h:12
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192
bool valid() const
Definition: EventContext.h:51