Repository navigation
Preserve SageMaker job lifecycle states in trigger events - #71653
Conversation
bcde123 to
da87d3f
Compare
da87d3f to
9e0ba2d
Compare
|
Requesting review for this. |
o-nikolas
left a comment
There was a problem hiding this comment.
I think we really need to be careful when moving away from very well tested and delicate code that all Triggers share (async_wait) in this case and trying to re-implement it. I know you have good intentions and are trying to provide more information after the Trigger returns, but you're opening yourself up to a lot of new code to maintain (and almost duplicate) as well as all the bugs and edge cases that come along with that.
After reading your comment, I have realized the core issue is not with the SageMakerTrigger but AwsBaseWaiterTrigger flattening the waiter outcome into success / error, so What are your thoughts on adding a overridable translation method i.e. |
Yupp, I think this is the right approach, a generalized one. CC @ramitkataria @vincbeck |
9e0ba2d to
071c4ec
Compare
I opened PR #72455 to add the overridable translation method i.e. _event_from_exception to |
ramitkataria
left a comment
There was a problem hiding this comment.
Added a minor nit inline but otherwise looks good
…structured AWS waiter outcomes into failed, stopped, and timed-out SageMaker trigger events while retaining the shared waiter lifecycle handling. Add unit tests for the SageMaker-specific event translation.
071c4ec to
2a47ed5
Compare
Description
This change updates
SageMakerTriggerto preserve SageMaker job lifecycle outcomes as explicit trigger event statuses.The trigger now translates structured AWS waiter outcomes into
failed,stopped, andtimeoutevents, while successful jobs continue to emitsuccess. Polling, retries, timeout detection, and AWS error handling remain managed by the sharedAwsBaseWaiterTriggerimplementation.This is a follow-up to PR #69042 and the shared AWS waiter changes that allow individual triggers to translate waiter outcomes without reimplementing the polling lifecycle.
Rationale
SageMakerTriggerpreviously represented unsuccessful waiter outcomes using the genericerrorstatus, preventing consumers from distinguishing between a failed SageMaker job, an explicitly stopped job, and waiter exhaustion.Using the exception-to-event translation provided by
AwsBaseWaiterTriggerallowsSageMakerTriggerto preserve these lifecycle states while continuing to rely on the shared AWS waiter implementation.Tests
Added unit tests verifying that:
failedandstoppedevents.timeoutevent.errorevent.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 use more specific statuses instead of the genericerrorstatus. Existing SageMaker operators already treat any status other thansuccessas a task failure, so their task-level behavior remains unchanged.Was generative AI tooling used to co-author this PR?
Generated-by: [GPT 5.6] following the guidelines