Skip to content

Commit a39a573

Browse files
author
Chuyang Deng
committed
breaking: use images_uris.retrieve() for Debugger
1 parent 77086de commit a39a573

File tree

5 files changed

+111
-56
lines changed

5 files changed

+111
-56
lines changed

src/sagemaker/debugger.py

+4-29
Original file line numberDiff line numberDiff line change
@@ -23,32 +23,9 @@
2323

2424
import smdebug_rulesconfig as rule_configs # noqa: F401 # pylint: disable=unused-import
2525

26-
from sagemaker.utils import get_ecr_image_uri_prefix
27-
28-
RULES_ECR_REPO_NAME = "sagemaker-debugger-rules"
29-
30-
SAGEMAKER_RULE_CONTAINERS_ACCOUNTS_MAP = {
31-
"eu-north-1": {RULES_ECR_REPO_NAME: "314864569078"},
32-
"me-south-1": {RULES_ECR_REPO_NAME: "986000313247"},
33-
"ap-south-1": {RULES_ECR_REPO_NAME: "904829902805"},
34-
"eu-west-3": {RULES_ECR_REPO_NAME: "447278800020"},
35-
"us-east-2": {RULES_ECR_REPO_NAME: "915447279597"},
36-
"eu-west-1": {RULES_ECR_REPO_NAME: "929884845733"},
37-
"eu-central-1": {RULES_ECR_REPO_NAME: "482524230118"},
38-
"sa-east-1": {RULES_ECR_REPO_NAME: "818342061345"},
39-
"ap-east-1": {RULES_ECR_REPO_NAME: "199566480951"},
40-
"us-east-1": {RULES_ECR_REPO_NAME: "503895931360"},
41-
"ap-northeast-2": {RULES_ECR_REPO_NAME: "578805364391"},
42-
"eu-west-2": {RULES_ECR_REPO_NAME: "250201462417"},
43-
"ap-northeast-1": {RULES_ECR_REPO_NAME: "430734990657"},
44-
"us-west-2": {RULES_ECR_REPO_NAME: "895741380848"},
45-
"us-west-1": {RULES_ECR_REPO_NAME: "685455198987"},
46-
"ap-southeast-1": {RULES_ECR_REPO_NAME: "972752614525"},
47-
"ap-southeast-2": {RULES_ECR_REPO_NAME: "184798709955"},
48-
"ca-central-1": {RULES_ECR_REPO_NAME: "519511493484"},
49-
"cn-north-1": {RULES_ECR_REPO_NAME: "618459771430"},
50-
"cn-northwest-1": {RULES_ECR_REPO_NAME: "658757709296"},
51-
}
26+
from sagemaker import image_uris
27+
28+
framework_name = "debugger"
5229

5330

