Skip to content

Commit 1ba381f

Browse files
Joseph Zhangknikure
authored andcommitted
fix: update inference recommender integration tests to only use realtime endpoints.
1 parent 7e826c9 commit 1ba381f

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

src/sagemaker/inference_recommender/inference_recommender_mixin.py

Lines changed: 2 additions & 2 deletions
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

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,10 @@ def test_deploy_inference_recommendation_id_with_registered_model_sklearn(
460460
rec_res = sagemaker_session.sagemaker_client.describe_inference_recommendations_job(
461461
JobName=ir_job_name
462462
)
463-
rec_id = rec_res["InferenceRecommendations"][0]["RecommendationId"]
463+
464+
rec_id = get_realtime_recommendation_id(
465+
recommendation_list=rec_res["InferenceRecommendations"]
466+
)
464467

465468
with timeout(minutes=45):
466469
try:
@@ -537,3 +540,14 @@ def poll_for_deployment_recommendation(created_base_model, sagemaker_session):
537540
except Exception as e:
538541
created_base_model.delete_model()
539542
raise e
543+
544+
def get_realtime_recommendation_id(recommendation_list):
545+
"""Search recommendation based on recommendation id"""
546+
next(
547+
(
548+
rec["RecommendationId"]
549+
for rec in recommendation_list
550+
if "InstanceType" in rec
551+
),
552+
None,
553+
)

0 commit comments

Comments
 (0)