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/08/01 19:40:11 UTC

[GitHub] [airflow] houqp opened a new pull request #10096: prevent DAG callback exception from crashing scheduler

houqp opened a new pull request #10096:
URL: https://github.com/apache/airflow/pull/10096


   Also add type annotation so we can catch signal type exceptions at build time.
   
   <!--
   Thank you for contributing! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   In case of existing issue, reference it using one of the following:
   
   closes: #ISSUE
   related: #ISSUE
   
   How to write a good git commit message:
   http://chris.beams.io/posts/git-commit/
   -->
   
   ---
   **^ Add meaningful description above**
   
   Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#pull-request-guidelines)** for more information.
   In case of fundamental code change, Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvements+Proposals)) is needed.
   In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
   In case of backwards incompatible changes please leave a note in [UPDATING.md](https://github.com/apache/airflow/blob/master/UPDATING.md).
   


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



[GitHub] [airflow] potiuk merged pull request #10096: prevent DAG callback exception from crashing scheduler

Posted by GitBox <gi...@apache.org>.
potiuk merged pull request #10096:
URL: https://github.com/apache/airflow/pull/10096


   


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



[GitHub] [airflow] mik-laj commented on a change in pull request #10096: prevent DAG callback exception from crashing scheduler

Posted by GitBox <gi...@apache.org>.
mik-laj commented on a change in pull request #10096:
URL: https://github.com/apache/airflow/pull/10096#discussion_r465932695



##########
File path: airflow/models/dag.py
##########
@@ -686,7 +689,11 @@ def handle_callback(self, dagrun, success=True, reason=None, session=None):
             ti.task = self.get_task(ti.task_id)
             context = ti.get_template_context(session=session)
             context.update({'reason': reason})
-            callback(context)
+            try:
+                callback(context)
+            except Exception:
+                self.log.exception("failed to invoke dag state update callback")
+                Stats.incr("dag.callback_exceptions")

Review comment:
       Can you add this key to docs? 
   https://airflow.readthedocs.io/en/latest/metrics.html




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



[GitHub] [airflow] houqp commented on pull request #10096: prevent DAG callback exception from crashing scheduler

Posted by GitBox <gi...@apache.org>.
houqp commented on pull request #10096:
URL: https://github.com/apache/airflow/pull/10096#issuecomment-667827846


   Added entry in UPDATING.md as well as added a counter metric to help better monitor this issue.


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



[GitHub] [airflow] houqp commented on a change in pull request #10096: prevent DAG callback exception from crashing scheduler

Posted by GitBox <gi...@apache.org>.
houqp commented on a change in pull request #10096:
URL: https://github.com/apache/airflow/pull/10096#discussion_r466081801



##########
File path: airflow/models/dag.py
##########
@@ -686,7 +689,11 @@ def handle_callback(self, dagrun, success=True, reason=None, session=None):
             ti.task = self.get_task(ti.task_id)
             context = ti.get_template_context(session=session)
             context.update({'reason': reason})
-            callback(context)
+            try:
+                callback(context)
+            except Exception:
+                self.log.exception("failed to invoke dag state update callback")
+                Stats.incr("dag.callback_exceptions")

Review comment:
       good call, i always forgot about that doc page :)




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



[GitHub] [airflow] houqp commented on pull request #10096: prevent DAG callback exception from crashing scheduler

Posted by GitBox <gi...@apache.org>.
houqp commented on pull request #10096:
URL: https://github.com/apache/airflow/pull/10096#issuecomment-668394082


   @turbaszek @potiuk fixed all test errors, ready for another round of review.


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