concurrent: simplify results loop

This commit is contained in:
James R. Barlow
2021-01-01 00:44:46 -08:00
parent bd0f005861
commit df6e106203

View File

@@ -109,15 +109,11 @@ def exec_progress_pool(
)
try:
results = pool.imap_unordered(task, task_arguments)
while True:
try:
result = results.next()
if task_finished:
task_finished(result, pbar)
else:
pbar.update()
except StopIteration:
break
for result in results:
if task_finished:
task_finished(result, pbar)
else:
pbar.update()
except KeyboardInterrupt:
# Terminate pool so we exit instantly
pool.terminate()