utils: collect return value from map

Zip it together with the targets list and return back
to the caller so he can use it if he wants.

Signed-off-by: Ruslan Kuprieiev <[email protected]>
This commit is contained in:
Ruslan Kuprieiev
2017-08-19 20:10:24 +03:00
parent 5f7f608529
commit ec76c1aa8a
+3 -1
View File
@@ -68,8 +68,10 @@ def map_progress(func, targets, n_threads):
p = ThreadPool(processes=n_threads)
try:
p.map(func, targets)
ret = p.map(func, targets)
except Exception as exc:
Logger.error('Unexpected exception while processing targets: {}'.format(exc))
finally:
progress.finish()
return zip(targets, ret)