Skip to content

Commit dac79c7

Browse files
committed
Add docstring
1 parent c44cae6 commit dac79c7

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/sagemaker/modules/train/container_drivers/mpi_utils.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,16 @@ def start_sshd_daemon():
7676

7777

7878
class CustomHostKeyPolicy(paramiko.client.MissingHostKeyPolicy):
79+
"""Class to handle host key policy for SageMaker distributed training SSH connections.
80+
Example:
81+
>>> client = paramiko.SSHClient()
82+
>>> client.set_missing_host_key_policy(CustomHostKeyPolicy())
83+
>>> # Will succeed for SageMaker algorithm containers
84+
>>> client.connect('algo-1234.internal')
85+
>>> # Will raise SSHException for other unknown hosts
86+
>>> client.connect('unknown-host') # raises SSHException
87+
"""
88+
7989
def missing_host_key(self, client, hostname, key):
8090
"""Accept host keys for algo-* hostnames, reject others.
8191

0 commit comments

Comments
 (0)