From de30a4b0603e18b35956ab1656c6a85303ce7f18 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Sun, 22 Nov 2015 23:26:32 +0800 Subject: [PATCH] master/worker: print short exception info in first log entry of worker error --- artiq/master/worker_impl.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/artiq/master/worker_impl.py b/artiq/master/worker_impl.py index 188c24b79..4edc52cbe 100644 --- a/artiq/master/worker_impl.py +++ b/artiq/master/worker_impl.py @@ -221,8 +221,13 @@ def main(): put_object({"action": "completed"}) elif action == "terminate": break - except: - logging.error("Worker terminating with exception", exc_info=True) + except Exception as exc: + short_exc_info = type(exc).__name__ + exc_str = str(exc) + if exc_str: + short_exc_info += ": " + exc_str + logging.error("Terminating with exception (%s)", + short_exc_info, exc_info=True) finally: device_mgr.close_devices()