From 182f6bc89c1ee8701a72e8eee5ee3b663beab802 Mon Sep 17 00:00:00 2001 From: Jonathan Kenyon Date: Tue, 28 May 2024 14:58:09 +0200 Subject: [PATCH] Catch case where PID finishes while processing stats. --- stimela/task_stats.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/stimela/task_stats.py b/stimela/task_stats.py index 217c729..157b185 100644 --- a/stimela/task_stats.py +++ b/stimela/task_stats.py @@ -333,7 +333,10 @@ async def run_process_status_update(): if progress_bar: with contextlib.suppress(asyncio.CancelledError): while True: - update_process_status() + try: + update_process_status() + except psutil.NoSuchProcess: + continue await asyncio.sleep(1) _printed_stats = dict(