Skip to content

Commit 46478d6

Browse files
authored
Merge branch 'master' into mwfongAWS-SM-sdk
2 parents 832d70d + 47354f0 commit 46478d6

File tree

10 files changed

+69
-12
lines changed

10 files changed

+69
-12
lines changed

CHANGELOG.md

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

3+
## v2.155.0 (2023-05-15)
4+
5+
### Features
6+
7+
* Add support for SageMaker Serverless inference Provisioned Concurrency feature
8+
9+
### Bug Fixes and Other Changes
10+
11+
* Revert "fix: make RemoteExecutor context manager non-blocking on pend…
12+
* Add BOM to no No P2 Availability region list
13+
314
## v2.154.0 (2023-05-11)
415

516
### Features

VERSION

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

src/sagemaker/djl_inference/model.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -854,11 +854,13 @@ def generate_serving_properties(self, serving_properties=None) -> Dict[str, str]
854854
if self.low_cpu_mem_usage:
855855
serving_properties["option.low_cpu_mem_usage"] = self.low_cpu_mem_usage
856856
# This is a workaround due to a bug in our built in handler for huggingface
857-
# TODO: This needs to be fixed when new dlc is published
857+
# TODO: Remove this logic whenever 0.20.0 image is out of service
858858
if (
859859
serving_properties["option.entryPoint"] == "djl_python.huggingface"
860860
and self.dtype
861861
and self.dtype != "auto"
862+
and self.djl_version
863+
and int(self.djl_version.split(".")[1]) < 21
862864
):
863865
serving_properties["option.dtype"] = "auto"
864866
serving_properties.pop("option.load_in_8bit", None)

