Fix Process Pool hangs at exit (#674)

This commit is contained in:
allegroai 2022-05-17 14:52:54 +03:00
parent 72eb59c9ca
commit ab2ab50e4c
3 changed files with 4 additions and 5 deletions

View File

@ -1,4 +1,5 @@
import os
from time import sleep
import six
@ -106,7 +107,7 @@ class PatchOsFork(object):
# just make sure we flush the internal state (the at exist caught by the external signal does the rest
# in theory we should not have to do any of that, but for some reason if we do not
# the signal is never caught by the signal call backs, not sure why....
sleep(0.1)
# Since at_exist handlers do not work on forked processes, we have to manually call them here
if task:
try:

View File

@ -3460,6 +3460,7 @@ class Task(_Task):
elif task_status[0] == 'failed':
self.mark_failed(status_reason=task_status[1])
elif task_status[0] == 'completed':
self.set_progress(100)
self.mark_completed()
elif task_status[0] == 'stopped':
self.stopped()
@ -3497,9 +3498,6 @@ class Task(_Task):
pass
self._edit_lock = None
if task_status and task_status[0] == "completed":
self.set_progress(100)
# make sure no one will re-enter the shutdown method
self._at_exit_called = True
if not is_sub_process and BackgroundMonitor.is_subprocess_enabled():

View File

@ -1 +1 @@
__version__ = '1.4.0'
__version__ = '1.4.1'