Skip to content

Commit ded1db7

Browse files
committed
Create output/data directory expected by sagemaker containers when running in local mode.
1 parent b73822c commit ded1db7

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/sagemaker/local/image.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ def train(self, input_data_config, hyperparameters):
8585
"""
8686
self.container_root = self._create_tmp_folder()
8787
os.mkdir(os.path.join(self.container_root, 'output'))
88+
# create output/data folder since sagemaker-containers 2.0 expects it
89+
os.mkdir(os.path.join(self.container_root, 'output', 'data'))
8890
# A shared directory for all the containers. It is only mounted if the training script is
8991
# Local.
9092
shared_dir = os.path.join(self.container_root, 'shared')

tests/unit/test_image.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,10 @@ def test_train(_download_folder, _cleanup, popen, _stream_output, LocalSession,
245245
assert config['services'][h]['image'] == image
246246
assert config['services'][h]['command'] == 'train'
247247

248+
# assert that expected by sagemaker container output directories exist
249+
assert os.path.exists(os.path.join(sagemaker_container.container_root, 'output'))
250+
assert os.path.exists(os.path.join(sagemaker_container.container_root, 'output/data'))
251+
248252

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

0 commit comments

Comments
 (0)