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

list_models API returns inconsistent results from AWS CLI and python SDK #4158

Open
amada2023 opened this issue Jun 7, 2024 · 0 comments
Open
Assignees
Labels
bug This issue is a confirmed bug. investigating This issue is being investigated and/or work is in progress to resolve the issue. p2 This is a standard priority issue sagemaker

Comments

@amada2023
Copy link

Describe the bug

I have to use list_models API with below request body

aws sagemaker list-models --name-contains "model-abc" --sort-by "CreationTime" --sort-order Descending --max-items 1

in CLI case it returns me latest model which contains the required name. it first filters by name and then applies pagination of max-items=1

but in case of python SDK
response = sm_client.list_models(
NameContains="model-abc",
SortBy="CreationTime",
SortOrder="Descending",
MaxResults=1,
)
its first applying the pagination because of MaxResults =1 and then applying filter of name contains which is then returning my model summary as empty [] because the top result is not that name.

This seems like inconsistent behavior in API calls. Conceptually you always filter first and then apply pagination on results as in CLI behavior today.

Expected Behavior

{
"Models": [
{
"ModelName": "model-abc-123",
"ModelArn": "",
"CreationTime": "2024-06-07T13:37:49.303000-04:00"
}
],
"NextToken": ""
}

Current Behavior

{ "Models": [] }

Reproduction Steps

added in description

Possible Solution

No response

Additional Information/Context

No response

SDK version used

python 3.9 on aws

Environment details (OS name and version, etc.)

Amazon Linux 2

@amada2023 amada2023 added bug This issue is a confirmed bug. needs-triage This issue or PR still needs to be triaged. labels Jun 7, 2024
@RyanFitzSimmonsAK RyanFitzSimmonsAK self-assigned this Jun 7, 2024
@RyanFitzSimmonsAK RyanFitzSimmonsAK added investigating This issue is being investigated and/or work is in progress to resolve the issue. sagemaker p2 This is a standard priority issue and removed needs-triage This issue or PR still needs to be triaged. labels Jun 7, 2024
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. investigating This issue is being investigated and/or work is in progress to resolve the issue. p2 This is a standard priority issue sagemaker
2 participants