Fix exception handling
This commit is contained in:
parent
835f9b4ba0
commit
9866b88faf
2 changed files with 17 additions and 15 deletions
|
|
@ -106,10 +106,14 @@ def parallel_map(
|
|||
unordered=unordered,
|
||||
ignore_exceptions=ignore_exceptions,
|
||||
)
|
||||
finally:
|
||||
should_stop.set()
|
||||
for p in processes:
|
||||
p.join()
|
||||
p.close()
|
||||
except:
|
||||
for p in processes:
|
||||
p.terminate()
|
||||
raise
|
||||
finally:
|
||||
input_queue.close()
|
||||
output_queue.close()
|
||||
|
|
|
|||
|
|
@ -94,17 +94,15 @@ def threaded_parallel_map(
|
|||
for t in threads:
|
||||
t.start()
|
||||
|
||||
try:
|
||||
yield from manage_communication(
|
||||
tqdm_options=tqdm_options,
|
||||
input_values=input_values,
|
||||
chunk_size=config.chunk_size,
|
||||
input_queue=input_queue,
|
||||
output_queue=output_queue,
|
||||
unordered=unordered,
|
||||
ignore_exceptions=ignore_exceptions,
|
||||
)
|
||||
finally:
|
||||
should_stop.set()
|
||||
for t in threads:
|
||||
t.join()
|
||||
yield from manage_communication(
|
||||
tqdm_options=tqdm_options,
|
||||
input_values=input_values,
|
||||
chunk_size=config.chunk_size,
|
||||
input_queue=input_queue,
|
||||
output_queue=output_queue,
|
||||
unordered=unordered,
|
||||
ignore_exceptions=ignore_exceptions,
|
||||
)
|
||||
should_stop.set()
|
||||
for t in threads:
|
||||
t.join()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue