-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Fix local mode error message #272
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -246,6 +246,25 @@ def test_train(_download_folder, _cleanup, popen, _stream_output, LocalSession, | |
assert config['services'][h]['command'] == 'train' | ||
|
||
|
||
@patch('sagemaker.local.local_session.LocalSession') | ||
@patch('sagemaker.local.image._stream_output', side_effect=RuntimeError('this is expected')) | ||
@patch('subprocess.Popen') | ||
@patch('sagemaker.local.image._SageMakerContainer._cleanup') | ||
@patch('sagemaker.local.image._SageMakerContainer._download_folder') | ||
def test_train_error(_download_folder, _cleanup, popen, _stream_output, LocalSession, tmpdir, sagemaker_session): | ||
directories = [str(tmpdir.mkdir('container-root')), str(tmpdir.mkdir('data'))] | ||
|
||
with patch('sagemaker.local.image._SageMakerContainer._create_tmp_folder', side_effect=directories): | ||
instance_count = 2 | ||
image = 'my-image' | ||
sagemaker_container = _SageMakerContainer('local', instance_count, image, sagemaker_session=sagemaker_session) | ||
|
||
with pytest.raises(RuntimeError) as e: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I dont think this should be one single test. I would split it to be a serving_container_handles_failure or something. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not entirely sure what you mean here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nvm this is fine |
||
sagemaker_container.train(INPUT_DATA_CONFIG, HYPERPARAMETERS) | ||
|
||
assert 'this is expected' in str(e) | ||
|
||
|
||
@patch('sagemaker.local.local_session.LocalSession') | ||
@patch('sagemaker.local.image._stream_output') | ||
@patch('subprocess.Popen') | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not put it as a patch as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since it relies on
directories
and I doubt putting that variable assignment directly in the patch annotation would fit in one line