From 240b238cac4cea5fb4413eb01b0fae55bbb511bf Mon Sep 17 00:00:00 2001 From: Charles Baynham Date: Mon, 26 Feb 2024 16:23:16 +0000 Subject: [PATCH] worker_impl - try/catch for exceptions in notify_run_end to avoid data loss --- artiq/master/worker_impl.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/artiq/master/worker_impl.py b/artiq/master/worker_impl.py index 9f928b4d0..d185202af 100644 --- a/artiq/master/worker_impl.py +++ b/artiq/master/worker_impl.py @@ -362,7 +362,13 @@ def main(): write_results() raise finally: - device_mgr.notify_run_end() + try: + device_mgr.notify_run_end() + except: + # Also write results immediately if the `notify_run_end` + # callbacks produce an exception + write_results() + raise put_completed() elif action == "analyze": try: