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:
BathreeNode 2026-03-02 12:16:07 +03:00 committed by GitHub
parent bd8b20b933
commit c574a4d086
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -914,6 +914,9 @@ class BatchRunner:
for result in pool.imap_unordered(_process_batch_worker, tasks): for result in pool.imap_unordered(_process_batch_worker, tasks):
results.append(result) results.append(result)
progress.update(task, advance=1) progress.update(task, advance=1)
except Exception as e:
logger.error("Batch worker failed: %s", e, exc_info=True)
raise
finally: finally:
root_logger.setLevel(original_level) root_logger.setLevel(original_level)