Skip to content

Commit 098ce4e

Browse files
committed
Increase login timeouts to 60 seconds
While a low timeout minimizes wait time in case a process fails silently and hangs, logins are frequently taking longer than the pxssh default of 10 seconds and failing. Thus the login_timeout increase to 60.
1 parent 33b6483 commit 098ce4e

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/jupyter_o2/jupyter_o2.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ def __init__(
451451
)
452452

453453
self._second_ssh = CustomSSH(
454-
timeout=10,
454+
timeout=60,
455455
ignore_sighup=False,
456456
options={"PubkeyAuthentication": "yes" if self.use_pubkey else "no"},
457457
)
@@ -499,7 +499,13 @@ def connect(self):
499499
# start login ssh
500500
self.logger.info(f"Connecting to {self.user}@{self.host}")
501501
code = self.codes_2fa[0] if self.codes_2fa else None
502-
if not self._login_ssh.login(self.host, self.user, self.__pass, code):
502+
if not self._login_ssh.login(
503+
self.host,
504+
self.user,
505+
self.__pass,
506+
code,
507+
login_timeout=self._login_ssh.timeout,
508+
):
503509
return False
504510
self.logger.debug("Connected.")
505511

@@ -520,7 +526,13 @@ def connect(self):
520526
# log in to the second ssh
521527
self.logger.info("\nStarting a second connection to the login node.")
522528
code = self.codes_2fa[:2][-1] if self.codes_2fa else None
523-
if not self._second_ssh.login(jp_login_host, self.user, self.__pass, code):
529+
if not self._second_ssh.login(
530+
jp_login_host,
531+
self.user,
532+
self.__pass,
533+
code,
534+
login_timeout=self._second_ssh.timeout,
535+
):
524536
return False
525537
self.logger.debug("Connected.")
526538

0 commit comments

Comments
 (0)