From 3a2d42d1da61f74b9e61c4b493d393ca0f21cd36 Mon Sep 17 00:00:00 2001 From: Hendrik Makait Date: Fri, 23 Dec 2022 14:29:07 +0100 Subject: [PATCH] Kill all subprocesses --- distributed/deploy/subprocess.py | 3 +++ 1 file changed, 3 insertions(+) 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