SamWheating commented on a change in pull request #17347:
URL: https://github.com/apache/airflow/pull/17347#discussion_r680267508
##########
File path: airflow/models/taskinstance.py
##########
@@ -1343,18 +1343,27 @@ def _run_finished_callback(self, error:
Optional[Union[str, Exception]] = None)
if task.on_failure_callback is not None:
context = self.get_template_context()
context["exception"] = error
- task.on_failure_callback(context)
+ try:
+ task.on_failure_callback(context)
+ except Exception:
+ log.exception("Failed when executing execute
on_failure_callback:")
elif self.state == State.SUCCESS:
task = self.task
if task.on_success_callback is not None:
context = self.get_template_context()
- task.on_success_callback(context)
+ try:
+ task.on_success_callback(context)
+ except Exception:
Review comment:
Great suggestion - I've added a test and in doing so I even found a
minor bug which has been fixed now.
--
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]