Skip to content

Lowercase container hostnames #559

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Dec 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ CHANGELOG
1.16.3.dev
==========

* bug-fix: Local Mode: Allow support for SSH in local mode
* bug-fix: Append retry id to default Airflow job name to avoid name collisions in retry
* bug-fix: Local Mode: No longer requires s3 permissions to run local entry point file
* bug-fix: Local Mode: Move dependency on sagemaker_s3_output from rl.estimator to model
Expand Down
2 changes: 1 addition & 1 deletion src/sagemaker/local/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def __init__(self, instance_type, instance_count, image, sagemaker_session=None)
self.image = image
# Since we are using a single docker network, Generate a random suffix to attach to the container names.
# This way multiple jobs can run in parallel.
suffix = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(5))
suffix = ''.join(random.choice(string.ascii_lowercase + string.digits) for _ in range(5))
self.hosts = ['{}-{}-{}'.format(CONTAINER_PREFIX, i, suffix) for i in range(1, self.instance_count + 1)]
self.container_root = None
self.container = None
Expand Down
17 changes: 17 additions & 0 deletions tests/unit/test_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,23 @@ def sagemaker_session():
return sms


def test_sagemaker_container_hosts_should_have_lowercase_names():
random.seed(a=42)

def assert_all_lowercase(hosts):
for host in hosts:
assert host.lower() == host

sagemaker_container = _SageMakerContainer('local', 2, 'my-image', sagemaker_session=Mock())
assert_all_lowercase(sagemaker_container.hosts)

sagemaker_container = _SageMakerContainer('local', 10, 'my-image', sagemaker_session=Mock())
assert_all_lowercase(sagemaker_container.hosts)

sagemaker_container = _SageMakerContainer('local', 1, 'my-image', sagemaker_session=Mock())
assert_all_lowercase(sagemaker_container.hosts)


@patch('sagemaker.local.local_session.LocalSession')
def test_write_config_file(LocalSession, tmpdir):
sagemaker_container = _SageMakerContainer('local', 2, 'my-image')
Expand Down