diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 59c5c82b9f..2c04fe4e85 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -2,6 +2,11 @@ CHANGELOG ========= +1.9.3dev +======== + +* bug-fix: Local Mode: Create output/data directory expected by SageMaker Container. + 1.9.2 ===== diff --git a/src/sagemaker/local/image.py b/src/sagemaker/local/image.py index bca0599dd3..00de74b225 100644 --- a/src/sagemaker/local/image.py +++ b/src/sagemaker/local/image.py @@ -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') @@ -386,7 +388,7 @@ def _generate_compose_file(self, command, additional_volumes=None, additional_en environment.extend(additional_env_vars) if command == 'train': - optml_dirs = {'output', 'input'} + optml_dirs = {'output', 'output/data', 'input'} services = { h: self._create_docker_host(h, environment, optml_dirs, diff --git a/tests/unit/test_image.py b/tests/unit/test_image.py index be145aee11..328e53a6c1 100644 --- a/tests/unit/test_image.py +++ b/tests/unit/test_image.py @@ -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'))