Skip to content

Commit

Permalink
Refactor error handling in SagemakerOrchestrator
Browse files Browse the repository at this point in the history
  • Loading branch information
htahir1 committed Dec 20, 2024
1 parent ab0c06d commit 3c12d45
Showing 1 changed file with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,6 @@ def prepare_or_run_pipeline(
`boto3.Session` object.
TypeError: If the network_config passed is not compatible with the
AWS SageMaker NetworkConfig class.
KeyError: If required fields are missing from schedule_info.
ClientError: If there's an AWS API error.
BotoCoreError: If there's an error in the AWS SDK.
Yields:
A dictionary of metadata related to the pipeline run.
Expand Down Expand Up @@ -567,16 +564,17 @@ def prepare_or_run_pipeline(
logger.info(f"Created/Updated IAM policy: {policy_name}")

except (ClientError, BotoCoreError) as e:
logger.error(
logger.warning(
f"Failed to update IAM policy: {e}. "
f"Please ensure you have sufficient IAM permissions."
f"Please ensure your execution role has sufficient permissions "
f"to start pipeline executions."
)
raise
except KeyError as e:
logger.error(
f"Missing required field for IAM policy creation: {e}"
logger.warning(
f"Missing required field for IAM policy creation: {e}. "
f"Please ensure your execution role has sufficient permissions "
f"to start pipeline executions."
)
raise

# Create the EventBridge rule
events_client = session.boto_session.client("events")
Expand Down

0 comments on commit 3c12d45

Please sign in to comment.