Skip to content

Commit 2f6752f

Browse files
author
Joseph Zhang
committed
fix: update inference recommender integration tests to only use realtime endpoints.
1 parent 2460eb5 commit 2f6752f

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

src/sagemaker/inference_recommender/inference_recommender_mixin.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -607,12 +607,12 @@ def _search_recommendation(self, recommendation_list, inference_recommendation_i
607607
None,
608608
)
609609

610-
# TODO: until we have bandwidth to integrate right_size + deploy with serverless
610+
# TODO: until we have bandwidth to integrate right_size + deploy with serverless
611611
def _filter_recommendations_for_realtime(self):
612612
instance_type = None
613613
initial_instance_count = None
614614
for recommendations in self.inference_recommendations:
615-
if not "serverlessConfig" in recommendations["EndpointConfiguration"]:
615+
if not "ServerlessConfig" in recommendations["EndpointConfiguration"]:
616616
instance_type = recommendations["EndpointConfiguration"]["InstanceType"]
617617
initial_instance_count = recommendations["EndpointConfiguration"][
618618
"InitialInstanceCount"

tests/integ/test_inference_recommender.py

+15-1
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,10 @@ def test_deploy_inference_recommendation_id_with_registered_model_sklearn(
454454
rec_res = sagemaker_session.sagemaker_client.describe_inference_recommendations_job(
455455
JobName=ir_job_name
456456
)
457-
rec_id = rec_res["InferenceRecommendations"][0]["RecommendationId"]
457+
458+
rec_id = get_realtime_recommendation_id(
459+
recommendation_list=rec_res["InferenceRecommendations"]
460+
)
458461

459462
with timeout(minutes=45):
460463
try:
@@ -530,3 +533,14 @@ def poll_for_deployment_recommendation(created_base_model, sagemaker_session):
530533
except Exception as e:
531534
created_base_model.delete_model()
532535
raise e
536+
537+
def get_realtime_recommendation_id(recommendation_list):
538+
"""Search recommendation based on recommendation id"""
539+
next(
540+
(
541+
rec["RecommendationId"]
542+
for rec in recommendation_list
543+
if "InstanceType" in rec
544+
),
545+
None,
546+
)

0 commit comments

Comments
 (0)