Skip to content

Commit 0bf6404

Browse files
author
Roja Reddy Sareddy
committed
fix: fix unit test, black-check, pylint errors
1 parent c6bad70 commit 0bf6404

File tree

7 files changed

+21
-18
lines changed

7 files changed

+21
-18
lines changed

src/sagemaker/huggingface/model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,8 +298,8 @@ def deploy(
298298
explainer_config (sagemaker.explainer.ExplainerConfig): Specifies online explainability
299299
configuration for use with Amazon SageMaker Clarify. (default: None)
300300
update_endpoint (Optional[bool]): Flag to update the model in an existing Amazon SageMaker endpoint.
301-
If True, this will deploy a new EndpointConfig to an already existing endpoint and delete resources
302-
corresponding to the previous EndpointConfig. Default: False
301+
If True, this will deploy a new EndpointConfig to an already existing endpoint and
302+
delete resources corresponding to the previous EndpointConfig. Default: False
303303
Raises:
304304
ValueError: If arguments combination check failed in these circumstances:
305305
- If no role is specified or

src/sagemaker/model.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1631,7 +1631,9 @@ def deploy(
16311631
# Support multiple models on same endpoint
16321632
if endpoint_type == EndpointType.INFERENCE_COMPONENT_BASED:
16331633
if update_endpoint:
1634-
raise ValueError("Currently update_endpoint is supported for single model endpoints")
1634+
raise ValueError(
1635+
"Currently update_endpoint is supported for single model endpoints"
1636+
)
16351637
if endpoint_name:
16361638
self.endpoint_name = endpoint_name
16371639
else:

src/sagemaker/serve/builder/model_builder.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1663,7 +1663,9 @@ def deploy(
16631663

16641664
if isinstance(inference_config, ResourceRequirements):
16651665
if update_endpoint:
1666-
raise ValueError("Currently update_endpoint is supported for single model endpoints")
1666+
raise ValueError(
1667+
"Currently update_endpoint is supported for single model endpoints"
1668+
)
16671669
# Multi Model and MultiContainer endpoints with Inference Component
16681670
return self.built_model.deploy(
16691671
instance_type=self.instance_type,

src/sagemaker/session.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4540,8 +4540,8 @@ def create_endpoint_config(
45404540
empty object passed through, will use pre-defined values in
45414541
``ServerlessInferenceConfig`` class to deploy serverless endpoint. Deploy an
45424542
instance based endpoint if it's None. (default: None).
4543-
routing_config (Optional[Dict[str, Any]): Settings the control how the endpoint routes incoming
4544-
traffic to the instances that the endpoint hosts.
4543+
routing_config (Optional[Dict[str, Any]): Settings the control how the endpoint routes
4544+
incoming traffic to the instances that the endpoint hosts.
45454545
Currently, support dictionary key ``RoutingStrategy``.
45464546
45474547
.. code:: python

tests/unit/sagemaker/jumpstart/model/test_model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,7 @@ def test_jumpstart_model_kwargs_match_parent_class(self):
794794
and reach out to JumpStart team."""
795795

796796
init_args_to_skip: Set[str] = set(["model_reference_arn"])
797-
deploy_args_to_skip: Set[str] = set(["kwargs", "model_reference_arn"])
797+
deploy_args_to_skip: Set[str] = set(["kwargs", "model_reference_arn", "update_endpoint"])
798798
deploy_args_removed_at_deploy_time: Set[str] = set(["model_access_configs"])
799799

800800
parent_class_init = Model.__init__

tests/unit/sagemaker/model/test_deploy.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,13 +1134,12 @@ def test_deploy_with_update_endpoint(production_variant, name_from_base, sagemak
11341134

11351135
# Test update_endpoint with async inference config
11361136
async_inference_config = AsyncInferenceConfig(
1137-
output_path="s3://bucket/output",
1138-
failure_path="s3://bucket/failure"
1137+
output_path="s3://bucket/output", failure_path="s3://bucket/failure"
11391138
)
11401139
async_inference_config_dict = {
11411140
"OutputConfig": {
11421141
"S3OutputPath": "s3://bucket/output",
1143-
"S3FailurePath": "s3://bucket/failure"
1142+
"S3FailurePath": "s3://bucket/failure",
11441143
},
11451144
}
11461145
model.deploy(
@@ -1182,7 +1181,9 @@ def test_deploy_with_update_endpoint_inference_component(production_variant, sag
11821181
)
11831182

11841183
# Test that updating endpoint with inference component raises error
1185-
with pytest.raises(ValueError, match="Currently update_endpoint is supported for single model endpoints"):
1184+
with pytest.raises(
1185+
ValueError, match="Currently update_endpoint is supported for single model endpoints"
1186+
):
11861187
model.deploy(
11871188
endpoint_name="test-endpoint",
11881189
instance_type=INSTANCE_TYPE,

tests/unit/sagemaker/serve/builder/test_model_builder.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4138,9 +4138,7 @@ def test_neuron_configurations_rule_set(self):
41384138
{
41394139
"input_args": {
41404140
"inference_config": BatchTransformInferenceConfig(
4141-
instance_count=1,
4142-
instance_type="ml.m5.large",
4143-
output_path="op-path"
4141+
instance_count=1, instance_type="ml.m5.large", output_path="op-path"
41444142
)
41454143
},
41464144
"call_params": {
@@ -4194,9 +4192,9 @@ def test_deploy_multi_model_update_error():
41944192
)
41954193
setattr(model_builder, "built_model", MagicMock())
41964194

4197-
with pytest.raises(ValueError, match="Currently update_endpoint is supported for single model endpoints"):
4195+
with pytest.raises(
4196+
ValueError, match="Currently update_endpoint is supported for single model endpoints"
4197+
):
41984198
model_builder.deploy(
4199-
endpoint_name="test",
4200-
inference_config=RESOURCE_REQUIREMENTS,
4201-
update_endpoint=True
4199+
endpoint_name="test", inference_config=RESOURCE_REQUIREMENTS, update_endpoint=True
42024200
)

0 commit comments

Comments
 (0)