Asquator commented on code in PR #61274:
URL: https://github.com/apache/airflow/pull/61274#discussion_r2807816813


##########
airflow-core/src/airflow/models/dagrun.py:
##########
@@ -1212,22 +1212,29 @@ def recalculate(self) -> _UnfinishedStates:
             self.set_state(DagRunState.FAILED)
             self.notify_dagrun_state_changed(msg="task_failure")
 
-            if execute_callbacks and dag.has_on_failure_callback:
-                self.handle_dag_callback(dag=cast("SDKDAG", dag), 
success=False, reason="task_failure")
-            elif dag.has_on_failure_callback:
-                callback = DagCallbackRequest(
-                    filepath=self.dag_model.relative_fileloc,
-                    dag_id=self.dag_id,
-                    run_id=self.run_id,
-                    bundle_name=self.dag_model.bundle_name,
-                    bundle_version=self.bundle_version,
-                    context_from_server=DagRunContext(
-                        dag_run=self,
-                        last_ti=self.get_last_ti(dag=dag, session=session),
-                    ),
-                    is_failure_callback=True,
-                    msg="task_failure",
-                )
+            if dag.has_on_failure_callback:
+                ti_causing_failure = 
self.get_first_ti_causing_failure(dag=dag, session=session)
+                if execute_callbacks:

Review Comment:
   It's what was being done before the change. After the change I included 
another statement that is needed in both cases, whether `execute_callbacks` is 
true or not. Look at it another time, maybe it will be clearer now?
   
   Or can you suggest a change so I understand what you mean?



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