airflow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fo...@apache.org
Subject incubator-airflow git commit: [AIRFLOW-2417] Wait for pod is not running to end task
Date Sun, 06 May 2018 09:22:22 GMT
Repository: incubator-airflow
Updated Branches:
  refs/heads/v1-10-test 08ac473a4 -> b7806363e


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

Closes #3312 from ese/kubernetes-operator

(cherry picked from commit b9d3ea05b6ae35fd486dccbace85c230e5789112)
Signed-off-by: Fokko Driesprong <fokkodriesprong@godatadriven.com>


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

Branch: refs/heads/v1-10-test
Commit: b7806363e720c6a42d5ee6be5c1bb00714545081
Parents: 08ac473
Author: Sergio Ballesteros <snaker@locolandia.net>
Authored: Sun May 6 11:22:00 2018 +0200
Committer: Fokko Driesprong <fokkodriesprong@godatadriven.com>
Committed: Sun May 6 11:22:16 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/b7806363/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/b7806363/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))
 


Mime
View raw message