Skip to content

Commit

Permalink
Kill all subprocesses
Browse files Browse the repository at this point in the history
  • Loading branch information
hendrikmakait committed Dec 23, 2022
1 parent 6e28443 commit 3a2d42d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions distributed/deploy/subprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import math
from typing import Any

import psutil
import toolz

from dask.system import CPU_COUNT
Expand Down Expand Up @@ -70,6 +71,8 @@ async def start(self) -> None:

async def close(self) -> None:
if self.process and self.process.returncode is None:
for child in psutil.Process(self.process.pid).children(recursive=True):
child.kill()
self.process.kill()
await self.process.wait()
self.process = None
Expand Down

0 comments on commit 3a2d42d

Please sign in to comment.