You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by fo...@apache.org on 2018/05/06 09:22:07 UTC

incubator-airflow git commit: [AIRFLOW-2417] Wait for pod is not running to end task

Repository: incubator-airflow
Updated Branches:
  refs/heads/master c0cf73d27 -> b9d3ea05b


[AIRFLOW-2417] Wait for pod is not running to end task

Closes #3312 from ese/kubernetes-operator


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

Branch: refs/heads/master
Commit: b9d3ea05b6ae35fd486dccbace85c230e5789112
Parents: c0cf73d
Author: Sergio Ballesteros <sn...@locolandia.net>
Authored: Sun May 6 11:22:00 2018 +0200
Committer: Fokko Driesprong <fo...@godatadriven.com>
Committed: Sun May 6 11:22:00 2018 +0200

----------------------------------------------------------------------
 airflow/contrib/kubernetes/pod_launcher.py           | 7 +++----
 airflow/contrib/operators/kubernetes_pod_operator.py | 4 +++-
 2 files changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/b9d3ea05/airflow/contrib/kubernetes/pod_launcher.py
----------------------------------------------------------------------
diff --git a/airflow/contrib/kubernetes/pod_launcher.py b/airflow/contrib/kubernetes/pod_launcher.py
index 37f0a04..f1467a9 100644
--- a/airflow/contrib/kubernetes/pod_launcher.py
+++ b/airflow/contrib/kubernetes/pod_launcher.py
@@ -88,10 +88,9 @@ class PodLauncher(LoggingMixin):
                 _preload_content=False)
             for line in logs:
                 self.log.info(line)
-        else:
-            while self.pod_is_running(pod):
-                self.log.info('Pod %s has state %s', pod.name, State.RUNNING)
-                time.sleep(2)
+        while self.pod_is_running(pod):
+            self.log.info('Pod %s has state %s', pod.name, State.RUNNING)
+            time.sleep(2)
         return self._task_status(self.read_pod(pod))
 
     def _task_status(self, event):

http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/b9d3ea05/airflow/contrib/operators/kubernetes_pod_operator.py
----------------------------------------------------------------------
diff --git a/airflow/contrib/operators/kubernetes_pod_operator.py b/airflow/contrib/operators/kubernetes_pod_operator.py
index 32ad582..c628fec 100644
--- a/airflow/contrib/operators/kubernetes_pod_operator.py
+++ b/airflow/contrib/operators/kubernetes_pod_operator.py
@@ -82,7 +82,9 @@ class KubernetesPodOperator(BaseOperator):
                 startup_timeout=self.startup_timeout_seconds,
                 get_logs=self.get_logs)
             if final_state != State.SUCCESS:
-                raise AirflowException('Pod returned a failure')
+                raise AirflowException(
+                    'Pod returned a failure: {state}'.format(state=final_state)
+                )
         except AirflowException as ex:
             raise AirflowException('Pod Launching failed: {error}'.format(error=ex))