avanish-garg opened a new issue, #72426:
URL: https://github.com/apache/airflow/issues/72426

   ### Description
   
   `on_task_instance_failed` fires identically whether a task instance is about 
to be automatically
   retried (state set to `UP_FOR_RETRY`) or has permanently failed (state set 
to `FAILED`). The hook
   call in `models/taskinstance.py` sits after the retry-eligibility branch and 
fires unconditionally
   either way, using the same hook name.
   
   ### Use case/motivation
   
   This makes the listener API noisy for a common use case: an alerting/paging 
integration built on
   `on_task_instance_failed` gets triggered on every transient retry of a flaky 
task, not just the
   final terminal failure, which undermines the signal-to-noise of building 
alerting on this hook.
   
   Airflow's listener spec already carves out sub-outcomes this way elsewhere —
   `on_task_instance_skipped` exists specifically to distinguish "skipped" from 
the generic
   success/failure buckets. Same pattern fits here: a new 
`on_task_instance_up_for_retry` hookspec,
   fired when a task instance is set to `UP_FOR_RETRY`, additive alongside the 
existing
   `on_task_instance_failed` (left unchanged, to avoid a breaking change for 
existing listeners).
   
   ### Related issues
   
   Was previously opened as #72379 (closed to re-open via this form so template 
labels apply
   correctly).
   
   ### Are you willing to submit a PR?
   
   - [x] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
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]

Reply via email to