o-nikolas commented on code in PR #60978:
URL: https://github.com/apache/airflow/pull/60978#discussion_r2733232293
##########
providers/amazon/src/airflow/providers/amazon/aws/operators/ssm.py:
##########
@@ -106,6 +106,20 @@ def __init__(
def execute_complete(self, context: Context, event: dict[str, Any] | None
= None) -> str:
event = validate_execute_complete_event(event)
+ if event["status"] == "failed":
+ # Command failed - raise an exception with detailed information
+ command_status = event.get("command_status", "Unknown")
+ exit_code = event.get("exit_code", -1)
+ instance_id = event.get("instance_id", "Unknown")
+ message = event.get("message", "Command failed")
+
+ error_msg = (
+ f"SSM run command {event['command_id']} failed on instance
{instance_id}. "
+ f"Status: {command_status}, Exit code: {exit_code}. {message}"
+ )
+ self.log.error(error_msg)
+ raise RuntimeError(error_msg)
Review Comment:
Why double log the message? For example the below just includes it in the
exception message in the RuntimeError
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]