5431
def get_rule_container_image_uri(region):
@@ -61,9 +38,7 @@ def get_rule_container_image_uri(region):
6138
Returns:
6239
str: Formatted image uri for the given region and the rule container type
6340
"""
64-
registry_id = SAGEMAKER_RULE_CONTAINERS_ACCOUNTS_MAP.get(region).get(RULES_ECR_REPO_NAME)
65-
image_uri_prefix = get_ecr_image_uri_prefix(registry_id, region)
66-
return "{}/{}:latest".format(image_uri_prefix, RULES_ECR_REPO_NAME)
41+
return image_uris.retrieve(framework_name, region)
6742

6843

6944
class Rule(object):
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"scope": ["debugger"],
3+
"versions": {
4+
"latest": {
5+
"registries": {
6+
"ap-east-1": "199566480951",
7+
"ap-northeast-1": "430734990657",
8+
"ap-northeast-2": "578805364391",
9+
"ap-south-1": "904829902805",
10+
"ap-southeast-1": "972752614525",
11+
"ap-southeast-2": "184798709955",
12+
"ca-central-1": "519511493484",
13+
"cn-north-1": "618459771430",
14+
"cn-northwest-1": "658757709296",
15+
"eu-central-1": "482524230118",
16+
"eu-north-1": "314864569078",
17+
"eu-west-1": "929884845733",
18+
"eu-west-2": "250201462417",
19+
"eu-west-3": "447278800020",
20+
"me-south-1": "986000313247",
21+
"sa-east-1": "818342061345",
22+
"us-east-1": "199566480951",
23+
"us-east-2": "915447279597",
24+
"us-west-1": "685455198987",
25+
"us-west-2": "895741380848"
26+
},
27+
"repository": "sagemaker-debugger-rules"
28+
}
29+
}
30+
}

src/sagemaker/image_uri_config/model-monitor.json

+14-14
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,26 @@
33
"versions": {
44
"": {
55
"registries": {
6-
"eu-north-1": "895015795356",
7-
"me-south-1": "607024016150",
8-
"ap-south-1": "126357580389",
9-
"us-east-2": "777275614652",
10-
"eu-west-1": "468650794304",
11-
"eu-central-1": "048819808253",
12-
"sa-east-1": "539772159869",
136
"ap-east-1": "001633400207",
14-
"us-east-1": "156813124566",
15-
"ap-northeast-2": "709848358524",
16-
"eu-west-2": "749857270468",
17-
"eu-west-3": "680080141114",
187
"ap-northeast-1": "574779866223",
19-
"us-west-2": "159807026194",
20-
"us-west-1": "890145073186",
8+
"ap-northeast-2": "709848358524",
9+
"ap-south-1": "126357580389",
2110
"ap-southeast-1": "245545462676",
2211
"ap-southeast-2": "563025443158",
2312
"ca-central-1": "536280801234",
2413
"cn-north-1": "453000072557",
25-
"cn-northwest-1": "453252182341"
14+
"cn-northwest-1": "453252182341",
15+
"eu-central-1": "048819808253",
16+
"eu-north-1": "895015795356",
17+
"eu-west-1": "468650794304",
18+
"eu-west-2": "749857270468",
19+
"eu-west-3": "680080141114",
20+
"me-south-1": "607024016150",
21+
"sa-east-1": "539772159869",
22+
"us-east-1": "156813124566",
23+
"us-east-2": "777275614652",
24+
"us-west-1": "890145073186",
25+
"us-west-2": "159807026194"
2626
},
2727
"repository": "sagemaker-model-monitor-analyzer"
2828
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
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": "199566480951",
20+
"ap-northeast-1": "430734990657",
21+
"ap-northeast-2": "578805364391",
22+
"ap-south-1": "904829902805",
23+
"ap-southeast-1": "972752614525",
24+
"ap-southeast-2": "184798709955",
25+
"ca-central-1": "519511493484",
26+
"cn-north-1": "618459771430",
27+
"cn-northwest-1": "658757709296",
28+
"eu-central-1": "482524230118",
29+
"eu-north-1": "314864569078",
30+
"eu-west-1": "929884845733",
31+
"eu-west-2": "250201462417",
32+
"eu-west-3": "447278800020",
33+
"me-south-1": "986000313247",
34+
"sa-east-1": "818342061345",
35+
"us-east-1": "199566480951",
36+
"us-east-2": "915447279597",
37+
"us-west-1": "685455198987",
38+
"us-west-2": "895741380848",
39+
}
40+
41+
42+
def test_debugger():
43+
for region in regions.regions():
44+
if region in ACCOUNTS.keys():
45+
uri = image_uris.retrieve("debugger", region=region)
46+
47+
expected = expected_uris.algo_uri(
48+
"sagemaker-debugger-rules", ACCOUNTS[region], region, version="latest"
49+
)
50+
assert expected == uri

tests/unit/sagemaker/image_uris/test_model_monitor.py

+13-13
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,26 @@
1616
from tests.unit.sagemaker.image_uris import expected_uris, regions
1717

1818
ACCOUNTS = {
19-
"eu-north-1": "895015795356",
20-
"me-south-1": "607024016150",
21-
"ap-south-1": "126357580389",
22-
"us-east-2": "777275614652",
23-
"eu-west-1": "468650794304",
24-
"eu-central-1": "048819808253",
25-
"sa-east-1": "539772159869",
2619
"ap-east-1": "001633400207",
27-
"us-east-1": "156813124566",
28-
"ap-northeast-2": "709848358524",
29-
"eu-west-2": "749857270468",
30-
"eu-west-3": "680080141114",
3120
"ap-northeast-1": "574779866223",
32-
"us-west-2": "159807026194",
33-
"us-west-1": "890145073186",
21+
"ap-northeast-2": "709848358524",
22+
"ap-south-1": "126357580389",
3423
"ap-southeast-1": "245545462676",
3524
"ap-southeast-2": "563025443158",
3625
"ca-central-1": "536280801234",
3726
"cn-north-1": "453000072557",
3827
"cn-northwest-1": "453252182341",
28+
"eu-central-1": "048819808253",
29+
"eu-north-1": "895015795356",
30+
"eu-west-1": "468650794304",
31+
"eu-west-2": "749857270468",
32+
"eu-west-3": "680080141114",
33+
"me-south-1": "607024016150",
34+
"sa-east-1": "539772159869",
35+
"us-east-1": "156813124566",
36+
"us-east-2": "777275614652",
37+
"us-west-1": "890145073186",
38+
"us-west-2": "159807026194",
3939
}
4040

4141

0 commit comments

Comments
 (0)