src/sagemaker/experiments/run.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,10 @@ def _extract_run_name_from_tc_name(trial_component_name: str, experiment_name: s
633633
Returns:
634634
str: The name of the Run object supplied by a user.
635635
"""
636-
return trial_component_name.replace("{}{}".format(experiment_name, DELIMITER), "", 1)
636+
# TODO: we should revert the lower casting once backend fix reaches prod
637+
return trial_component_name.replace(
638+
"{}{}".format(experiment_name.lower(), DELIMITER), "", 1
639+
)
637640

638641
@staticmethod
639642
def _append_run_tc_label_to_tags(tags: Optional[List[Dict[str, str]]] = None) -> list:
@@ -869,6 +872,8 @@ def list_runs(
869872
Returns:
870873
list: A list of ``Run`` objects.
871874
"""
875+
876+
# all trial components retrieved by default
872877
tc_summaries = _TrialComponent.list(
873878
experiment_name=experiment_name,
874879
created_before=created_before,

src/sagemaker/inference_recommender/inference_recommender_mixin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,10 @@ def right_size(
145145
)
146146

147147
if endpoint_configurations or traffic_pattern or stopping_conditions or resource_limit:
148-
LOGGER.info("Advance Job parameters were specified. Running Advanced job...")
148+
LOGGER.info("Advanced Job parameters were specified. Running Advanced job...")
149149
job_type = "Advanced"
150150
else:
151-
LOGGER.info("Advance Job parameters were not specified. Running Default job...")
151+
LOGGER.info("Advanced Job parameters were not specified. Running Default job...")
152152
job_type = "Default"
153153

154154
self._init_sagemaker_session_if_does_not_exist()

tests/integ/sagemaker/experiments/test_run.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,38 @@ def test_list(run_obj, sagemaker_session):
642642
assert run_tcs[0].experiment_config == run_obj.experiment_config
643643

644644

645+
def test_list_twice(run_obj, sagemaker_session):
646+
tc1 = _TrialComponent.create(
647+
trial_component_name=f"non-run-tc1-{name()}",
648+
sagemaker_session=sagemaker_session,
649+
)
650+
tc2 = _TrialComponent.create(
651+
trial_component_name=f"non-run-tc2-{name()}",
652+
sagemaker_session=sagemaker_session,
653+
tags=TAGS,
654+
)
655+
run_obj._trial.add_trial_component(tc1)
656+
run_obj._trial.add_trial_component(tc2)
657+
658+
run_tcs = list_runs(
659+
experiment_name=run_obj.experiment_name, sagemaker_session=sagemaker_session
660+
)
661+
assert len(run_tcs) == 1
662+
assert run_tcs[0].run_name == run_obj.run_name
663+
assert run_tcs[0].experiment_name == run_obj.experiment_name
664+
assert run_tcs[0].experiment_config == run_obj.experiment_config
665+
666+
# note the experiment name used by run_obj is already mixed case and so
667+
# covers the mixed case experiment name double create issue
668+
run_tcs_second_result = list_runs(
669+
experiment_name=run_obj.experiment_name, sagemaker_session=sagemaker_session
670+
)
671+
assert len(run_tcs) == 1
672+
assert run_tcs_second_result[0].run_name == run_obj.run_name
673+
assert run_tcs_second_result[0].experiment_name == run_obj.experiment_name
674+
assert run_tcs_second_result[0].experiment_config == run_obj.experiment_config
675+
676+
645677
def _generate_estimator(
646678
exp_name,
647679
sdk_tar,

tests/integ/utils.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,15 @@
1919
from tests.conftest import NO_P3_REGIONS, NO_M4_REGIONS
2020
from sagemaker.exceptions import CapacityError
2121

22+
P2_INSTANCES = ["ml.p2.xlarge", "ml.p2.8xlarge", "ml.p2.16xlarge"]
23+
P3_INSTANCES = ["ml.p3.2xlarge"]
24+
2225

2326
def gpu_list(region):
2427
if region in NO_P3_REGIONS:
25-
return ["ml.p2.xlarge"]
28+
return P2_INSTANCES
2629
else:
27-
return ["ml.p3.2xlarge", "ml.p2.xlarge"]
30+
return [*P2_INSTANCES, *P3_INSTANCES]
2831

2932

3033
def cpu_list(region):

tests/unit/sagemaker/experiments/helpers.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818

1919
TEST_EXP_NAME = "my-experiment"
20+
TEST_EXP_NAME_MIXED_CASE = "My-eXpeRiMeNt"
2021
TEST_RUN_NAME = "my-run"
2122
TEST_EXP_DISPLAY_NAME = "my-experiment-display-name"
2223
TEST_RUN_DISPLAY_NAME = "my-run-display-name"

tests/unit/sagemaker/experiments/test_run.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
mock_trial_load_or_create_func,
4949
mock_tc_load_or_create_func,
5050
TEST_EXP_NAME,
51+
TEST_EXP_NAME_MIXED_CASE,
5152
TEST_RUN_NAME,
5253
TEST_EXP_DISPLAY_NAME,
5354
TEST_RUN_DISPLAY_NAME,
@@ -779,7 +780,9 @@ def test_list(mock_tc_search, mock_tc_list, mock_tc_load, run_obj, sagemaker_ses
779780
]
780781
mock_tc_list.return_value = [
781782
TrialComponentSummary(
782-
trial_component_name=Run._generate_trial_component_name("A" + str(i), TEST_EXP_NAME),
783+
trial_component_name=Run._generate_trial_component_name(
784+
"A" + str(i), TEST_EXP_NAME_MIXED_CASE
785+
),
783786
trial_component_arn="b" + str(i),
784787
display_name="C" + str(i),
785788
source_arn="D" + str(i),
@@ -798,7 +801,7 @@ def test_list(mock_tc_search, mock_tc_list, mock_tc_load, run_obj, sagemaker_ses
798801
(
799802
_TrialComponent(
800803
trial_component_name=Run._generate_trial_component_name(
801-
"a" + str(i), TEST_EXP_NAME
804+
"a" + str(i), TEST_EXP_NAME_MIXED_CASE
802805
),
803806
trial_component_arn="b" + str(i),
804807
display_name="C" + str(i),
@@ -818,14 +821,14 @@ def test_list(mock_tc_search, mock_tc_list, mock_tc_load, run_obj, sagemaker_ses
818821
]
819822

820823
run_list = list_runs(
821-
experiment_name=TEST_EXP_NAME,
824+
experiment_name=TEST_EXP_NAME_MIXED_CASE,
822825
sort_by=SortByType.CREATION_TIME,
823826
sort_order=SortOrderType.ASCENDING,
824827
sagemaker_session=sagemaker_session,
825828
)
826829

827830
mock_tc_list.assert_called_once_with(
828-
experiment_name=TEST_EXP_NAME,
831+
experiment_name=TEST_EXP_NAME_MIXED_CASE,
829832
created_before=None,
830833
created_after=None,
831834
sort_by="CreationTime",

tests/unit/test_djl_inference.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ def test_generate_serving_properties_with_valid_configurations(
454454
"option.entryPoint": "djl_python.huggingface",
455455
"option.s3url": VALID_UNCOMPRESSED_MODEL_DATA,
456456
"option.tensor_parallel_degree": 1,
457-
"option.dtype": "auto",
457+
"option.dtype": "fp32",
458458
"option.device_id": 4,
459459
"option.device_map": "balanced",
460460
}

0 commit comments

Comments
 (0)