From 03fc475f3e190c4e351a215ae8f566e9732fea90 Mon Sep 17 00:00:00 2001 From: Rafal Bielski <rafal.bielski@cern.ch> Date: Mon, 23 Nov 2020 18:57:29 +0100 Subject: [PATCH] DecisionHandling: Catch soft timeout in Filter algorithms --- Trigger/TrigSteer/DecisionHandling/CMakeLists.txt | 2 +- Trigger/TrigSteer/DecisionHandling/src/PassFilter.cxx | 8 +++++++- Trigger/TrigSteer/DecisionHandling/src/RoRSeqFilter.cxx | 6 ++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Trigger/TrigSteer/DecisionHandling/CMakeLists.txt b/Trigger/TrigSteer/DecisionHandling/CMakeLists.txt index bc4fa0e1618..df1e4db654b 100644 --- a/Trigger/TrigSteer/DecisionHandling/CMakeLists.txt +++ b/Trigger/TrigSteer/DecisionHandling/CMakeLists.txt @@ -27,7 +27,7 @@ atlas_add_component( DecisionHandling src/TestHypoTool.cxx src/TestHypoAlg.cxx src/PassFilter.cxx - LINK_LIBRARIES DecisionHandlingLib xAODTrigCalo AthViews xAODTracking xAODJet ) + LINK_LIBRARIES DecisionHandlingLib AthenaKernel xAODTrigCalo AthViews xAODTracking xAODJet ) atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) atlas_install_joboptions( share/*.py ) diff --git a/Trigger/TrigSteer/DecisionHandling/src/PassFilter.cxx b/Trigger/TrigSteer/DecisionHandling/src/PassFilter.cxx index 6b89d26bb40..e1f25410f67 100644 --- a/Trigger/TrigSteer/DecisionHandling/src/PassFilter.cxx +++ b/Trigger/TrigSteer/DecisionHandling/src/PassFilter.cxx @@ -3,6 +3,8 @@ */ #include "PassFilter.h" +#include "AthenaKernel/Timeout.h" +#include "AthenaKernel/AthStatusCode.h" PassFilter::PassFilter(const std::string& name, ISvcLocator* pSvcLocator) : AthReentrantAlgorithm(name, pSvcLocator) @@ -23,8 +25,12 @@ StatusCode PassFilter::finalize() return StatusCode::SUCCESS; } -StatusCode PassFilter::execute(const EventContext&) const +StatusCode PassFilter::execute(const EventContext& ctx) const { + if (Athena::Timeout::instance(ctx).reached()) { + ATH_MSG_ERROR("Timeout reached before " << name()); + return Athena::Status::TIMEOUT; + } return StatusCode::SUCCESS; } diff --git a/Trigger/TrigSteer/DecisionHandling/src/RoRSeqFilter.cxx b/Trigger/TrigSteer/DecisionHandling/src/RoRSeqFilter.cxx index 7a34923d7d9..2cf2efa164c 100644 --- a/Trigger/TrigSteer/DecisionHandling/src/RoRSeqFilter.cxx +++ b/Trigger/TrigSteer/DecisionHandling/src/RoRSeqFilter.cxx @@ -4,6 +4,8 @@ // DecisionHandling includes #include "RoRSeqFilter.h" +#include "AthenaKernel/Timeout.h" +#include "AthenaKernel/AthStatusCode.h" #include "AthenaMonitoringKernel/Monitored.h" #include "Gaudi/Property.h" @@ -110,6 +112,10 @@ StatusCode RoRSeqFilter::initialize() StatusCode RoRSeqFilter::execute( const EventContext& ctx ) const { ATH_MSG_DEBUG ( "Executing " << name() << "..." ); + if (Athena::Timeout::instance(ctx).reached()) { + ATH_MSG_ERROR("Timeout reached before " << name()); + return Athena::Status::TIMEOUT; + } auto inputHandles = m_inputKeys.makeHandles( ctx ); auto outputHandles = m_outputKeys.makeHandles( ctx ); -- GitLab