Skip to content

Commit 9287773

Browse files
committed
drop tagging functionality for now
1 parent e5f5865 commit 9287773

File tree

5 files changed

+15
-49
lines changed

5 files changed

+15
-49
lines changed

src/sagemaker/inference_recommender/inference_recommender_mixin.py

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@
3030

3131
LOGGER = logging.getLogger("sagemaker")
3232

33-
DEPLOYMENT_RECOMMENDATION_TAG = "PythonSDK-DeploymentRecommendation"
34-
35-
RIGHT_SIZE_TAG = "PythonSDK-RightSize"
36-
3733

3834
class Phase:
3935
"""Used to store phases of a traffic pattern to perform endpoint load testing.
@@ -222,7 +218,6 @@ def _update_params(
222218
explainer_config = kwargs["explainer_config"]
223219
inference_recommendation_id = kwargs["inference_recommendation_id"]
224220
inference_recommender_job_results = kwargs["inference_recommender_job_results"]
225-
tags = kwargs["tags"]
226221
if inference_recommendation_id is not None:
227222
inference_recommendation = self._update_params_for_recommendation_id(
228223
instance_type=instance_type,
@@ -243,10 +238,11 @@ def _update_params(
243238
explainer_config,
244239
)
245240

246-
if inference_recommendation:
247-
tags = self._add_client_type_tag(tags, inference_recommendation[2])
248-
return (inference_recommendation[0], inference_recommendation[1], tags)
249-
return (instance_type, initial_instance_count, tags)
241+
return (
242+
inference_recommendation
243+
if inference_recommendation
244+
else (instance_type, initial_instance_count)
245+
)
250246

251247
def _update_params_for_right_size(
252248
self,
@@ -310,7 +306,7 @@ def _update_params_for_right_size(
310306
initial_instance_count = self.inference_recommendations[0]["EndpointConfiguration"][
311307
"InitialInstanceCount"
312308
]
313-
return (instance_type, initial_instance_count, RIGHT_SIZE_TAG)
309+
return (instance_type, initial_instance_count)
314310

315311
def _update_params_for_recommendation_id(
316312
self,
@@ -410,7 +406,7 @@ def _update_params_for_recommendation_id(
410406
raise ValueError("Must specify model recommendation id and instance count.")
411407
self.env.update(model_recommendation["Environment"])
412408
instance_type = model_recommendation["InstanceType"]
413-
return (instance_type, initial_instance_count, DEPLOYMENT_RECOMMENDATION_TAG)
409+
return (instance_type, initial_instance_count)
414410

415411
# Update params based on default inference recommendation
416412
if bool(instance_type) != bool(initial_instance_count):
@@ -474,7 +470,7 @@ def _update_params_for_recommendation_id(
474470
"InitialInstanceCount"
475471
]
476472

477-
return (instance_type, initial_instance_count, RIGHT_SIZE_TAG)
473+
return (instance_type, initial_instance_count)
478474

479475
def _convert_to_endpoint_configurations_json(
480476
self, hyperparameter_ranges: List[Dict[str, CategoricalParameter]]
@@ -614,9 +610,3 @@ def _search_recommendation(self, recommendation_list, inference_recommendation_i
614610
),
615611
None,
616612
)
617-
618-
def _add_client_type_tag(self, tags, client_type):
619-
"""Tagging for Inference Recommender and Deployment Recommendations"""
620-
client_type_tag = {"Key": "ClientType", "Value": client_type}
621-
tags = tags.append(client_type_tag) if tags else [client_type_tag]
622-
return tags

src/sagemaker/model.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1234,7 +1234,7 @@ def deploy(
12341234
inference_recommendation_id is not None
12351235
or self.inference_recommender_job_results is not None
12361236
):
1237-
instance_type, initial_instance_count, tags = self._update_params(
1237+
instance_type, initial_instance_count = self._update_params(
12381238
instance_type=instance_type,
12391239
initial_instance_count=initial_instance_count,
12401240
accelerator_type=accelerator_type,
@@ -1243,7 +1243,6 @@ def deploy(
12431243
explainer_config=explainer_config,
12441244
inference_recommendation_id=inference_recommendation_id,
12451245
inference_recommender_job_results=self.inference_recommender_job_results,
1246-
tags=tags,
12471246
)
12481247

12491248
is_async = async_inference_config is not None
@@ -1738,10 +1737,10 @@ def _create_sagemaker_model(self, *args, **kwargs): # pylint: disable=unused-ar
17381737
17391738
Args:
17401739
args: Positional arguments coming from the caller. This class does not require
1741-
any but will look for tags in the 3rd parameter.
1740+
any so they are ignored.
17421741
17431742
kwargs: Keyword arguments coming from the caller. This class does not require
1744-
any but will search for tags if not in args.
1743+
any so they are ignored.
17451744
"""
17461745
if self.algorithm_arn:
17471746
# When ModelPackage is created using an algorithm_arn we need to first
@@ -1763,17 +1762,12 @@ def _create_sagemaker_model(self, *args, **kwargs): # pylint: disable=unused-ar
17631762
self._ensure_base_name_if_needed(model_package_name.split("/")[-1])
17641763
self._set_model_name_if_needed()
17651764

