You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/10/26 02:38:32 UTC

[GitHub] [airflow] houqp commented on a change in pull request #10917: Fix race conditions in task callback invocations

houqp commented on a change in pull request #10917:
URL: https://github.com/apache/airflow/pull/10917#discussion_r511692979



##########
File path: airflow/jobs/local_task_job.py
##########
@@ -170,11 +174,6 @@ def heartbeat_callback(self, session=None):
                 "Terminating instance.",
                 ti.state
             )
-            if ti.state == State.FAILED and ti.task.on_failure_callback:
-                context = ti.get_template_context()
-                ti.task.on_failure_callback(context)
-            if ti.state == State.SUCCESS and ti.task.on_success_callback:
-                context = ti.get_template_context()
-                ti.task.on_success_callback(context)
             self.task_runner.terminate()
+            ti.run_finished_callback()

Review comment:
       changed the semantic to kill the task first before running callback, it would be odd to execute success callback while task is still running.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org