Skip to content

Commit 3521fb2

Browse files
authored
Increase default timeout in connect() and allow override (#83)
Some HPCs take a minute to complete an initial connection through UIT+.
1 parent b5abacd commit 3521fb2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

uit/uit.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@ def connect(
297297
exclude_login_nodes=(),
298298
retry_on_failure=None,
299299
num_retries=3,
300+
timeout=70,
300301
):
301302
"""Connect this client to the UIT servers.
302303
@@ -310,12 +311,13 @@ def connect(
310311
False will only attempt one connection.
311312
Default of None will automatically pick False if login_node is set, otherwise it will pick True.
312313
num_retries (int): Number of connection attempts. Requires retry_on_failure=True
314+
timeout (int): Number of seconds to wait for the call() to the HPC
313315
"""
314316
login_node, retry_on_failure = self.prepare_connect(system, login_node, exclude_login_nodes, retry_on_failure)
315317

316318
try:
317319
# working_dir='.' ends up being the location for UIT+ scripts, not the user's home directory
318-
self.call(":", working_dir=".", timeout=35)
320+
self.call(":", working_dir=".", timeout=timeout)
319321
except UITError as e:
320322
self.connected = False
321323
msg = f"Error while connecting to node {login_node}: {e}"
@@ -332,6 +334,7 @@ def connect(
332334
exclude_login_nodes=exclude_login_nodes,
333335
retry_on_failure=retry_on_failure,
334336
num_retries=num_retries,
337+
timeout=timeout,
335338
)
336339
else:
337340
raise MaxRetriesError(msg)

0 commit comments

Comments
 (0)