Skip to content

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

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 1 commit into from
Oct 1, 2022

Conversation

mabunday
Copy link
Contributor

@mabunday mabunday commented Sep 14, 2022

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

  • I have read the CONTRIBUTING doc
  • 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
  • I used the commit message format described in CONTRIBUTING
  • I have passed the region in to all S3 and STS clients that I've initialized as part of this change.
  • I have updated any necessary documentation, including READMEs and API docs (if appropriate)

Tests

  • I have added tests that prove my fix is effective or that my feature works (if appropriate)
  • I have added unit and/or integration tests as appropriate to ensure backward compatibility of the changes
  • I have checked that my tests are not configured for a specific region or account (if appropriate)
  • 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 mabunday marked this pull request as draft September 14, 2022 13:04
@mabunday mabunday changed the title fix: Add missing processors and py_versions fields to xgboost.json fix: Add regex for short-form sagemaker-xgboost tags in framework_name_from_image Sep 14, 2022
@mabunday mabunday force-pushed the master branch 4 times, most recently from c97b3ce to bff04cd Compare September 14, 2022 14:14
@sagemaker-bot

This comment was marked as outdated.

@aws aws deleted a comment from sagemaker-bot Sep 14, 2022
@aws aws deleted a comment from sagemaker-bot Sep 14, 2022
@aws aws deleted a comment from sagemaker-bot Sep 14, 2022
@aws aws deleted a comment from codecov-commenter Sep 14, 2022
@aws aws deleted a comment from sagemaker-bot Sep 14, 2022
@aws aws deleted a comment from sagemaker-bot Sep 14, 2022
@mabunday mabunday force-pushed the master branch 2 times, most recently from e495012 to 00b5b68 Compare September 14, 2022 14:52
@aws aws deleted a comment from sagemaker-bot Sep 14, 2022
@aws aws deleted a comment from codecov-commenter Sep 14, 2022
@aws aws deleted a comment from sagemaker-bot Sep 14, 2022
@sagemaker-bot
Copy link
Collaborator

AWS CodeBuild CI Report

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

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

@aws aws deleted a comment from sagemaker-bot Sep 14, 2022
@aws aws deleted a comment from sagemaker-bot Sep 14, 2022
@aws aws deleted a comment from sagemaker-bot Sep 14, 2022
@sagemaker-bot
Copy link
Collaborator

AWS CodeBuild CI Report

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

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

@sagemaker-bot
Copy link
Collaborator

AWS CodeBuild CI Report

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

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

@codecov-commenter
Copy link

codecov-commenter commented Sep 14, 2022

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.

@sagemaker-bot
Copy link
Collaborator

AWS CodeBuild CI Report

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

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

@sagemaker-bot
Copy link
Collaborator

AWS CodeBuild CI Report

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

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

@mabunday mabunday marked this pull request as ready for review September 14, 2022 17:45
@mabunday
Copy link
Contributor Author

Test failures seem unrelated to these changes.

@mabunday mabunday requested a review from a team September 14, 2022 17:49
@sagemaker-bot
Copy link
Collaborator

AWS CodeBuild CI Report

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

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

@sagemaker-bot
Copy link
Collaborator

AWS CodeBuild CI Report

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

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

@sagemaker-bot
Copy link
Collaborator

AWS CodeBuild CI Report

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

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

@sagemaker-bot
Copy link
Collaborator

AWS CodeBuild CI Report

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

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

@sagemaker-bot
Copy link
Collaborator

AWS CodeBuild CI Report

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

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

@mabunday mabunday changed the title fix: Add regex for short-form sagemaker-xgboost tags in framework_name_from_image fix: Add regex for short-form sagemaker-xgboost tags Sep 19, 2022
@sagemaker-bot
Copy link
Collaborator

AWS CodeBuild CI Report

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

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

@sagemaker-bot
Copy link
Collaborator

AWS CodeBuild CI Report

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

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

@sagemaker-bot
Copy link
Collaborator

AWS CodeBuild CI Report

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

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

@sagemaker-bot
Copy link
Collaborator

AWS CodeBuild CI Report

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

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

@sagemaker-bot
Copy link
Collaborator

AWS CodeBuild CI Report

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

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

@sagemaker-bot
Copy link
Collaborator

AWS CodeBuild CI Report

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

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

@sagemaker-bot
Copy link
Collaborator

AWS CodeBuild CI Report

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

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

@sagemaker-bot
Copy link
Collaborator

AWS CodeBuild CI Report

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

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

@sagemaker-bot
Copy link
Collaborator

AWS CodeBuild CI Report

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

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

@sagemaker-bot
Copy link
Collaborator

AWS CodeBuild CI Report

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

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

Copy link
Member

@mufaddal-rohawala mufaddal-rohawala left a comment

Choose a reason for hiding this comment

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

/bot run slow-tests unit-tests

@sagemaker-bot
Copy link
Collaborator

AWS CodeBuild CI Report

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

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

@sagemaker-bot
Copy link
Collaborator

AWS CodeBuild CI Report

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

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

@mufaddal-rohawala mufaddal-rohawala merged commit 342f218 into aws:master Oct 1, 2022
JoseJuan98 pushed a commit to JoseJuan98/sagemaker-python-sdk that referenced this pull request Mar 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants