From 4ef050147556c3e751194f20887a9b27dff3a366 Mon Sep 17 00:00:00 2001 From: Helmut Grohne Date: Thu, 30 Dec 2021 18:02:23 +0100 Subject: multiarchimport.py: log exceptions from worker processes --- multiarchimport.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/multiarchimport.py b/multiarchimport.py index af9d1c1..7271410 100755 --- a/multiarchimport.py +++ b/multiarchimport.py @@ -151,10 +151,13 @@ def bounded_imap_unordered(bound, pool, function, iterable): iterable = iter(iterable) results = queue.Queue() outstanding = 0 + def error_callback(exception): + logging.exception("worker exception", exc_info=exception) while iterable or outstanding: if iterable: for elem in iterable: - pool.apply_async(function, (elem,), callback=results.put) + pool.apply_async(function, (elem,), callback=results.put, + error_callback=error_callback) outstanding += 1 if outstanding >= bound or not results.empty(): break -- cgit v1.2.3