Skip to content

Commit b016228

Browse files
authored
Merge branch 'master' into dependabot/pip/requirements/extras/black-24.3.0
2 parents 123f9e4 + 327638e commit b016228

16 files changed

+1861
-290
lines changed

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
# Changelog
22

3+
## v2.214.0 (2024-03-22)
4+
5+
### Features
6+
7+
* add support to ``clarify.py`` for time series explainability jobs
8+
9+
### Bug Fixes and Other Changes
10+
11+
* remove pytorch test for deprecated function
12+
* skip test_experiment_analytics to unblock release
13+
* Create workflow module scoped sagemaker_session to resolve test race condition
14+
* Simplify how we process test dependencies, which are supposed to include all extras.
15+
* skip failing feature store search integ test
16+
* skip failing pt test
17+
* list jumpstart models with invalid version strings
18+
* urge customers to install latest version
19+
320
## v2.213.0 (2024-03-15)
421

522
### Features

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.213.1.dev0
1+
2.214.1.dev0

src/sagemaker/clarify.py

Lines changed: 561 additions & 12 deletions
Large diffs are not rendered by default.

src/sagemaker/session.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ def __init__(
189189
sagemaker_runtime_client=None,
190190
sagemaker_featurestore_runtime_client=None,
191191
default_bucket=None,
192-
settings=SessionSettings(),
192+
settings=None,
193193
sagemaker_metrics_client=None,
194194
sagemaker_config: dict = None,
195195
default_bucket_prefix: str = None,
@@ -260,7 +260,7 @@ def __init__(
260260
self.resource_group_tagging_client = None
261261
self._config = None
262262
self.lambda_client = None
263-
self.settings = settings
263+
self.settings = settings if settings else SessionSettings()
264264

265265
self._initialize(
266266
boto_session=boto_session,
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
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 os
16+
17+
import pytest
18+
from botocore.config import Config
19+
20+
from tests.integ import DATA_DIR
21+
from sagemaker import Session, get_execution_role
22+
23+
CUSTOM_S3_OBJECT_KEY_PREFIX = "session-default-prefix"
24+
25+
26+
# Create a sagemaker_session in workflow scope to prevent race condition
27+
# with other tests. Some other tests may change the session `settings`.
28+
@pytest.fixture(scope="module")
29+
def sagemaker_session_for_pipeline(
30+
sagemaker_client_config,
31+
boto_session,
32+
):
33+
sagemaker_client_config.setdefault("config", Config(retries=dict(max_attempts=10)))
34+
sagemaker_client = (
35+
boto_session.client("sagemaker", **sagemaker_client_config)
36+
if sagemaker_client_config
37+
else None
38+
)
39+
40+
return Session(
41+
boto_session=boto_session,
42+
sagemaker_client=sagemaker_client,
43+
sagemaker_config={},
44+
default_bucket_prefix=CUSTOM_S3_OBJECT_KEY_PREFIX,
45+
)
46+
47+
48+
@pytest.fixture(scope="module")
49+
def smclient(sagemaker_session):
50+
return sagemaker_session.boto_session.client("sagemaker")
51+
52+
53+
@pytest.fixture(scope="module")
54+
def role(sagemaker_session_for_pipeline):
55+
return get_execution_role(sagemaker_session_for_pipeline)
56+
57+
58+
@pytest.fixture(scope="module")
59+
def region_name(sagemaker_session_for_pipeline):
60+
return sagemaker_session_for_pipeline.boto_session.region_name
61+
62+
63+
@pytest.fixture(scope="module")
64+
def script_dir():
65+
return os.path.join(DATA_DIR, "sklearn_processing")

tests/integ/sagemaker/workflow/test_experiment.py

Lines changed: 8 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
from tests.integ.sagemaker.workflow.helpers import wait_pipeline_execution
2121
from sagemaker.processing import ProcessingInput
22-
from sagemaker.session import get_execution_role
2322
from sagemaker.sklearn.processing import SKLearnProcessor
2423
from sagemaker.dataset_definition.inputs import DatasetDefinition, AthenaDatasetDefinition
2524
from sagemaker.workflow.execution_variables import ExecutionVariables
@@ -33,33 +32,13 @@
3332
from tests.integ import DATA_DIR
3433

3534

36-
@pytest.fixture(scope="module")
37-
def region_name(sagemaker_session):
38-
return sagemaker_session.boto_session.region_name
39-
40-
41-
@pytest.fixture(scope="module")
42-
def role(sagemaker_session):
43-
return get_execution_role(sagemaker_session)
44-
45-
46-
@pytest.fixture(scope="module")
47-
def script_dir():
48-
return os.path.join(DATA_DIR, "sklearn_processing")
49-
50-
5135
@pytest.fixture
5236
def pipeline_name():
5337
return f"my-pipeline-{int(time.time() * 10**7)}"
5438

5539

5640
@pytest.fixture
57-
def smclient(sagemaker_session):
58-
return sagemaker_session.boto_session.client("sagemaker")
59-
60-
61-
@pytest.fixture
62-
def athena_dataset_definition(sagemaker_session):
41+
def athena_dataset_definition(sagemaker_session_for_pipeline):
6342
return DatasetDefinition(
6443
local_path="/opt/ml/processing/input/add",
6544
data_distribution_type="FullyReplicated",
@@ -69,15 +48,15 @@ def athena_dataset_definition(sagemaker_session):
6948
database="default",
7049
work_group="workgroup",
7150
query_string='SELECT * FROM "default"."s3_test_table_$STAGE_$REGIONUNDERSCORED";',
72-
output_s3_uri=f"s3://{sagemaker_session.default_bucket()}/add",
51+
output_s3_uri=f"s3://{sagemaker_session_for_pipeline.default_bucket()}/add",
7352
output_format="JSON",
7453
output_compression="GZIP",
7554
),
7655
)
7756

7857

7958
def test_pipeline_execution_with_default_experiment_config(
80-
sagemaker_session,
59+
sagemaker_session_for_pipeline,
8160
smclient,
8261
role,
8362
sklearn_latest_version,
@@ -99,7 +78,7 @@ def test_pipeline_execution_with_default_experiment_config(
9978
instance_type=cpu_instance_type,
10079
instance_count=instance_count,
10180
command=["python3"],
102-
sagemaker_session=sagemaker_session,
81+
sagemaker_session=sagemaker_session_for_pipeline,
10382
base_job_name="test-sklearn",
10483
)
10584

@@ -113,7 +92,7 @@ def test_pipeline_execution_with_default_experiment_config(
11392
name=pipeline_name,
11493
parameters=[instance_count],
11594
steps=[step_sklearn],
116-
sagemaker_session=sagemaker_session,
95+
sagemaker_session=sagemaker_session_for_pipeline,
11796
)
11897

11998
try:
@@ -142,7 +121,7 @@ def test_pipeline_execution_with_default_experiment_config(
142121

143122

144123
def test_pipeline_execution_with_custom_experiment_config(
145-
sagemaker_session,
124+
sagemaker_session_for_pipeline,
146125
smclient,
147126
role,
148127
sklearn_latest_version,
@@ -164,7 +143,7 @@ def test_pipeline_execution_with_custom_experiment_config(
164143
instance_type=cpu_instance_type,
165144
instance_count=instance_count,
166145
command=["python3"],
167-
sagemaker_session=sagemaker_session,
146+
sagemaker_session=sagemaker_session_for_pipeline,
168147
base_job_name="test-sklearn",
169148
)
170149

@@ -185,7 +164,7 @@ def test_pipeline_execution_with_custom_experiment_config(
185164
trial_name=Join(on="-", values=["my-trial", ExecutionVariables.PIPELINE_EXECUTION_ID]),
186165
),
187166
steps=[step_sklearn],
188-
sagemaker_session=sagemaker_session,
167+
sagemaker_session=sagemaker_session_for_pipeline,
189168
)
190169

191170
try:

0 commit comments

Comments
 (0)