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/13 02:49:24 UTC

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

[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/dacc69a5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-airflow/tree/dacc69a5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-airflow/diff/dacc69a5

Branch: refs/heads/v1-8-test
Commit: dacc69a504cbfcdba5e2b24220fa1982637b17d3
Parents: dcc8ede
Author: Alex Guziel <al...@airbnb.com>
Authored: Sat Mar 11 10:43:49 2017 -0800
Committer: Bolke de Bruin <bo...@Bolkes-MacBook-Pro.local>
Committed: Sun Mar 12 08:34:09 2017 -0700

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


http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/dacc69a5/airflow/jobs.py
----------------------------------------------------------------------
diff --git a/airflow/jobs.py b/airflow/jobs.py
index b6913f3..36548c2 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()