1766-
# If tags are in args, it must be the 3rd param
1767-
# If not, then check kwargs and set to either tags or None
1768-
tags = args[2] if len(args) >= 3 else kwargs.get("tags")
1769-
17701765
self.sagemaker_session.create_model(
17711766
self.name,
17721767
self.role,
17731768
container_def,
17741769
vpc_config=self.vpc_config,
17751770
enable_network_isolation=self.enable_network_isolation(),
1776-
tags=tags,
17771771
)
17781772

17791773
def _ensure_base_name_if_needed(self, base_name):

tests/unit/sagemaker/inference_recommender/test_inference_recommender_mixin.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -181,13 +181,6 @@
181181
"ModelPackageName": MODEL_PACKAGE_ARN,
182182
}
183183

184-
IR_TAGS = [
185-
{
186-
"Key": "ClientType",
187-
"Value": "PythonSDK-RightSize",
188-
}
189-
]
190-
191184

192185
@pytest.fixture()
193186
def sagemaker_session():
@@ -592,7 +585,6 @@ def test_deploy_right_size_with_model_package_succeeds(
592585
IR_MODEL_PACKAGE_CONTAINER_DEF,
593586
vpc_config=None,
594587
enable_network_isolation=False,
595-
tags=IR_TAGS,
596588
)
597589

598590
sagemaker_session.endpoint_from_production_variants.assert_called_with(
@@ -602,7 +594,7 @@ def test_deploy_right_size_with_model_package_succeeds(
602594
kms_key=None,
603595
name="ir-endpoint-test",
604596
production_variants=IR_PRODUCTION_VARIANTS,
605-
tags=IR_TAGS,
597+
tags=None,
606598
wait=True,
607599
)
608600

@@ -623,7 +615,6 @@ def test_deploy_right_size_with_both_overrides_succeeds(
623615
IR_MODEL_PACKAGE_CONTAINER_DEF,
624616
vpc_config=None,
625617
enable_network_isolation=False,
626-
tags=None,
627618
)
628619

629620
sagemaker_session.endpoint_from_production_variants.assert_called_with(
@@ -680,7 +671,6 @@ def test_deploy_right_size_serverless_override(sagemaker_session, default_right_
680671
IR_MODEL_PACKAGE_CONTAINER_DEF,
681672
vpc_config=None,
682673
enable_network_isolation=False,
683-
tags=None,
684674
)
685675

686676
sagemaker_session.endpoint_from_production_variants.assert_called_with(
@@ -713,7 +703,6 @@ def test_deploy_right_size_async_override(sagemaker_session, default_right_sized
713703
IR_MODEL_PACKAGE_CONTAINER_DEF,
714704
vpc_config=None,
715705
enable_network_isolation=False,
716-
tags=None,
717706
)
718707

719708
sagemaker_session.endpoint_from_production_variants.assert_called_with(
@@ -756,7 +745,6 @@ def test_deploy_right_size_explainer_config_override(sagemaker_session, default_
756745
IR_MODEL_PACKAGE_CONTAINER_DEF,
757746
vpc_config=None,
758747
enable_network_isolation=False,
759-
tags=None,
760748
)
761749

762750
sagemaker_session.endpoint_from_production_variants.assert_called_with(

tests/unit/sagemaker/model/test_deploy.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@
4545
IR_COMPILATION_CONTAINER_DEF,
4646
IR_MODEL_PACKAGE_CONTAINER_DEF,
4747
IR_COMPILATION_MODEL_PACKAGE_CONTAINER_DEF,
48-
IR_TAGS,
49-
DEPLOYMENT_RECOMMENDATION_TAGS,
5048
)
5149
from tests.unit.sagemaker.inference_recommender.constructs import (
5250
create_inference_recommendations_job_default_with_model_name,
@@ -649,7 +647,6 @@ def test_deploy_with_recommendation_id_with_model_pkg_arn(name_from_base, sagema
649647
IR_MODEL_PACKAGE_CONTAINER_DEF,
650648
vpc_config=None,
651649
enable_network_isolation=False,
652-
tags=IR_TAGS,
653650
)
654651

655652
assert model_package.model_package_arn == IR_MODEL_PACKAGE_VERSION_ARN
@@ -682,7 +679,7 @@ def test_deploy_with_recommendation_id_with_model_name(name_from_base, sagemaker
682679
container_defs=IR_CONTAINER_DEF,
683680
vpc_config=None,
684681
enable_network_isolation=False,
685-
tags=IR_TAGS,
682+
tags=None,
686683
)
687684

688685
assert model.model_data == IR_MODEL_DATA
@@ -718,7 +715,6 @@ def test_deploy_with_recommendation_id_with_model_pkg_arn_and_compilation(
718715
IR_COMPILATION_MODEL_PACKAGE_CONTAINER_DEF,
719716
vpc_config=None,
720717
enable_network_isolation=False,
721-
tags=IR_TAGS,
722718
)
723719

724720
assert model_package.model_data == IR_COMPILATION_MODEL_DATA
@@ -753,7 +749,7 @@ def mock_describe_compilation_job(CompilationJobName):
753749
container_defs=IR_COMPILATION_CONTAINER_DEF,
754750
vpc_config=None,
755751
enable_network_isolation=False,
756-
tags=IR_TAGS,
752+
tags=None,
757753
)
758754

759755
assert model.model_data == IR_COMPILATION_MODEL_DATA
@@ -812,7 +808,7 @@ def test_deploy_with_valid_model_recommendation_id(name_from_base, sagemaker_ses
812808
container_defs=DEPLOYMENT_RECOMMENDATION_CONTAINER_DEF,
813809
vpc_config=None,
814810
enable_network_isolation=False,
815-
tags=DEPLOYMENT_RECOMMENDATION_TAGS,
811+
tags=None,
816812
)
817813

818814
assert model.model_data == IR_MODEL_DATA

tests/unit/sagemaker/model/test_model_package.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ def test_create_sagemaker_model_uses_model_name(name_from_base, sagemaker_sessio
115115
{"ModelPackageName": model_package_name},
116116
vpc_config=None,
117117
enable_network_isolation=False,
118-
tags=None,
119118
)
120119

121120

@@ -142,7 +141,6 @@ def test_create_sagemaker_model_include_environment_variable(sagemaker_session):
142141
{"ModelPackageName": model_package_name, "Environment": environment},
143142
vpc_config=None,
144143
enable_network_isolation=False,
145-
tags=None,
146144
)
147145

148146

0 commit comments

Comments
 (0)