sagemaker-python-sdk icon indicating copy to clipboard operation
sagemaker-python-sdk copied to clipboard

fix: Add regex for short-form sagemaker-xgboost tags

Open mabunday opened this issue 2 years ago • 23 comments

Issue #, if available:

Description of changes:

The json schemas for sagemaker-xgboost versions 1.2-1, 1.2-2, 1.3-1, and 1.5-1 do not have the fields processors and py_versions. This causes the function sagemaker.image_uris.retrieve to return an ECR URI that is incorrectly parsed in the XGB estimator because the format does not match what is expected: https://github.com/aws/sagemaker-python-sdk/blob/v2.105.0/src/sagemaker/xgboost/estimator.py#L268-L277

The following lines of code demonstrate the difference between 1.0-1 - which has these fields - and 1.5-1, which does not:

import sagemaker

print(sagemaker.image_uris.retrieve("xgboost", "us-west-2", "1.0-1"))
print(sagemaker.image_uris.retrieve("xgboost", "us-west-2", "1.5-1"))
>>> 246618743249.dkr.ecr.us-west-2.amazonaws.com/sagemaker-xgboost:1.0-1-cpu-py3
>>> 246618743249.dkr.ecr.us-west-2.amazonaws.com/sagemaker-xgboost:1.5-1
In [6]: framework_name_from_image("246618743249.dkr.ecr.us-west-2.amazonaws.com/sagemaker-xgboost:1.5-1")
Out[6]: (None, None, None, None)

In [7]: framework_name_from_image("246618743249.dkr.ecr.us-west-2.amazonaws.com/sagemaker-xgboost:1.5-1-cpu-py3")
Out[7]: ('xgboost', 'py3', '1.5-1-cpu-py3', None)

Note: All sagemaker-xgboost images are published to production ECRs with the tags <xgboost_version>-1 and <xgboost_version>-1-cpu-py3. These tags are aliases for each other and the images they return are identical.

The processors and py_versions fields cannot just be added to the schemas for 1.2-1, 1.2-2, 1.3-1, and 1.5-1 because the images -cpu-py3 also have GPU capabilities. Adding a processors field with only CPU as the value causes validation errors if a GPU instance is used with one of these images. Therefore, this change instead modifies framework_name_from_image and framework_version_from_tag to accommodate the short-form alias if it is passed.

Testing done:

conda create -n sm_sdk python=3.8
pip install --upgrade .[test]
tox tests/unit

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.

General

  • [x] I have read the CONTRIBUTING doc
  • [x] I certify that the changes I am introducing will be backword compatible, and I have discussed concerns about this, if any, with the Python SDK team
  • [x] I used the commit message format described in CONTRIBUTING
  • [x] I have passed the region in to all S3 and STS clients that I've initialized as part of this change.
  • [x] I have updated any necessary documentation, including READMEs and API docs (if appropriate)

Tests

  • [x] I have added tests that prove my fix is effective or that my feature works (if appropriate)
  • [x] I have added unit and/or integration tests as appropriate to ensure backward compatibility of the changes
  • [x] I have checked that my tests are not configured for a specific region or account (if appropriate)
  • [x] I have used unique_name_from_base to create resource names in integ tests (if appropriate)

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

mabunday avatar Sep 14 '22 04:09 mabunday

AWS CodeBuild CI Report

  • CodeBuild project: sagemaker-python-sdk-slow-tests
  • Commit ID: bff04cd03106c6d00a5029f2ae91905d5a8d97f0
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

sagemaker-bot avatar Sep 14 '22 14:09 sagemaker-bot

AWS CodeBuild CI Report

  • CodeBuild project: sagemaker-python-sdk-pr
  • Commit ID: 00b5b6885f2ac0b8e380dcc247bd4f1f7312a7e4
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

sagemaker-bot avatar Sep 14 '22 15:09 sagemaker-bot

AWS CodeBuild CI Report

  • CodeBuild project: sagemaker-python-sdk-unit-tests
  • Commit ID: 00b5b6885f2ac0b8e380dcc247bd4f1f7312a7e4
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

sagemaker-bot avatar Sep 14 '22 15:09 sagemaker-bot

AWS CodeBuild CI Report

  • CodeBuild project: sagemaker-python-sdk-local-mode-tests
  • Commit ID: 00b5b6885f2ac0b8e380dcc247bd4f1f7312a7e4
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

sagemaker-bot avatar Sep 14 '22 15:09 sagemaker-bot

Codecov Report

Merging #3358 (e02d9d1) into master (ace07d7) will decrease coverage by 0.84%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #3358      +/-   ##
==========================================
- Coverage   90.02%   89.17%   -0.85%     
==========================================
  Files         868      204     -664     
  Lines       76852    18986   -57866     
==========================================
- Hits        69185    16931   -52254     
+ Misses       7667     2055    -5612     
Impacted Files Coverage Δ
src/sagemaker/fw_utils.py 91.37% <100.00%> (ø)
...lib/python3.7/site-packages/sagemaker/predictor.py
...10/lib/python3.10/site-packages/sagemaker/model.py
...python3.8/site-packages/sagemaker/pytorch/model.py
...on3.9/site-packages/sagemaker/sklearn/estimator.py
...n3.7/site-packages/sagemaker/pytorch/processing.py
.../site-packages/sagemaker/workflow/_repack_model.py
...ackages/sagemaker/amazon/factorization_machines.py
....10/site-packages/sagemaker/workflow/conditions.py
...packages/sagemaker/model_monitor/dataset_format.py
... and 1063 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

codecov-commenter avatar Sep 14 '22 15:09 codecov-commenter

