kaxil commented on a change in pull request #16301:
URL: https://github.com/apache/airflow/pull/16301#discussion_r657084261
##########
File path: airflow/jobs/local_task_job.py
##########
@@ -78,16 +79,11 @@ def _execute(self):
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")
+ os.kill(self.task_instance.pid, signum)
Review comment:
But if `self.on_kill()`
is not called we would be missing some cleanup steps, no?
https://github.com/apache/airflow/blob/8217db8cb4b1ff302c5cf8662477ac00f701e78c/airflow/jobs/local_task_job.py#L172-L174
##########
File path: airflow/jobs/local_task_job.py
##########
@@ -78,16 +79,11 @@ def _execute(self):
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")
+ os.kill(self.task_instance.pid, signum)
Review comment:
But if `self.on_kill()`
is not called we would be missing some cleanup steps for Task Runners, no?
https://github.com/apache/airflow/blob/8217db8cb4b1ff302c5cf8662477ac00f701e78c/airflow/jobs/local_task_job.py#L172-L174
--
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:
[email protected]