Skip to content

Commit 4cdc25b

Browse files
author
Mohamed Zeidan
committed
removed silent failure for sdk
1 parent 12585f3 commit 4cdc25b

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/sagemaker/hyperpod/cli/cluster_stack_utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,9 +347,10 @@ def _handle_stack_deletion_error(error: Exception, stack_name: str, region: str,
347347
return False # Should re-raise
348348

349349
# Handle CloudFormation retain-resources limitation
350+
# Always re-raise for SDK usage to ensure clear exceptions
350351
if retain_resources and "specify which resources to retain only when the stack is in the DELETE_FAILED state" in error_str:
351352
_handle_retention_limitation_error(stack_name, retain_resources, region, message_callback)
352-
return True # Handle gracefully, don't re-raise
353+
return False # ensure SDK gets the exception
353354

354355
# Handle other deletion errors
355356
_handle_generic_deletion_error(error_str, message_callback)

src/sagemaker/hyperpod/cluster_management/hp_cluster_stack.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -624,11 +624,12 @@ def sdk_confirm_callback(message: str) -> bool:
624624
except Exception as e:
625625
error_str = str(e)
626626

627-
# Handle CloudFormation retain-resources limitation gracefully for SDK
627+
# Handle CloudFormation retain-resources limitation with clear exception for SDK
628628
if retain_resources and "specify which resources to retain only when the stack is in the DELETE_FAILED state" in error_str:
629629
error_msg = (
630630
f"CloudFormation limitation: retain_resources can only be used on stacks in DELETE_FAILED state. "
631-
f"Try deleting without retain_resources first, then retry with retain_resources if deletion fails."
631+
f"Current stack state allows normal deletion. Try deleting without retain_resources first, "
632+
f"then retry with retain_resources if deletion fails."
632633
)
633634
logger.error(error_msg)
634635
raise ValueError(error_msg)

0 commit comments

Comments
 (0)