Skip to content

Commit 8a763c6

Browse files
author
Roja Reddy Sareddy
committed
add retry for adapter IC creation on transient endpoint-not-found
1 parent a31427d commit 8a763c6

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

sagemaker-serve/src/sagemaker/serve/model_builder.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4439,11 +4439,21 @@ def _deploy_model_customization(
44394439
),
44404440
)
44414441

4442-
InferenceComponent.create(
4443-
inference_component_name=adapter_ic_name,
4444-
endpoint_name=endpoint_name,
4445-
specification=adapter_ic_spec,
4446-
)
4442+
for attempt in range(3):
4443+
try:
4444+
InferenceComponent.create(
4445+
inference_component_name=adapter_ic_name,
4446+
endpoint_name=endpoint_name,
4447+
specification=adapter_ic_spec,
4448+
)
4449+
break
4450+
except ClientError as e:
4451+
if "Could not find endpoint" in str(e) and attempt < 2:
4452+
import time
4453+
logger.info("Endpoint not yet visible, retrying in %ds...", 5 * (attempt + 1))
4454+
time.sleep(5 * (attempt + 1))
4455+
else:
4456+
raise
44474457
logger.info("Created adapter InferenceComponent: '%s'", adapter_ic_name)
44484458

44494459
else:

0 commit comments

Comments
 (0)