SameerMesiah97 opened a new pull request, #71653: URL: https://github.com/apache/airflow/pull/71653
**Description** This change expands `SageMakerTrigger` to expose SageMaker job lifecycle outcomes as explicit trigger event statuses. The trigger now distinguishes between successful, failed, stopped, and timed-out jobs, while continuing to poll non-terminal states using the configured waiter delay and maximum attempts. This is a follow-up to PR #69042, which highlighted the limitations of representing SageMaker job outcomes through the generic `AwsBaseWaiterTrigger` state model. **Rationale** `SageMakerTrigger` currently inherits the generic `AwsBaseWaiterTrigger.run()` implementation, which represents all unsuccessful waiter outcomes using the same `error` status. Although details of the underlying failure may be available in the event message, consumers cannot distinguish between a SageMaker job failure, an explicitly stopped job, and waiter exhaustion from the structured event without interpreting a human-readable error message. Representing these outcomes explicitly provides a machine-readable state while retaining diagnostic information, and keeps SageMaker-specific lifecycle semantics within `SageMakerTrigger` rather than extending the generic AWS waiter abstraction. **Tests** Added unit tests verifying that: * Completed, failed, and stopped SageMaker training jobs emit `success`, `failed`, and `stopped` events respectively. * Non-terminal SageMaker jobs continue polling until a terminal state is reached. * Exhausting the configured waiter attempts while a job remains non-terminal emits a `timeout` event. The stopped-job path was also manually validated against a real SageMaker training job by stopping the underlying job while the Airflow task was deferred. **Backwards Compatibility** This change does not modify the public API or constructor of `SageMakerTrigger`. Successful jobs continue to emit `success`. Non-successful outcomes now use more specific statuses instead of the generic `error` status. Existing SageMaker operators already treat any status other than `success` as a task failure, so their task-level behavior remains unchanged. ###### Was generative AI tooling used to co-author this PR? - [X] Yes (please specify the tool below) Generated-by: [GPT 5.5] following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions) -- 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]