AWS CodeBuild CI Report

  • CodeBuild project: sagemaker-python-sdk-notebook-tests
  • Commit ID: 00b5b6885f2ac0b8e380dcc247bd4f1f7312a7e4
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

sagemaker-bot avatar Sep 14 '22 15:09 sagemaker-bot

AWS CodeBuild CI Report

  • CodeBuild project: sagemaker-python-sdk-slow-tests
  • Commit ID: 00b5b6885f2ac0b8e380dcc247bd4f1f7312a7e4
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

sagemaker-bot avatar Sep 14 '22 17:09 sagemaker-bot

Test failures seem unrelated to these changes.

mabunday avatar Sep 14 '22 17:09 mabunday

AWS CodeBuild CI Report

  • CodeBuild project: sagemaker-python-sdk-unit-tests
  • Commit ID: e02d9d142ff2f1b174b7fabbfc3e14b1468de81a
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

sagemaker-bot avatar Sep 16 '22 17:09 sagemaker-bot

AWS CodeBuild CI Report

  • CodeBuild project: sagemaker-python-sdk-pr
  • Commit ID: e02d9d142ff2f1b174b7fabbfc3e14b1468de81a
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

sagemaker-bot avatar Sep 16 '22 17:09 sagemaker-bot

AWS CodeBuild CI Report

  • CodeBuild project: sagemaker-python-sdk-local-mode-tests
  • Commit ID: e02d9d142ff2f1b174b7fabbfc3e14b1468de81a
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

sagemaker-bot avatar Sep 16 '22 17:09 sagemaker-bot

AWS CodeBuild CI Report

  • CodeBuild project: sagemaker-python-sdk-slow-tests
  • Commit ID: e02d9d142ff2f1b174b7fabbfc3e14b1468de81a
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

sagemaker-bot avatar Sep 16 '22 18:09 sagemaker-bot

AWS CodeBuild CI Report

  • CodeBuild project: sagemaker-python-sdk-notebook-tests
  • Commit ID: e02d9d142ff2f1b174b7fabbfc3e14b1468de81a
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

sagemaker-bot avatar Sep 16 '22 18:09 sagemaker-bot

AWS CodeBuild CI Report

  • CodeBuild project: sagemaker-python-sdk-pr
  • Commit ID: e02d9d142ff2f1b174b7fabbfc3e14b1468de81a
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

sagemaker-bot avatar Sep 19 '22 13:09 sagemaker-bot

AWS CodeBuild CI Report

  • CodeBuild project: sagemaker-python-sdk-unit-tests
  • Commit ID: e02d9d142ff2f1b174b7fabbfc3e14b1468de81a
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

sagemaker-bot avatar Sep 19 '22 13:09 sagemaker-bot

AWS CodeBuild CI Report

  • CodeBuild project: sagemaker-python-sdk-local-mode-tests
  • Commit ID: e02d9d142ff2f1b174b7fabbfc3e14b1468de81a
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

sagemaker-bot avatar Sep 19 '22 13:09 sagemaker-bot

AWS CodeBuild CI Report

  • CodeBuild project: sagemaker-python-sdk-notebook-tests
  • Commit ID: e02d9d142ff2f1b174b7fabbfc3e14b1468de81a
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

sagemaker-bot avatar Sep 19 '22 14:09 sagemaker-bot

AWS CodeBuild CI Report

  • CodeBuild project: sagemaker-python-sdk-slow-tests
  • Commit ID: e02d9d142ff2f1b174b7fabbfc3e14b1468de81a
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

sagemaker-bot avatar Sep 19 '22 15:09 sagemaker-bot

AWS CodeBuild CI Report

  • CodeBuild project: sagemaker-python-sdk-unit-tests
  • Commit ID: e02d9d142ff2f1b174b7fabbfc3e14b1468de81a
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

sagemaker-bot avatar Sep 19 '22 17:09 sagemaker-bot

AWS CodeBuild CI Report

  • CodeBuild project: sagemaker-python-sdk-slow-tests
  • Commit ID: e02d9d142ff2f1b174b7fabbfc3e14b1468de81a
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

sagemaker-bot avatar Sep 19 '22 17:09 sagemaker-bot

AWS CodeBuild CI Report

  • CodeBuild project: sagemaker-python-sdk-local-mode-tests
  • Commit ID: e02d9d142ff2f1b174b7fabbfc3e14b1468de81a
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

sagemaker-bot avatar Sep 19 '22 18:09 sagemaker-bot

AWS CodeBuild CI Report

  • CodeBuild project: sagemaker-python-sdk-pr
  • Commit ID: e02d9d142ff2f1b174b7fabbfc3e14b1468de81a
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

sagemaker-bot avatar Sep 19 '22 18:09 sagemaker-bot

AWS CodeBuild CI Report

  • CodeBuild project: sagemaker-python-sdk-notebook-tests
  • Commit ID: e02d9d142ff2f1b174b7fabbfc3e14b1468de81a
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

sagemaker-bot avatar Sep 19 '22 18:09 sagemaker-bot

AWS CodeBuild CI Report

  • CodeBuild project: sagemaker-python-sdk-slow-tests
  • Commit ID: e02d9d142ff2f1b174b7fabbfc3e14b1468de81a
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

sagemaker-bot avatar Oct 01 '22 19:10 sagemaker-bot

AWS CodeBuild CI Report

  • CodeBuild project: sagemaker-python-sdk-unit-tests
  • Commit ID: e02d9d142ff2f1b174b7fabbfc3e14b1468de81a
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

sagemaker-bot avatar Oct 01 '22 19:10 sagemaker-bot