Skip to content

fix: Remove content type image/jpg from analysis configuration schema #3530

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
Dec 12, 2022
Merged

fix: Remove content type image/jpg from analysis configuration schema #3530

merged 1 commit into from
Dec 12, 2022

Conversation

xgchena
Copy link
Contributor

@xgchena xgchena commented Dec 12, 2022

Issue #, if available:

https://tiny.amazon.com/10tcxpyzj

Description of changes:

Currently the analysis configuration schema of SageMaker Clarify API allows the content_type configuration "image/jpeg" and "image/jpg", but the service side validation only accepts the former which is the registered MIME type for JPEG (see rfc3745 and JPEG specification). The commit removes the latter from the schema to avoid confusion, and enable early API validation.

Testing done:

Manual Test

Passed.

if the customer set content_type configuration to image/jpg, then the job will by CustomerError, the error message looks like below,

  • Without the change, the job was launched and it rejected the type,
UnexpectedStatusException: Error for Processing job Clarify-Explainability-2022-11-28-19-22-30-436: Failed. Reason: ClientError: Unsupported content type image/jpg.Please provide one of the valid content_types:1. image/png,2. image/jpeg,3. application/x-npy
  • With this change, the type is rejected early by the schema validation in the SDK code
                                except SchemaError as x:
                                    k = "Key '%s' error:" % nkey
                                    message = self._prepend_schema_name(k)
>                                   raise SchemaError([message] + x.autos, [e.format(data) if e else None] + x.errors)
E                                   schema.SchemaError: Key 'predictor' error:
E                                   Key 'content_type' error:
E                                   <lambda>('image/jpg') should evaluate to True

~/.virtualenvs/sagemaker-python-sdk/lib/python3.7/site-packages/schema.py:409: SchemaError

Merge Checklist

General

  • I have read the CONTRIBUTING doc
  • I certify that the changes I am introducing will be backward 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.

Currently the analysis configuration schema of SageMaker Clarify API
allows the content_type configuration "image/jpeg" and "image/jpg",
but the service side validation only accepts the former which is the
registered MIME type for JPEG (see rfc3745 and JPEG specification).
The commit removes the latter from the schema to avoid confusion and
enable early API validation.
@xgchena xgchena requested a review from a team as a code owner December 12, 2022 17:31
@xgchena xgchena requested review from claytonparnell and removed request for a team December 12, 2022 17:31
@sagemaker-bot
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: sagemaker-python-sdk-unit-tests
  • Commit ID: bea1d43
  • 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 Dec 12, 2022

Codecov Report

Merging #3530 (bea1d43) into master (c5fc93f) will decrease coverage by 0.81%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #3530      +/-   ##
==========================================
- Coverage   89.69%   88.87%   -0.82%     
==========================================
  Files         904      213     -691     
  Lines       83208    20568   -62640     
==========================================
- Hits        74632    18280   -56352     
+ Misses       8576     2288    -6288     
Impacted Files Coverage Δ
src/sagemaker/clarify.py 95.76% <ø> (ø)
...n3.7/site-packages/sagemaker/pytorch/processing.py
...9/site-packages/sagemaker/environment_variables.py
...3.9/site-packages/sagemaker/workflow/properties.py
...7/site-packages/sagemaker/amazon/linear_learner.py
...thon3.9/site-packages/sagemaker/utilities/cache.py
...ckages/sagemaker/model_monitor/model_monitoring.py
...ython3.10/site-packages/sagemaker/model_metrics.py
...3.8/site-packages/sagemaker/lineage/association.py
....8/site-packages/sagemaker/jumpstart/validators.py
... and 1108 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-pr
  • Commit ID: bea1d43
  • 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: bea1d43
  • 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: bea1d43
  • 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: bea1d43
  • Result: FAILED
  • Build Logs (available for 30 days)

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

Copy link
Collaborator

@claytonparnell claytonparnell 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 notebook-tests

@sagemaker-bot
Copy link
Collaborator

AWS CodeBuild CI Report

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

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

@claytonparnell claytonparnell merged commit 5af4feb into aws:master Dec 12, 2022
mizanfiu pushed a commit to mizanfiu/sagemaker-python-sdk that referenced this pull request Dec 13, 2022
…aws#3530)

Currently the analysis configuration schema of SageMaker Clarify API
allows the content_type configuration "image/jpeg" and "image/jpg",
but the service side validation only accepts the former which is the
registered MIME type for JPEG (see rfc3745 and JPEG specification).
The commit removes the latter from the schema to avoid confusion and
enable early API validation.
claytonparnell pushed a commit to claytonparnell/sagemaker-python-sdk that referenced this pull request Dec 16, 2022
…aws#3530)

Currently the analysis configuration schema of SageMaker Clarify API
allows the content_type configuration "image/jpeg" and "image/jpg",
but the service side validation only accepts the former which is the
registered MIME type for JPEG (see rfc3745 and JPEG specification).
The commit removes the latter from the schema to avoid confusion and
enable early API validation.
@xgchena xgchena deleted the remove-invalid-content-type branch December 16, 2022 22:27
mufaddal-rohawala pushed a commit to mufaddal-rohawala/sagemaker-python-sdk that referenced this pull request Dec 19, 2022
…aws#3530)

Currently the analysis configuration schema of SageMaker Clarify API
allows the content_type configuration "image/jpeg" and "image/jpg",
but the service side validation only accepts the former which is the
registered MIME type for JPEG (see rfc3745 and JPEG specification).
The commit removes the latter from the schema to avoid confusion and
enable early API validation.
mufaddal-rohawala pushed a commit that referenced this pull request Dec 20, 2022
…#3530)

Currently the analysis configuration schema of SageMaker Clarify API
allows the content_type configuration "image/jpeg" and "image/jpg",
but the service side validation only accepts the former which is the
registered MIME type for JPEG (see rfc3745 and JPEG specification).
The commit removes the latter from the schema to avoid confusion and
enable early API validation.
JoseJuan98 pushed a commit to JoseJuan98/sagemaker-python-sdk that referenced this pull request Mar 4, 2023
…aws#3530)

Currently the analysis configuration schema of SageMaker Clarify API
allows the content_type configuration "image/jpeg" and "image/jpg",
but the service side validation only accepts the former which is the
registered MIME type for JPEG (see rfc3745 and JPEG specification).
The commit removes the latter from the schema to avoid confusion and
enable early API validation.
JoseJuan98 pushed a commit to JoseJuan98/sagemaker-python-sdk that referenced this pull request Mar 4, 2023
…aws#3530)

Currently the analysis configuration schema of SageMaker Clarify API
allows the content_type configuration "image/jpeg" and "image/jpg",
but the service side validation only accepts the former which is the
registered MIME type for JPEG (see rfc3745 and JPEG specification).
The commit removes the latter from the schema to avoid confusion and
enable early API validation.
nmadan pushed a commit to nmadan/sagemaker-python-sdk that referenced this pull request Apr 18, 2023
…aws#3530)

Currently the analysis configuration schema of SageMaker Clarify API
allows the content_type configuration "image/jpeg" and "image/jpg",
but the service side validation only accepts the former which is the
registered MIME type for JPEG (see rfc3745 and JPEG specification).
The commit removes the latter from the schema to avoid confusion and
enable early API validation.
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