From f6fe1cff566bbb8e7ca4cc6e517a8ec0a9604136 Mon Sep 17 00:00:00 2001 From: allegroai <> Date: Mon, 20 May 2024 15:52:46 +0300 Subject: [PATCH] Add more verbose error on --verbose --- clearml_session/__main__.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/clearml_session/__main__.py b/clearml_session/__main__.py index 5eb14d4..2fb9aa1 100644 --- a/clearml_session/__main__.py +++ b/clearml_session/__main__.py @@ -843,10 +843,12 @@ def start_ssh_tunnel(username, remote_address, ssh_port, ssh_password, local_rem # store SSH output fd = StringIO() if debug else sys.stdout + command = None # noinspection PyBroadException try: + command = _check_ssh_executable() child = pexpect.spawn( - command=_check_ssh_executable(), + command=command, args=args, logfile=fd, timeout=20, encoding='utf-8') @@ -880,8 +882,14 @@ def start_ssh_tunnel(username, remote_address, ssh_port, ssh_password, local_rem raise ValueError('Incorrect password') except pexpect.TIMEOUT: pass - except Exception: - child.terminate(force=True) + except Exception as ex: + if debug: + print("ERROR: running local SSH client [{}] failed connecting to {}: {}".format(command, args, ex)) + else: + print("ERROR: running local SSH client failed connecting to {}: {}".format(remote_address, ex)) + + if child: + child.terminate(force=True) child = None print('\n') if child: