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 2021/06/10 13:19:28 UTC

[GitHub] [airflow] ashb commented on a change in pull request #16301: Fix task retries when they receive sigkill and have retries. Properly handle sigterm too

ashb commented on a change in pull request #16301:
URL: https://github.com/apache/airflow/pull/16301#discussion_r649174921



##########
File path: airflow/jobs/local_task_job.py
##########
@@ -73,15 +73,9 @@ def _execute(self):
         # pylint: disable=unused-argument
         def signal_handler(signum, frame):
             """Setting kill signal handler"""
-            self.log.error("Received SIGTERM. Terminating subprocesses")
-            self.on_kill()
-            self.task_instance.refresh_from_db()
-            if self.task_instance.state not in State.finished:
-                self.task_instance.set_state(State.FAILED)
-            self.task_instance._run_finished_callback(  # pylint: disable=protected-access
-                error="task received sigterm"
-            )
-            raise AirflowException("LocalTaskJob received SIGTERM signal")
+            self.log.error("LocalTaskJob received SIGTERM signal")
+            # Call the handle_task_exit method with SIGTERM exit code 143:
+            self.handle_task_exit(143)

Review comment:
       ```suggestion
               self.handle_task_exit(128 + signum)
   ```
   
   would be better I think (this is the default behaviour




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