Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add docstring
Browse files Browse the repository at this point in the history
sage-maker committed Jan 23, 2025
1 parent c44cae6 commit dac79c7
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/sagemaker/modules/train/container_drivers/mpi_utils.py
Original file line number Diff line number Diff line change
@@ -76,6 +76,16 @@ def start_sshd_daemon():


class CustomHostKeyPolicy(paramiko.client.MissingHostKeyPolicy):
"""Class to handle host key policy for SageMaker distributed training SSH connections.
Example:
>>> client = paramiko.SSHClient()
>>> client.set_missing_host_key_policy(CustomHostKeyPolicy())
>>> # Will succeed for SageMaker algorithm containers
>>> client.connect('algo-1234.internal')
>>> # Will raise SSHException for other unknown hosts
>>> client.connect('unknown-host') # raises SSHException
"""

def missing_host_key(self, client, hostname, key):
"""Accept host keys for algo-* hostnames, reject others.

0 comments on commit dac79c7

Please sign in to comment.