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/13 18:47:32 UTC

incubator-airflow git commit: [AIRFLOW-2396] Add support for resources in kubernetes operator

Repository: incubator-airflow
Updated Branches:
  refs/heads/master 5f7bb61f1 -> 3ac97fd80


[AIRFLOW-2396] Add support for resources in kubernetes operator

[AIRFLOW-2396] Add support for resources in
kubernetes operator

[AIRFLOW-2396] Add support for resources in
kubernetes operator

Closes #3352 from ese/resources


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

Branch: refs/heads/master
Commit: 3ac97fd8016f974b3301655371946cc60bb17e6a
Parents: 5f7bb61
Author: Sergio Ballesteros <sn...@locolandia.net>
Authored: Sun May 13 20:47:25 2018 +0200
Committer: Fokko Driesprong <fo...@godatadriven.com>
Committed: Sun May 13 20:47:25 2018 +0200

----------------------------------------------------------------------
 airflow/contrib/operators/kubernetes_pod_operator.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/3ac97fd8/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 d68496a..0f9c943 100644
--- a/airflow/contrib/operators/kubernetes_pod_operator.py
+++ b/airflow/contrib/operators/kubernetes_pod_operator.py
@@ -19,13 +19,13 @@ from airflow.exceptions import AirflowException
 from airflow.models import BaseOperator
 from airflow.utils.decorators import apply_defaults
 from airflow.contrib.kubernetes import kube_client, pod_generator, pod_launcher
+from airflow.contrib.kubernetes.pod import Resources
 from airflow.utils.state import State
 
 template_fields = ('templates_dict',)
 template_ext = tuple()
 ui_color = '#ffefeb'
 
-
 class KubernetesPodOperator(BaseOperator):
     """
     Execute a task in a Kubernetes Pod
@@ -77,6 +77,8 @@ class KubernetesPodOperator(BaseOperator):
             pod.secrets = self.secrets
             pod.envs = self.env_vars
             pod.image_pull_policy = self.image_pull_policy
+            pod.annotations = self.annotations
+            pod.resources = self.resources
 
             launcher = pod_launcher.PodLauncher(client)
             final_state = launcher.run_pod(
@@ -104,6 +106,8 @@ class KubernetesPodOperator(BaseOperator):
                  startup_timeout_seconds=120,
                  get_logs=True,
                  image_pull_policy='IfNotPresent',
+                 annotations=None,
+                 resources=None,
                  *args,
                  **kwargs):
         super(KubernetesPodOperator, self).__init__(*args, **kwargs)
@@ -119,3 +123,5 @@ class KubernetesPodOperator(BaseOperator):
         self.in_cluster = in_cluster
         self.get_logs = get_logs
         self.image_pull_policy = image_pull_policy
+        self.annotations = annotations or {}
+        self.resources = resources or Resources()