Skip to content
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

SageMaker ModelPackageSummary structure requires ModelPackageName even when AWS API doesn't return it #3022

Open
l3ku opened this issue Sep 26, 2023 · 1 comment
Labels
bug This issue is a confirmed bug. service-api This issue is caused by the service API, not the SDK implementation.

Comments

@l3ku
Copy link

l3ku commented Sep 26, 2023

Describe the bug

In the ModelPackageSummary structure located https://github.com/boto/botocore/blob/develop/botocore/data/sagemaker/2017-07-24/service-2.json#L25291-L25334, the ModelPackageName is marked as a required member, however this is not the case for the SageMaker API response for model packages that are part of the SageMaker model registry. I noticed this issue when I tried to create a Stubber that returns a response for ListModelPackages: when copying the same response as returned by the AWS SageMaker ListModelPackages API to the Stubber service response, I got an unexpected validation error.

I first contacted AWS via Premium support, and they informed me that this is the expected API behaviour when listing model packages in a model registry model package group, in that case the response will only include the ModelPackageArn as identifier, but not the ModelPackageName:

Please know that the SageMaker Service Team informed me this is the expected behaviour, and confirmed that versioned Model Packages attached to a ModelGroup don’t have a “ModelPackageName”, as they are identified by their "ModelPackageArn":
'arn:aws:sagemaker:::model-package//'

Expected Behavior

ModelPackageName member should not be required for ModelPackageSummary entities that belong to a versioned model registry model package group, as par the API response.

Current Behavior

ModelPackageName member is required in the ModelPackageSummary even for versioned model registry model package groups, which results in a validation error when copying a SageMaker API response without modification from the ListModelPackages method to a botocore Stubber that mocks the response the same ListModelPackages operation.

Reproduction Steps

import boto3
from botocore import stub


sagemaker = boto3.client("sagemaker")


with stub.Stubber(sagemaker) as stubber:
    stubber.add_response(
        "list_model_packages",
        {
            "ModelPackageSummaryList": [
                {
                    "ModelPackageGroupName": "some-mock-model",
                    "ModelPackageVersion": 1,
                    "ModelPackageArn": "arn:aws:sagemaker:mock-region-1:123456789:model-package/some-mock-model/1",
                    "ModelPackageDescription": "Foo",
                    "CreationTime": "2023-09-19T12:02:20.199000+00:00",
                    "ModelPackageStatus": "Completed",
                    "ModelApprovalStatus": "Approved",
                },
            ]
        },
    )

Possible Solution

Make the ModelPackageName optional or change the SageMaker API to always return the attribute regardless of whether it is from a versioned model package group or not.

Additional Information/Context

No response

SDK version used

boto3==1.28.54, botocore==1.31.54

Environment details (OS name and version, etc.)

Amazon Linux release 2 (Karoo)

@l3ku l3ku added bug This issue is a confirmed bug. needs-triage This issue or PR still needs to be triaged. labels Sep 26, 2023
@l3ku l3ku changed the title SageMaker ModelSummary structure requires ModelName even when AWS API doesn't return it SageMaker ModelPackageSummary structure requires ModelName even when AWS API doesn't return it Sep 26, 2023
@l3ku l3ku changed the title SageMaker ModelPackageSummary structure requires ModelName even when AWS API doesn't return it SageMaker ModelPackageSummary structure requires ModelPackageName even when AWS API doesn't return it Sep 26, 2023
@indrora indrora added service-api This issue is caused by the service API, not the SDK implementation. and removed needs-triage This issue or PR still needs to be triaged. labels Sep 26, 2023
@indrora
Copy link

indrora commented Sep 26, 2023

If the response from ListModelPackages does not return a required field, it shouldn't be validating. And yet it is.

This is a service side problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a confirmed bug. service-api This issue is caused by the service API, not the SDK implementation.
Projects
None yet
Development

No branches or pull requests

2 participants