Skip to content

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

Merged
merged 3 commits into from
Jul 3, 2018

Conversation

laurenyu
Copy link
Contributor

@laurenyu laurenyu commented Jul 1, 2018

Issue #, if available:
#261

Description of changes:
In the local mode image code, we were incorrectly calling e.message, which doesn't work in Python. This change is to remedy that so RuntimeErrors get handled correctly.

Merge Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your pull request.

  • I have read the CONTRIBUTING doc
  • I have added tests that prove my fix is effective or that my feature works (if appropriate)
  • I have updated the changelog with a description of my changes (if appropriate)
  • I have updated any necessary documentation (if appropriate)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@codecov-io
Copy link

codecov-io commented Jul 1, 2018

Codecov Report

Merging #272 into master will increase coverage by 0.09%.
The diff coverage is 50%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #272      +/-   ##
==========================================
+ Coverage   92.34%   92.43%   +0.09%     
==========================================
  Files          49       49              
  Lines        3279     3279              
==========================================
+ Hits         3028     3031       +3     
+ Misses        251      248       -3
Impacted Files Coverage Δ
src/sagemaker/local/image.py 87.09% <50%> (+0.87%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7c2073c...dec9fe6. Read the comment docs.

iquintero
iquintero previously approved these changes Jul 2, 2018
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):
Copy link
Contributor

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?

Copy link
Contributor Author

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

image = 'my-image'
sagemaker_container = _SageMakerContainer('local', instance_count, image, sagemaker_session=sagemaker_session)

with pytest.raises(RuntimeError) as e:
Copy link
Contributor

Choose a reason for hiding this comment

The 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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not entirely sure what you mean here. _stream_output is patched to return a RuntimeError, so all this is testing is that the eventual RuntimeError returned by train() contains the error message from the first RuntimeError

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nvm this is fine

@laurenyu laurenyu merged commit 1824610 into aws:master Jul 3, 2018
@laurenyu laurenyu deleted the fix-local-mode-error-message branch July 3, 2018 00:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants