Skip to content

Commit

Permalink
fix(asy): Ensure all processes are well closed.
Browse files Browse the repository at this point in the history
  • Loading branch information
vinci1it2000 committed Nov 19, 2023
1 parent 5bdfebf commit 184136d
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions schedula/utils/asy/executors.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"""
It defines the executors classes.
"""
import time
import functools
from ..cst import EMPTY
from . import _process_funcs
Expand Down Expand Up @@ -68,10 +69,13 @@ def shutdown(self, wait=True):
_wait_fut(tasks)
for fut, task in tasks.items():
_safe_set_exception(fut, ExecutorShutdown)
try:
task.terminate()
except AttributeError:
pass
for _ in range(10):
try:
hasattr(task, 'terminate') and task.terminate()
break
except AttributeError:
time.sleep(0.1)
pass
return tasks

def submit(self, func, *args, **kwargs):
Expand Down

0 comments on commit 184136d

Please sign in to comment.