Skip to content

Create output/data directory in local mode. #364

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 4 commits into from
Aug 28, 2018
Merged
Show file tree
Hide file tree
Changes from 2 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
5 changes: 5 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
CHANGELOG
=========

1.9.2dev
========

* bug-fix: Local Mode: Create output/data directory expected by SageMaker Container.

1.9.1
=====

Expand Down
2 changes: 2 additions & 0 deletions src/sagemaker/local/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ def train(self, input_data_config, hyperparameters):
"""
self.container_root = self._create_tmp_folder()
os.mkdir(os.path.join(self.container_root, 'output'))
# create output/data folder since sagemaker-containers 2.0 expects it
os.mkdir(os.path.join(self.container_root, 'output', 'data'))
# A shared directory for all the containers. It is only mounted if the training script is
# Local.
shared_dir = os.path.join(self.container_root, 'shared')
Expand Down
4 changes: 4 additions & 0 deletions tests/unit/test_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,10 @@ def test_train(_download_folder, _cleanup, popen, _stream_output, LocalSession,
assert config['services'][h]['image'] == image
assert config['services'][h]['command'] == 'train'

# assert that expected by sagemaker container output directories exist
assert os.path.exists(os.path.join(sagemaker_container.container_root, 'output'))
assert os.path.exists(os.path.join(sagemaker_container.container_root, 'output/data'))


@patch('sagemaker.local.local_session.LocalSession')
@patch('sagemaker.local.image._stream_output', side_effect=RuntimeError('this is expected'))
Expand Down