diff --git a/distributed/deploy/subprocess.py b/distributed/deploy/subprocess.py index b58f33a9e08..0b4323ba107 100644 --- a/distributed/deploy/subprocess.py +++ b/distributed/deploy/subprocess.py @@ -7,6 +7,7 @@ import math from typing import Any +import psutil import toolz from dask.system import CPU_COUNT @@ -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