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.
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user