karenbraganz commented on code in PR #53435:
URL: https://github.com/apache/airflow/pull/53435#discussion_r2223745929


##########
airflow-core/src/airflow/jobs/scheduler_job_runner.py:
##########
@@ -2016,7 +2017,7 @@ def _maybe_requeue_stuck_ti(self, *, ti, session):
                     extra=f"Task was requeued more than 
{self._num_stuck_queued_retries} times and will be failed.",
                 )
             )
-            ti.set_state(TaskInstanceState.FAILED, session=session)
+            executor.fail(ti.key)

Review Comment:
   @amoghrajesh @o-nikolas If I add `ti.set_state(TaskInstanceState.FAILED, 
session=session)`, the failure callback does not get executed. For the callback 
to run, I believe [this section of 
code](https://github.com/apache/airflow/blob/3dc4cd2e01209efbb555b35debeb115367cbeb6d/airflow-core/src/airflow/jobs/scheduler_job_runner.py#L926C21-L940C52)
 needs to be executed, and for that section to be executed, there needs to be a 
mismatch between the TI state and executor state.
   
   Maybe I could directly run that section of code when failing the TI and see 
if it works.



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