diff --git a/distributed/deploy/ssh.py b/distributed/deploy/ssh.py index 1f35d7e9672..d5e4f93d832 100644 --- a/distributed/deploy/ssh.py +++ b/distributed/deploy/ssh.py @@ -32,12 +32,15 @@ def __init__(self, **kwargs): async def start(self): assert self.connection weakref.finalize( - self, self.proc.kill - ) # https://github.com/ronf/asyncssh/issues/112 + self, self.proc.stdin.write, "\x03" + ) # Workaround from https://github.com/ronf/asyncssh/issues/112 await super().start() async def close(self): - self.proc.kill() # https://github.com/ronf/asyncssh/issues/112 + # Workaround from https://github.com/ronf/asyncssh/issues/112 + await self.proc.stdin.write("\x03") + await self.proc.wait_closed() + self.connection.close() await super().close() @@ -120,7 +123,7 @@ async def start(self): + cli_keywords(self.kwargs, cls=_Worker, cmd=self.worker_module) ) - self.proc = await self.connection.create_process(cmd) + self.proc = await self.connection.create_process(cmd, term_type="ansi") # We watch stderr in order to get the address, then we return while True: @@ -194,7 +197,7 @@ async def start(self): ] + cli_keywords(self.kwargs, cls=_Scheduler) ) - self.proc = await self.connection.create_process(cmd) + self.proc = await self.connection.create_process(cmd, term_type="ansi") # We watch stderr in order to get the address, then we return while True: