You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "ephraimbuddy (via GitHub)" <gi...@apache.org> on 2023/02/24 15:33:04 UTC

[GitHub] [airflow] ephraimbuddy opened a new pull request, #29743: Fix on_failure_callback when task receives a SIGTERM

ephraimbuddy opened a new pull request, #29743:
URL: https://github.com/apache/airflow/pull/29743

   This fixes on_failure_callback when task receives a SIGTERM by raising a different exception in the handler and catching the exception during task execution so we can directly run the failure callback
   
   closes: https://github.com/apache/airflow/issues/25297


-- 
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: commits-unsubscribe@airflow.apache.org

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


[GitHub] [airflow] jedcunningham merged pull request #29743: Fix on_failure_callback when task receives a SIGTERM

Posted by "jedcunningham (via GitHub)" <gi...@apache.org>.
jedcunningham merged PR #29743:
URL: https://github.com/apache/airflow/pull/29743


-- 
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: commits-unsubscribe@airflow.apache.org

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


[GitHub] [airflow] jedcunningham commented on a diff in pull request #29743: Fix on_failure_callback when task receives a SIGTERM

Posted by "jedcunningham (via GitHub)" <gi...@apache.org>.
jedcunningham commented on code in PR #29743:
URL: https://github.com/apache/airflow/pull/29743#discussion_r1117214964


##########
airflow/exceptions.py:
##########
@@ -29,6 +29,12 @@
     from airflow.models import DagRun
 
 
+class AirflowKillSignal(Exception):
+    """Raise when there's kill signal"""

Review Comment:
   ```suggestion
   class AirflowTermSignal(Exception):
       """Raise when we receive a TERM signal"""
   ```
   
   We should consider using something other than "kill" here, as a true SIGKILL won't hit this.



-- 
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: commits-unsubscribe@airflow.apache.org

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


[GitHub] [airflow] jedcunningham commented on a diff in pull request #29743: Fix on_failure_callback when task receives a SIGTERM

Posted by "jedcunningham (via GitHub)" <gi...@apache.org>.
jedcunningham commented on code in PR #29743:
URL: https://github.com/apache/airflow/pull/29743#discussion_r1117378098


##########
airflow/models/taskinstance.py:
##########
@@ -73,10 +73,12 @@
 from airflow.exceptions import (
     AirflowException,
     AirflowFailException,
+    AirflowKillSignal,

Review Comment:
   ```suggestion
   ```



##########
airflow/models/taskinstance.py:
##########
@@ -1567,10 +1568,15 @@ def signal_handler(signum, frame):
 
             # Execute the task
             with set_current_context(context):
-                result = self._execute_task(context, task_orig)
-
-            # Run post_execute callback
-            self.task.post_execute(context=context, result=result)
+                try:
+                    result = self._execute_task(context, task_orig)
+                    # Run post_execute callback
+                    self.task.post_execute(context=context, result=result)
+                except AirflowKillSignal:

Review Comment:
   ```suggestion
                   except AirflowTermSignal:
   ```



-- 
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: commits-unsubscribe@airflow.apache.org

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


[GitHub] [airflow] ephraimbuddy commented on a diff in pull request #29743: Fix on_failure_callback when task receives a SIGTERM

Posted by "ephraimbuddy (via GitHub)" <gi...@apache.org>.
ephraimbuddy commented on code in PR #29743:
URL: https://github.com/apache/airflow/pull/29743#discussion_r1117396099


##########
airflow/models/taskinstance.py:
##########
@@ -73,10 +73,12 @@
 from airflow.exceptions import (
     AirflowException,
     AirflowFailException,
+    AirflowKillSignal,

Review Comment:
   Thanks, my docker crashed, couldn't run pre-commit



-- 
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: commits-unsubscribe@airflow.apache.org

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