From f722be819fb86d8c9a56ef1320c99cfe23047442 Mon Sep 17 00:00:00 2001
From: Christopher Spinrath <christopher.spinrath@univ-grenoble-alpes.fr>
Date: Thu, 20 Mar 2025 16:03:29 +0100
Subject: [PATCH] Do not repeat experiments if they time out

---
 run-exp.py | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/run-exp.py b/run-exp.py
index c1c1312..f9072d7 100755
--- a/run-exp.py
+++ b/run-exp.py
@@ -110,11 +110,15 @@ class Task:
                 cwd = self._work_dir,
                 timeout = 3600,  # FIXME
             )
+
+            return False
         except subprocess.TimeoutExpired:
             print()
             print("Task timed out!")
             print()
 
+            return True
+
     @classmethod
     def from_dict(cls, data):
         name = data.get("name", "Unnamed Task")
@@ -194,10 +198,16 @@ def main(config_file):
 
         for rep in range(c.repetitions):
             print(f"Repetition {rep}")
+            timed_out = False
+
             for task in c.tasks:
                 print(f"Running task {task.name}")
-                task.run(variables)
+                timed_out = task.run(variables)
             print()
 
+            if timed_out:  # repetitions are useless if tasks time out
+                break
+
+
 if __name__ == "__main__":
     main()
-- 
GitLab