Skip to content

Commit 5f0e60b

Browse files
authored
Add port parameter to SSHTunnel (#372)
* Add port parameter to SSHTunnel Signed-off-by: Igor Gitman <[email protected]> * Fix ci Signed-off-by: Igor Gitman <[email protected]> * Fix copyright Signed-off-by: Igor Gitman <[email protected]> * Fix copyright Signed-off-by: Igor Gitman <[email protected]> * Fix copyright Signed-off-by: Igor Gitman <[email protected]> --------- Signed-off-by: Igor Gitman <[email protected]>
1 parent 3b676e1 commit 5f0e60b

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

nemo_run/core/tunnel/client.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
# SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2-
# SPDX-License-Identifier: Apache-2.0
1+
# Copyright (c) 2024-2025, NVIDIA CORPORATION.
32
#
43
# Licensed under the Apache License, Version 2.0 (the "License");
54
# you may not use this file except in compliance with the License.
65
# You may obtain a copy of the License at
76
#
8-
# http://www.apache.org/licenses/LICENSE-2.0
7+
# http://www.apache.org/licenses/LICENSE-2.0
98
#
109
# Unless required by applicable law or agreed to in writing, software
1110
# distributed under the License is distributed on an "AS IS" BASIS,
@@ -196,6 +195,7 @@ class SSHTunnel(Tunnel):
196195

197196
host: str
198197
user: str
198+
port: Optional[int] = None
199199
identity: Optional[str] = None
200200
shell: Optional[str] = None
201201
pre_command: Optional[str] = None
@@ -263,6 +263,7 @@ def _authenticate(self):
263263
config = Config(overrides={"run": {"in_stream": False}})
264264
self.session = Connection(
265265
self.host,
266+
port=self.port,
266267
user=self.user,
267268
connect_kwargs=connect_kwargs,
268269
forward_agent=False,

test/core/tunnel/test_client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
# SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2-
# SPDX-License-Identifier: Apache-2.0
1+
# Copyright (c) 2024-2025, NVIDIA CORPORATION.
32
#
43
# Licensed under the Apache License, Version 2.0 (the "License");
54
# you may not use this file except in compliance with the License.
65
# You may obtain a copy of the License at
76
#
8-
# http://www.apache.org/licenses/LICENSE-2.0
7+
# http://www.apache.org/licenses/LICENSE-2.0
98
#
109
# Unless required by applicable law or agreed to in writing, software
1110
# distributed under the License is distributed on an "AS IS" BASIS,
@@ -162,6 +161,7 @@ def test_connect_with_identity(self, mock_config, mock_connection):
162161

163162
mock_connection.assert_called_once_with(
164163
"test.host",
164+
port=None,
165165
user="test_user",
166166
connect_kwargs={"key_filename": ["/path/to/key"]},
167167
forward_agent=False,

0 commit comments

Comments
 (0)