Skip to content

Commit

Permalink
Close ssh_connection if it is not closed
Browse files Browse the repository at this point in the history
  • Loading branch information
LanderOtto committed Oct 4, 2024
1 parent 93f5834 commit cc71bf6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion streamflow/deployment/connector/ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,10 @@ async def __aenter__(self) -> asyncssh.SSHClientProcess:
f"Error opening SSH session to {context.get_hostname()} "
f"to execute command `{self.command}`: [{coe.code}] {coe.reason}"
)
self._selected_context = None
context.ssh_attempts += 1
await context.close()
self._selected_context = None
self._proc.__aexit(None, None, None)
logger.warning(f"Connection attempt {context.ssh_attempts}")
await asyncio.sleep(self._retry_delay)

Expand Down

0 comments on commit cc71bf6

Please sign in to comment.