Repository navigation
fix(image_uris): reject unsupported container_version instead of returning a bad URI - #6377
Merged
rsareddy0329 merged 2 commits intoOct 5, 2026
Conversation
retrieve() concatenated a caller-supplied container_version into the image
tag with no validation, so e.g. retrieve("pytorch", version="1.12",
image_scope="inference", instance_type="ml.p3.8xlarge", container_version="1.1")
returned pytorch-inference:1.12-gpu-py38-1.1 -- an image that does not exist
(the "1.1" is a Deep Learning Containers release version, not a tag build
component). The call silently succeeded with an unpullable URI (aws#3702).
container_version is only meaningful for frameworks whose tag carries a
trailing build component: declared in the config container_version map (which
already overrides the caller value), or appended by the graviton, neuron,
HuggingFace and pytorch-smp paths. For any other framework a caller-supplied
container_version can only produce a non-existent tag, so raise a clear
ValueError instead of returning a broken URI.
This is the V2 (master-v2) counterpart of aws#6376.
Add a unit test; existing graviton and HuggingFace container_version tests
continue to pass.
Relates-to aws#3702
The aws#3702 guard rejected a caller-supplied container_version for any framework whose config has no container_version map and that is not HuggingFace/graviton/neuron/pytorch-smp. That wrongly broke Spark: PySparkProcessor/SparkJarProcessor call image_uris.retrieve("spark", ..., container_version="v1"), and spark.json has no container_version map, so the guard raised ValueError and broke Spark image retrieval (test_processing.py::test_retrieve_image_uri). Replace the ad hoc framework checks with an explicit FRAMEWORKS_WITH_CONTAINER_VERSION_SUFFIX allowlist (huggingface, pytorch-smp, spark) so the set of frameworks that legitimately append a container_version is self-documenting, and add a Spark regression test. Relates-to aws#3702
jam-jee
approved these changes
Oct 5, 2026
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue #, if available: Fixes #3702
Description of changes:
image_uris.retrieve()concatenated a caller-suppliedcontainer_versioninto the imagetag without validation, so
returned a URI for an image that does not exist — the call silently succeeded with an
unpullable image (#3702). The
"1.1"is a Deep Learning Containers release version, nota tag build component.
container_versionis only meaningful for frameworks whose tag carries a trailing buildcomponent — declared in the config
container_versionmap (which already overrides thecaller value), or appended by the graviton, neuron, HuggingFace and
pytorch-smp paths. For any other framework a caller-supplied
container_versioncanonly produce a non-existent tag, so this raises a clear
ValueErrorinstead of returninga broken URI.
This is the V2 (
master-v2) counterpart of #6376.Testing:
test_retrieve_rejects_container_version_for_unsupported_framework: a plain frameworkwith
container_versionraises; omitting it still returns the valid tag.tests/unit/sagemaker/image_uris/test_retrieve.py+test_graviton.pypass (102 passed),including the existing graviton (
ubuntu20.04-sagemaker) and HuggingFace (cu110-ubuntu18.04)container_versiontests.flake8andblack -l 100clean on changed files.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.