Skip to content

Commit bb44bf8

Browse files
committed
breaking: deprecate fw_registry module and use image_uris.retrieve() for SparkML
1 parent 8ff10cc commit bb44bf8

File tree

6 files changed

+88
-336
lines changed

6 files changed

+88
-336
lines changed

src/sagemaker/fw_registry.py

-158
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"scope": ["inference"],
3+
"versions": {
4+
"2.2": {
5+
"registries": {
6+
"ap-east-1": "651117190479",
7+
"ap-northeast-1": "354813040037",
8+
"ap-northeast-2": "366743142698",
9+
"ap-south-1": "720646828776",
10+
"ap-southeast-1": "121021644041",
11+
"ap-southeast-2": "783357654285",
12+
"ca-central-1": "341280168497",
13+
"cn-north-1": "450853457545",
14+
"cn-northwest-1": "451049120500",
15+
"eu-central-1": "492215442770",
16+
"eu-north-1": "662702820516",
17+
"eu-west-1": "141502667606",
18+
"eu-west-2": "764974769150",
19+
"eu-west-3": "659782779980",
20+
"me-south-1": "801668240914",
21+
"sa-east-1": "737474898029",
22+
"us-east-1": "683313688378",
23+
"us-east-2": "257758044811",
24+
"us-gov-west-1": "414596584902",
25+
"us-iso-east-1": "833128469047",
26+
"us-west-1": "746614075791",
27+
"us-west-2": "246618743249"
28+
},
29+
"repository": "sagemaker-sparkml-serving"
30+
}
31+
}
32+
}

src/sagemaker/sparkml/model.py

+2-6
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,11 @@
1313
"""Placeholder docstring"""
1414
from __future__ import absolute_import
1515

16-
from sagemaker import Model, Predictor, Session
16+
from sagemaker import Model, Predictor, Session, image_uris
1717
from sagemaker.content_types import CONTENT_TYPE_CSV
18-
from sagemaker.fw_registry import registry
1918
from sagemaker.serializers import CSVSerializer
2019

2120
framework_name = "sparkml-serving"
22-
repo_name = "sagemaker-sparkml-serving"
2321

2422

2523
class SparkMLPredictor(Predictor):
@@ -94,9 +92,7 @@ def __init__(self, model_data, role=None, spark_version=2.2, sagemaker_session=N
9492
# For local mode, sagemaker_session should be passed as None but we need a session to get
9593
# boto_region_name
9694
region_name = (sagemaker_session or Session()).boto_region_name
97-
image_uri = "{}/{}:{}".format(
98-
registry(region_name, framework_name), repo_name, spark_version
99-
)
95+
image_uri = image_uris.retrieve(framework_name, region_name, version=spark_version)
10096
super(SparkMLModel, self).__init__(
10197
image_uri,
10298
model_data,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Copyright 2020 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+
from sagemaker import image_uris
16+
from tests.unit.sagemaker.image_uris import expected_uris, regions
17+
18+
ACCOUNTS = {
19+
"ap-east-1": "651117190479",
20+
"ap-northeast-1": "354813040037",
21+
"ap-northeast-2": "366743142698",
22+
"ap-south-1": "720646828776",
23+
"ap-southeast-1": "121021644041",
24+
"ap-southeast-2": "783357654285",
25+
"ca-central-1": "341280168497",
26+
"cn-north-1": "450853457545",
27+
"cn-northwest-1": "451049120500",
28+
"eu-central-1": "492215442770",
29+
"eu-north-1": "662702820516",
30+
"eu-west-1": "141502667606",
31+
"eu-west-2": "764974769150",
32+
"eu-west-3": "659782779980",
33+
"me-south-1": "801668240914",
34+
"sa-east-1": "737474898029",
35+
"us-east-1": "683313688378",
36+
"us-east-2": "257758044811",
37+
"us-gov-west-1": "414596584902",
38+
"us-iso-east-1": "833128469047",
39+
"us-west-1": "746614075791",
40+
"us-west-2": "246618743249",
41+
}
42+
VERSION = "2.2"
43+
44+
45+
def test_sparkml():
46+
for region in regions.regions():
47+
uri = image_uris.retrieve("sparkml-serving", region=region, version=VERSION)
48+
49+
expected = expected_uris.algo_uri(
50+
"sagemaker-sparkml-serving", ACCOUNTS[region], region, version=VERSION
51+
)
52+
assert expected == uri

0 commit comments

Comments
 (0)