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/11/04 12:01:58 UTC

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

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



##########
File path: airflow/models/taskinstance.py
##########
@@ -1446,18 +1454,21 @@ def handle_failure(self, error, test_mode=None, context=None, force_fail=False,
                 self.log.error('Failed to send email to: %s', task.email)
                 self.log.exception(exec2)
 
-        # Handling callbacks pessimistically
-        if callback:
-            try:
-                callback(context)
-            except Exception as exec3:  # pylint: disable=broad-except
-                self.log.error("Failed at executing callback")
-                self.log.exception(exec3)
-
         if not test_mode:
             session.merge(self)
         session.commit()
 
+    @provide_session
+    def handle_failure_with_callback(
+        self,
+        error,
+        test_mode=None,
+        force_fail: bool = False,
+        session=None,

Review comment:
       Should we add type hints?




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