40 {
41
43 MsgStream
log( messageSvc,
"AlgTask" );
44
45
46 AvalancheSchedulerSvc::TaskSpec
ts;
51 return;
52 }
53
54 EventContext& evtCtx = *(
ts.contextPtr );
55 IAlgorithm*& iAlgoPtr =
ts.algPtr;
56
57 Gaudi::Algorithm* this_algo = dynamic_cast<Gaudi::Algorithm*>( iAlgoPtr );
58 if ( !this_algo ) {
throw GaudiException(
"Cast to Algorithm failed!",
"AlgTask",
StatusCode::FAILURE ); }
59
60 bool eventfailed = false;
62
63
65
67 log <<
MSG::DEBUG <<
"New thread detected: 0x" << std::hex << pthread_self() << std::dec
68 <<
". Doing thread local initialization." <<
endmsg;
69 if ( SmartIF<IThreadPoolSvc> tps{
m_serviceLocator->service(
"ThreadPoolSvc" ) } ) {
70 tps->initThisThread();
71 } else {
72 log <<
MSG::ERROR <<
"Unable to get the ThreadPoolSvc to trigger thread local initialization" <<
endmsg;
73 throw GaudiException(
"Retrieval of ThreadPoolSvc failed",
"AlgTask",
StatusCode::FAILURE );
74 }
75 }
76
77
79 try {
81
84 eventfailed = true;
85 }
86 rcg.ignore();
87 } catch ( const GaudiException& Exception ) {
91 eventfailed = true;
92 } catch ( const std::exception& Exception ) {
95 eventfailed = true;
96 } catch ( ... ) {
98 eventfailed = true;
99 }
100
101
102 m_aess->updateEventStatus( eventfailed, evtCtx );
103
104
105 m_scheduler->m_algResourcePool->releaseAlgorithm(
ts.algName, iAlgoPtr ).ignore();
106
107
109 [schdlr = this->
m_scheduler, ts = std::move( ts )]() {
return schdlr->signoff( ts ); } );
110
112 }
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
SmartIF< IHiveWhiteBoard > & whiteboard() const
virtual StatusCode sysExecute(const EventContext &)=0
System execution. This method invokes the execute() method of a concrete algorithm.
virtual StatusCode selectStore(size_t partitionIndex)=0
Activate an given 'slot' for all subsequent calls within the same thread id.
const StatusCode & ignore() const
Allow discarding a StatusCode without warning.
constexpr static const auto FAILURE
constexpr int UnhandledException
thread_local bool ThreadInitDone
GAUDI_API void setCurrentContextEvt(long int evtN)
GAUDI_API void setCurrentContext(const EventContext *ctx)