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,
|
unordered=unordered,
|
||||||
ignore_exceptions=ignore_exceptions,
|
ignore_exceptions=ignore_exceptions,
|
||||||
)
|
)
|
||||||
finally:
|
|
||||||
should_stop.set()
|
should_stop.set()
|
||||||
for p in processes:
|
for p in processes:
|
||||||
p.join()
|
p.join()
|
||||||
p.close()
|
p.close()
|
||||||
|
except:
|
||||||
|
for p in processes:
|
||||||
|
p.terminate()
|
||||||
|
raise
|
||||||
|
finally:
|
||||||
input_queue.close()
|
input_queue.close()
|
||||||
output_queue.close()
|
output_queue.close()
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,6 @@ def threaded_parallel_map(
|
||||||
for t in threads:
|
for t in threads:
|
||||||
t.start()
|
t.start()
|
||||||
|
|
||||||
try:
|
|
||||||
yield from manage_communication(
|
yield from manage_communication(
|
||||||
tqdm_options=tqdm_options,
|
tqdm_options=tqdm_options,
|
||||||
input_values=input_values,
|
input_values=input_values,
|
||||||
|
|
@ -104,7 +103,6 @@ def threaded_parallel_map(
|
||||||
unordered=unordered,
|
unordered=unordered,
|
||||||
ignore_exceptions=ignore_exceptions,
|
ignore_exceptions=ignore_exceptions,
|
||||||
)
|
)
|
||||||
finally:
|
|
||||||
should_stop.set()
|
should_stop.set()
|
||||||
for t in threads:
|
for t in threads:
|
||||||
t.join()
|
t.join()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue