Skip to content

breaking: deprecate fw_registry module and use image_uris.retrieve() for SparkML #1730

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

Merged
merged 1 commit into from
Jul 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
158 changes: 0 additions & 158 deletions src/sagemaker/fw_registry.py

This file was deleted.

32 changes: 32 additions & 0 deletions src/sagemaker/image_uri_config/sparkml-serving.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"scope": ["inference"],
"versions": {
"2.2": {
"registries": {
"ap-east-1": "651117190479",
"ap-northeast-1": "354813040037",
"ap-northeast-2": "366743142698",
"ap-south-1": "720646828776",
"ap-southeast-1": "121021644041",
"ap-southeast-2": "783357654285",
"ca-central-1": "341280168497",
"cn-north-1": "450853457545",
"cn-northwest-1": "451049120500",
"eu-central-1": "492215442770",
"eu-north-1": "662702820516",
"eu-west-1": "141502667606",
"eu-west-2": "764974769150",
"eu-west-3": "659782779980",
"me-south-1": "801668240914",
"sa-east-1": "737474898029",
"us-east-1": "683313688378",
"us-east-2": "257758044811",
"us-gov-west-1": "414596584902",
"us-iso-east-1": "833128469047",
"us-west-1": "746614075791",
"us-west-2": "246618743249"
},
"repository": "sagemaker-sparkml-serving"
}
}
}
8 changes: 2 additions & 6 deletions src/sagemaker/sparkml/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,11 @@
"""Placeholder docstring"""
from __future__ import absolute_import

from sagemaker import Model, Predictor, Session
from sagemaker import Model, Predictor, Session, image_uris
from sagemaker.content_types import CONTENT_TYPE_CSV
from sagemaker.fw_registry import registry
from sagemaker.serializers import CSVSerializer

framework_name = "sparkml-serving"
repo_name = "sagemaker-sparkml-serving"


class SparkMLPredictor(Predictor):
Expand Down Expand Up @@ -94,9 +92,7 @@ def __init__(self, model_data, role=None, spark_version=2.2, sagemaker_session=N
# For local mode, sagemaker_session should be passed as None but we need a session to get
# boto_region_name
region_name = (sagemaker_session or Session()).boto_region_name
image_uri = "{}/{}:{}".format(
registry(region_name, framework_name), repo_name, spark_version
)
image_uri = image_uris.retrieve(framework_name, region_name, version=spark_version)
super(SparkMLModel, self).__init__(
image_uri,
model_data,
Expand Down
52 changes: 52 additions & 0 deletions tests/unit/sagemaker/image_uris/test_sparkml.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompanying this file. This file is
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.
from __future__ import absolute_import

from sagemaker import image_uris
from tests.unit.sagemaker.image_uris import expected_uris, regions

ACCOUNTS = {
"ap-east-1": "651117190479",
"ap-northeast-1": "354813040037",
"ap-northeast-2": "366743142698",
"ap-south-1": "720646828776",
"ap-southeast-1": "121021644041",
"ap-southeast-2": "783357654285",
"ca-central-1": "341280168497",
"cn-north-1": "450853457545",
"cn-northwest-1": "451049120500",
"eu-central-1": "492215442770",
"eu-north-1": "662702820516",
"eu-west-1": "141502667606",
"eu-west-2": "764974769150",
"eu-west-3": "659782779980",
"me-south-1": "801668240914",
"sa-east-1": "737474898029",
"us-east-1": "683313688378",
"us-east-2": "257758044811",
"us-gov-west-1": "414596584902",
"us-iso-east-1": "833128469047",
"us-west-1": "746614075791",
"us-west-2": "246618743249",
}
VERSION = "2.2"


def test_sparkml():
for region in regions.regions():
uri = image_uris.retrieve("sparkml-serving", region=region, version=VERSION)

expected = expected_uris.algo_uri(
"sagemaker-sparkml-serving", ACCOUNTS[region], region, version=VERSION
)
assert expected == uri
Loading