The Gaudi Framework  master (1304469f)
Loading...
Searching...
No Matches
event_timeout_check Namespace Reference

Functions

list[Configurable] base_config ()
 
list[Configurable] add_event_timeout (list[Configurable] conf, int timeout_seconds)
 
 config ()
 

Function Documentation

◆ add_event_timeout()

list[Configurable] event_timeout_check.add_event_timeout ( list[Configurable] conf,
int timeout_seconds )
Take a configuration and adds a check on events reaching a timeout.

Definition at line 47 of file event_timeout_check.py.

49) -> list[Configurable]:
50 """
51 Take a configuration and adds a check on events reaching a timeout.
52 """
53 # find the ApplicationMgr as we have to tweak its configuration
54 app = next(c for c in conf if c.name == "ApplicationMgr")
55 # configure a Gaudi::EventWatchdogAlg
56 watchdog = C.Gaudi.EventWatchdogAlg(
57 EventTimeout=timeout_seconds, # sleep for this number of seconds
58 StackTrace=False, # no stack trace (may be slow, see issue #349)
59 AbortOnTimeout=True, # kill the process on timeout
60 )
61 # wrap original list of algorithms into a sequence to ensure the watchdog
62 # is executed before everything else
63 wrapping_seq = C.Gaudi.Sequencer(
64 "SequenceWithTimeout", Sequential=True, Members=[watchdog] + list(app.TopAlg)
65 )
66 # reset the main list of algorithms
67 app.TopAlg = [wrapping_seq]
68 # return the tweaked configuration
69 return conf + [watchdog, wrapping_seq]
70
71

◆ base_config()

list[Configurable] event_timeout_check.base_config ( )
Example configuration of a job with no input and a algorithm that looks stuck.

Definition at line 36 of file event_timeout_check.py.

36def base_config() -> list[Configurable]:
37 """
38 Example configuration of a job with no input and a algorithm that looks stuck.
39 """
40 algorithms = [C.GaudiTesting.SleepyAlg("StuckAlg", SleepTime=3600)]
41 app = C.ApplicationMgr(
42 EvtSel="NONE", TopAlg=[C.Gaudi.Sequencer("MainSequence", Members=algorithms)]
43 )
44 return [app] + list(app.TopAlg) + algorithms
45
46

◆ config()

event_timeout_check.config ( )

Definition at line 72 of file event_timeout_check.py.

72def config():
73 # get the normal job configuration
74 conf = base_config()
75 # make sure we stop if an event takes more than 2s
76 conf = add_event_timeout(conf, 2)
77 return conf