Skip to content

Commit 0901987

Browse files
committed
fix(jumpstart): add eusc-de-east-1 buckets and name JumpStart in the bucket error
`JumpStartModel` for `deepseek-llm-r1-distill-llama-8b` in `eusc-de-east-1` failed with `ValueError: Unable to get content bucket for Neo in eusc-de-east-1 region.` The region configuration had no `eusc-de-east-1` entry, and the JumpStart bucket accessor named Neo in its error. The model does not use Neo. Add the public and gated JumpStart buckets for `eusc-de-east-1`. Name JumpStart in the error. The integration test creates the notebook model in `eusc-de-east-1` with an unsigned S3 client. --- X-AI-Prompt: What is the minimal source change that fixes the EU Sovereign Cloud JumpStart error? X-AI-Tool: claude-code
1 parent 58e4ca8 commit 0901987

4 files changed

Lines changed: 82 additions & 2 deletions

File tree

‎src/sagemaker/jumpstart/region_config.json‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,10 @@
119119
"gated_content_bucket": "jumpstart-private-cache-prod-eu-west-3",
120120
"neo_content_bucket": "sagemaker-sd-models-prod-eu-west-3"
121121
},
122+
"eusc-de-east-1": {
123+
"content_bucket": "jumpstart-cache-prod-eusc-de-east-1",
124+
"gated_content_bucket": "jumpstart-private-cache-prod-eusc-de-east-1"
125+
},
122126
"il-central-1": {
123127
"content_bucket": "jumpstart-cache-prod-il-central-1",
124128
"gated_content_bucket": "jumpstart-private-cache-prod-il-central-1"

‎src/sagemaker/jumpstart/utils.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ def get_jumpstart_content_bucket(
165165
except KeyError:
166166
formatted_launched_regions_str = get_jumpstart_launched_regions_message()
167167
raise ValueError(
168-
f"Unable to get content bucket for Neo in {region} region. "
168+
f"Unable to get content bucket for JumpStart in {region} region. "
169169
f"{formatted_launched_regions_str}"
170170
)
171171

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
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+
"""Regression test for JumpStart model setup in EU Sovereign Cloud."""
14+
from __future__ import absolute_import
15+
16+
import boto3
17+
import pytest
18+
from botocore import UNSIGNED
19+
from botocore.config import Config
20+
21+
from sagemaker.jumpstart.model import JumpStartModel
22+
from sagemaker.session import Session
23+
24+
EUSC_REGION = "eusc-de-east-1"
25+
EUSC_CONTENT_BUCKET = "jumpstart-cache-prod-eusc-de-east-1"
26+
DEEPSEEK_MODEL_ID = "deepseek-llm-r1-distill-llama-8b"
27+
DEEPSEEK_MODEL_VERSION = "3.5.0"
28+
PLACEHOLDER_ROLE_ARN = "arn:aws:iam::111122223333:role/test-role"
29+
30+
31+
@pytest.fixture
32+
def eusc_session():
33+
unsigned_config = Config(signature_version=UNSIGNED)
34+
boto_session = boto3.Session(region_name=EUSC_REGION)
35+
session = Session(
36+
boto_session=boto_session,
37+
sagemaker_client=boto_session.client("sagemaker", config=unsigned_config),
38+
sagemaker_runtime_client=boto_session.client("sagemaker-runtime", config=unsigned_config),
39+
sagemaker_featurestore_runtime_client=boto_session.client(
40+
"sagemaker-featurestore-runtime", config=unsigned_config
41+
),
42+
sagemaker_metrics_client=boto_session.client("sagemaker-metrics", config=unsigned_config),
43+
)
44+
session.s3_client = boto_session.client("s3", config=unsigned_config)
45+
return session
46+
47+
48+
def test_deepseek_public_hub_model_setup_in_eusc(eusc_session):
49+
model = JumpStartModel(
50+
model_id=DEEPSEEK_MODEL_ID,
51+
model_version=DEEPSEEK_MODEL_VERSION,
52+
hub_name="SageMakerPublicHub",
53+
region=EUSC_REGION,
54+
sagemaker_session=eusc_session,
55+
role=PLACEHOLDER_ROLE_ARN,
56+
)
57+
58+
assert model.model_id == DEEPSEEK_MODEL_ID
59+
assert model.model_version == DEEPSEEK_MODEL_VERSION
60+
assert model.model_data["S3DataSource"]["S3Uri"].startswith(f"s3://{EUSC_CONTENT_BUCKET}/")
61+
assert model.additional_model_data_sources is None

‎tests/unit/sagemaker/jumpstart/test_utils.py‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,18 @@ class TestBucketUtils(TestCase):
7474
def test_get_jumpstart_content_bucket(self):
7575
bad_region = "bad_region"
7676
assert bad_region not in JUMPSTART_REGION_NAME_SET
77-
with pytest.raises(ValueError):
77+
with pytest.raises(
78+
ValueError,
79+
match=r"^Unable to get content bucket for JumpStart in bad_region region\.",
80+
):
7881
utils.get_jumpstart_content_bucket(bad_region)
7982

83+
def test_get_jumpstart_content_bucket_eusc(self):
84+
assert (
85+
utils.get_jumpstart_content_bucket("eusc-de-east-1")
86+
== "jumpstart-cache-prod-eusc-de-east-1"
87+
)
88+
8089
def test_get_jumpstart_content_bucket_no_args(self):
8190
assert (
8291
utils.get_jumpstart_content_bucket(JUMPSTART_DEFAULT_REGION_NAME)
@@ -96,6 +105,12 @@ def test_get_jumpstart_gated_content_bucket(self):
96105
with pytest.raises(ValueError):
97106
utils.get_jumpstart_gated_content_bucket(bad_region)
98107

108+
def test_get_jumpstart_gated_content_bucket_eusc(self):
109+
assert (
110+
utils.get_jumpstart_gated_content_bucket("eusc-de-east-1")
111+
== "jumpstart-private-cache-prod-eusc-de-east-1"
112+
)
113+
99114
def test_get_jumpstart_gated_content_bucket_no_args(self):
100115
assert (
101116
utils.get_jumpstart_gated_content_bucket(JUMPSTART_DEFAULT_REGION_NAME)

0 commit comments

Comments
 (0)