From c574a4d0862cdaf219236837d03cb0f573feeee5 Mon Sep 17 00:00:00 2001 From: BathreeNode <101283333+batuhankocyigit@users.noreply.github.com> Date: Mon, 2 Mar 2026 12:16:07 +0300 Subject: [PATCH] fix(batch_runner): log traceback when worker raises during imap_unordered If any worker raises inside pool.imap_unordered(), the exception propagates through the for loop and the results list is left incomplete. The finally block correctly restores the log level but the error is swallowed with no diagnostic information. Added an explicit except block that logs the full traceback via exc_info=True before re-raising, making batch worker failures visible in logs without changing the existing control flow. --- batch_runner.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/batch_runner.py b/batch_runner.py index 9bc7a14ca..23eeec48e 100644 --- a/batch_runner.py +++ b/batch_runner.py @@ -914,6 +914,9 @@ class BatchRunner: for result in pool.imap_unordered(_process_batch_worker, tasks): results.append(result) progress.update(task, advance=1) + except Exception as e: + logger.error("Batch worker failed: %s", e, exc_info=True) + raise finally: root_logger.setLevel(original_level)