From f36c1ed7c89e87d2225af955345692c31956b8cf Mon Sep 17 00:00:00 2001 From: Christopher Spinrath <christopher.spinrath@univ-grenoble-alpes.fr> Date: Wed, 19 Feb 2025 19:10:59 +0100 Subject: [PATCH] Implement a poor man's timeout for tasks --- run-exp.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/run-exp.py b/run-exp.py index 4f3a5f9..c1c1312 100755 --- a/run-exp.py +++ b/run-exp.py @@ -103,7 +103,17 @@ class Task: # print(" ".join(args)) # print("popd") - subprocess.run(" ".join(args), shell = True, cwd = self._work_dir) + try: + subprocess.run( + " ".join(args), + shell = True, + cwd = self._work_dir, + timeout = 3600, # FIXME + ) + except subprocess.TimeoutExpired: + print() + print("Task timed out!") + print() @classmethod def from_dict(cls, data): -- GitLab