From e0f4fce50e9e57f6143d0f655492ed41f9a99fb6 Mon Sep 17 00:00:00 2001
From: Frank Winklmeier <frank.winklmeier@cern.ch>
Date: Thu, 23 May 2024 09:40:50 +0200
Subject: [PATCH] AthenaConfiguration: add flag to configure event timeout

Add `Exec.EventTimeOut` flags to configure the per-event timeout on the
master sequence.

Closes ATEAM-981.
---
 Control/AthenaConfiguration/python/AllConfigFlags.py     | 1 +
 Control/AthenaConfiguration/python/MainServicesConfig.py | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/Control/AthenaConfiguration/python/AllConfigFlags.py b/Control/AthenaConfiguration/python/AllConfigFlags.py
index 162491a80ca2..1a01b6274027 100644
--- a/Control/AthenaConfiguration/python/AllConfigFlags.py
+++ b/Control/AthenaConfiguration/python/AllConfigFlags.py
@@ -29,6 +29,7 @@ def initConfigFlags():
     acf.addFlag('Exec.DebugStage', '', help='attach debugger at stage: conf, init, exec, fini')
     acf.addFlag('Exec.Interactive', "", help='interactive prompt at stage: init, exec')
     acf.addFlag('Exec.FPE', 0, help='FPE check mode: -2 (no FPE check), -1 (abort with core-dump), 0 (FPE Auditor w/o stack-tace) , >0 (number of stack-traces printed by the job)')
+    acf.addFlag('Exec.EventTimeOut', 0, help='per-event timeout (in ns) after which the job is aborted (0 means no timeout)')
 
     #Custom messaging for components, see Utils.setupLoggingLevels
     acf.addFlag('Exec.VerboseMessageComponents', [], help='verbose output for listed components (wildcards)')
diff --git a/Control/AthenaConfiguration/python/MainServicesConfig.py b/Control/AthenaConfiguration/python/MainServicesConfig.py
index 7b1cb5bdfaa8..cc3881b5948b 100644
--- a/Control/AthenaConfiguration/python/MainServicesConfig.py
+++ b/Control/AthenaConfiguration/python/MainServicesConfig.py
@@ -6,7 +6,9 @@ from AthenaCommon.Constants import INFO
 
 def MainServicesMiniCfg(flags, loopMgr='AthenaEventLoopMgr', masterSequence='AthAlgSeq'):
     """Mininmal basic config, just good enough for HelloWorld and alike"""
-    cfg = ComponentAccumulator(CompFactory.AthSequencer(masterSequence,Sequential=True))
+    cfg = ComponentAccumulator(CompFactory.AthSequencer(masterSequence,
+                                                        Sequential=True,
+                                                        TimeOut=flags.Exec.EventTimeOut))
     cfg.setAsTopLevel()
     cfg.setAppProperty('TopAlg',['AthSequencer/'+masterSequence])
     cfg.setAppProperty('MessageSvcType', 'MessageSvc')
-- 
GitLab