-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Replaced generic ValueError with custom subclass when reporting unexpected resource status #855
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
Conversation
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Hello @arodiss, thanks for the contribution. Any special reasoning behinds creating a new special exception? I would tend to just use |
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.
Hello @arodiss, thanks for the contribution. Any special reasoning behinds creating a new special exception? I would tend to just use ValueError here otherwise.
@mvsusp |
Agreed that is helpful in your use case. Thanks for your contribution! |
@@ -0,0 +1,9 @@ | |||
from __future__ import absolute_import |
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.
Please add copyright.
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.
added
src/sagemaker/session.py
Outdated
message='Error creating model package {}: {} Reason: {}'.format(model_package_name, status, reason), | ||
allowed_statuses=['Completed'], | ||
actual_status=status | ||
) | ||
return desc | ||
|
||
def create_endpoint_config(self, name, model_name, initial_instance_count, instance_type, |
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.
Please include unit tests, example
def test_create_endpoint_config(sagemaker_session): |
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.
included
message='Error for {} {}: {} Reason: {}'.format(job_type, job, status, reason), | ||
allowed_statuses=['Completed', 'Stopped'], | ||
actual_status=status | ||
) |
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.
We need unit tests here 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.
done
message='Error hosting endpoint {}: {} Reason: {}'.format(endpoint, status, reason), | ||
allowed_statuses=['InService'], | ||
actual_status=status | ||
) | ||
return desc |
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.
Please include unit tests.
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.
done
src/sagemaker/session.py
Outdated
@@ -30,6 +30,7 @@ | |||
from sagemaker import vpc_utils | |||
from sagemaker.user_agent import prepend_user_agent | |||
from sagemaker.utils import name_from_image, secondary_training_status_changed, secondary_training_status_message | |||
from sagemaker.exceptions import UnexpectedStatusException |
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.
Let's try to follow Google Python Style guide, http://google.github.io/styleguide/pyguide.html#224-decision
from sagemaker import exceptions
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.
updated.
I have to mention that other imports in the same file are quite far from the guide
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
…ng unexpected resource status
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
@mvsusp |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
…ng unexpected resource status
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Moved to #919 |
Issue #, if available:
None
Description of changes:
Replaced generic ValueError with custom subclass when reporting unexpected resource status
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.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.