Skip to content

Commit 730d29e

Browse files
authored
feat: Add SageMaker Geospatial verison 1.x images (#4233)
1 parent 70dd07f commit 730d29e

File tree

3 files changed

+73
-0
lines changed

3 files changed

+73
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"processing": {
3+
"versions": {
4+
"1.x": {
5+
"registries": {
6+
"us-west-2": "081189585635"
7+
},
8+
"repository": "sagemaker-geospatial-v1-0",
9+
"tag_prefix": "latest"
10+
}
11+
}
12+
}
13+
}

tests/unit/sagemaker/image_uris/expected_uris.py

+5
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ def monitor_uri(account, region=REGION):
5959
return MONITOR_URI_FORMAT.format(account, region, domain)
6060

6161

62+
def algo_uri_with_tag(algo, account, region, tag):
63+
domain = ALTERNATE_DOMAINS.get(region, DOMAIN)
64+
return IMAGE_URI_FORMAT.format(account, region, domain, algo, tag)
65+
66+
6267
def graviton_framework_uri(
6368
repo,
6469
fw_version,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License"). You
4+
# may not use this file except in compliance with the License. A copy of
5+
# the License is located at
6+
#
7+
# http://aws.amazon.com/apache2.0/
8+
#
9+
# or in the "license" file accompanying this file. This file is
10+
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11+
# ANY KIND, either express or implied. See the License for the specific
12+
# language governing permissions and limitations under the License.
13+
from __future__ import absolute_import
14+
15+
import pytest
16+
from sagemaker import image_uris
17+
from tests.unit.sagemaker.image_uris import expected_uris
18+
19+
20+
def _test_ecr_uri(account, region, version, tag):
21+
actual_uri = image_uris.retrieve("sagemaker-geospatial", region=region, version=version)
22+
expected_uri = expected_uris.algo_uri_with_tag(
23+
"sagemaker-geospatial-v1-0",
24+
account,
25+
region,
26+
tag=tag,
27+
)
28+
return expected_uri == actual_uri
29+
30+
31+
@pytest.mark.parametrize("load_config", ["sagemaker-geospatial.json"], indirect=True)
32+
@pytest.mark.parametrize("extract_versions_for_image_scope", ["processing"], indirect=True)
33+
def test_sagemaker_geospatial_ecr_uri(load_config, extract_versions_for_image_scope):
34+
VERSIONS = extract_versions_for_image_scope
35+
for version in VERSIONS:
36+
SAGEMAKER_GEOSPATIAL_ACCOUNTS = load_config["processing"]["versions"][version]["registries"]
37+
for region in SAGEMAKER_GEOSPATIAL_ACCOUNTS.keys():
38+
39+
assert _test_ecr_uri(
40+
account=SAGEMAKER_GEOSPATIAL_ACCOUNTS[region],
41+
region=region,
42+
version=version,
43+
tag="latest",
44+
)
45+
46+
47+
@pytest.mark.parametrize("load_config", ["sagemaker-geospatial.json"], indirect=True)
48+
def test_sagemaker_geospatial_ecr_uri_no_version(load_config):
49+
region = "us-west-2"
50+
SAGEMAKER_GEOSPATIAL_ACCOUNTS = load_config["processing"]["versions"]["1.x"]["registries"]
51+
actual_uri = image_uris.retrieve("sagemaker-geospatial", region=region)
52+
expected_uri = expected_uris.algo_uri_with_tag(
53+
"sagemaker-geospatial-v1-0", SAGEMAKER_GEOSPATIAL_ACCOUNTS[region], region, tag="latest"
54+
)
55+
assert expected_uri == actual_uri

0 commit comments

Comments
 (0)