You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by bo...@apache.org on 2017/03/11 18:43:58 UTC

incubator-airflow git commit: [AIRFLOW-961] run onkill when SIGTERMed

Repository: incubator-airflow
Updated Branches:
  refs/heads/master d79ed7478 -> 9ad144657


[AIRFLOW-961] run onkill when SIGTERMed

Closes #2138 from saguziel/aguziel-sigterm


Project: http://git-wip-us.apache.org/repos/asf/incubator-airflow/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-airflow/commit/9ad14465
Tree: http://git-wip-us.apache.org/repos/asf/incubator-airflow/tree/9ad14465
Diff: http://git-wip-us.apache.org/repos/asf/incubator-airflow/diff/9ad14465

Branch: refs/heads/master
Commit: 9ad144657b00d1cf98be04922dc6bbb30b624090
Parents: d79ed74
Author: Alex Guziel <al...@airbnb.com>
Authored: Sat Mar 11 10:43:49 2017 -0800
Committer: Bolke de Bruin <bo...@xs4all.nl>
Committed: Sat Mar 11 10:43:49 2017 -0800

----------------------------------------------------------------------
 airflow/jobs.py | 8 ++++++++
 1 file changed, 8 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/9ad14465/airflow/jobs.py
----------------------------------------------------------------------
diff --git a/airflow/jobs.py b/airflow/jobs.py
index d99b697..f05104a 100644
--- a/airflow/jobs.py
+++ b/airflow/jobs.py
@@ -2060,6 +2060,14 @@ class LocalTaskJob(BaseJob):
 
     def _execute(self):
         self.task_runner = get_task_runner(self)
+
+        def signal_handler(signum, frame):
+            '''Setting kill signal handler'''
+            logging.error("Killing subprocess")
+            self.on_kill()
+            raise AirflowException("LocalTaskJob received SIGTERM signal")
+        signal.signal(signal.SIGTERM, signal_handler)
+
         try:
             self.task_runner.start()