Skip to content

Add APIs to export Airflow model config #492

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 10 commits into from
Nov 16, 2018

Conversation

yangaws
Copy link
Contributor

@yangaws yangaws commented Nov 16, 2018

Issue #, if available:

Description of changes:

  1. Add API to export model config from a SageMaker model
  2. Add API to export model config from a SageMaker estimator with a training job associated
  3. Add related unit tests

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.


def prepare_framework_container_def(model, instance_type, s3_operations):
"""Prepare the framework model container information. Specify related s3 operations for Airflow to perform.
(Upload source_dir)
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpicks: s/s3/S3 and backticks around source_dir. same below

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated.

Copy link
Contributor

Choose a reason for hiding this comment

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

don't forget about making "source_dir" into ``source_dir``

@codecov-io
Copy link

codecov-io commented Nov 16, 2018

Codecov Report

Merging #492 into master will increase coverage by <.01%.
The diff coverage is 95.16%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #492      +/-   ##
==========================================
+ Coverage   94.15%   94.15%   +<.01%     
==========================================
  Files          59       59              
  Lines        4498     4552      +54     
==========================================
+ Hits         4235     4286      +51     
- Misses        263      266       +3
Impacted Files Coverage Δ
src/sagemaker/estimator.py 90.31% <100%> (+0.13%) ⬆️
src/sagemaker/model.py 95.65% <100%> (+0.06%) ⬆️
src/sagemaker/workflow/airflow.py 91.6% <94.64%> (+1.35%) ⬆️

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 537ba79...e42c800. Read the comment docs.


def prepare_framework_container_def(model, instance_type, s3_operations):
"""Prepare the framework model container information. Specify related s3 operations for Airflow to perform.
(Upload source_dir)
Copy link
Contributor

Choose a reason for hiding this comment

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

don't forget about making "source_dir" into ``source_dir``

try:
if model.model_server_workers:
deploy_env[sagemaker.model.MODEL_SERVER_WORKERS_PARAM_NAME.upper()] = str(model.model_server_workers)
except AttributeError:
Copy link
Contributor

Choose a reason for hiding this comment

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

is there no better way to check for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep because model_server_workers is not a member of FrameworkModel class. So exception will be thrown if we try doing model.model_server_workers if model is a FrameworkModel but not a Deep Learning framework model. And here in the codes, we don't know whether it's just a FrameworkModel or Deep Learning framework model.


container_def = sagemaker.container_def(deploy_image, model.model_data, deploy_env)

return container_def
Copy link
Contributor

Choose a reason for hiding this comment

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

you can combine ll. 325-327

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated

role (str): The ``ExecutionRoleArn`` IAM Role ARN for the model
image (str): An container image to use for deploying the model

Returns (dict):
Copy link
Contributor

Choose a reason for hiding this comment

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

this should be:

Returns:
    dict: blah blah blah

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated

ChoiByungWook
ChoiByungWook previously approved these changes Nov 16, 2018
@laurenyu laurenyu merged commit 172381b into aws:master Nov 16, 2018
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