Skip to content

Commit 4b7db48

Browse files
authored
Lowercase container hostnames (aws#559)
* Change hostnames to lowercase
1 parent da271ef commit 4b7db48

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

CHANGELOG.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ CHANGELOG
55
1.16.3.dev
66
==========
77

8+
* bug-fix: Local Mode: Allow support for SSH in local mode
89
* bug-fix: Append retry id to default Airflow job name to avoid name collisions in retry
910
* bug-fix: Local Mode: No longer requires s3 permissions to run local entry point file
1011
* bug-fix: Local Mode: Move dependency on sagemaker_s3_output from rl.estimator to model

src/sagemaker/local/image.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def __init__(self, instance_type, instance_count, image, sagemaker_session=None)
7979
self.image = image
8080
# Since we are using a single docker network, Generate a random suffix to attach to the container names.
8181
# This way multiple jobs can run in parallel.
82-
suffix = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(5))
82+
suffix = ''.join(random.choice(string.ascii_lowercase + string.digits) for _ in range(5))
8383
self.hosts = ['{}-{}-{}'.format(CONTAINER_PREFIX, i, suffix) for i in range(1, self.instance_count + 1)]
8484
self.container_root = None
8585
self.container = None

tests/unit/test_image.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,23 @@ def sagemaker_session():
8686
return sms
8787

8888

89+
def test_sagemaker_container_hosts_should_have_lowercase_names():
90+
random.seed(a=42)
91+
92+
def assert_all_lowercase(hosts):
93+
for host in hosts:
94+
assert host.lower() == host
95+
96+
sagemaker_container = _SageMakerContainer('local', 2, 'my-image', sagemaker_session=Mock())
97+
assert_all_lowercase(sagemaker_container.hosts)
98+
99+
sagemaker_container = _SageMakerContainer('local', 10, 'my-image', sagemaker_session=Mock())
100+
assert_all_lowercase(sagemaker_container.hosts)
101+
102+
sagemaker_container = _SageMakerContainer('local', 1, 'my-image', sagemaker_session=Mock())
103+
assert_all_lowercase(sagemaker_container.hosts)
104+
105+
89106
@patch('sagemaker.local.local_session.LocalSession')
90107
def test_write_config_file(LocalSession, tmpdir):
91108
sagemaker_container = _SageMakerContainer('local', 2, 'my-image')

0 commit comments

Comments
 (0)