You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by di...@apache.org on 2020/06/25 21:44:57 UTC
[airflow] branch v1-10-test updated: [AIRFLOW-5349] Add
schedulername option for KubernetesPodOperator (#6088)
This is an automated email from the ASF dual-hosted git repository.
dimberman pushed a commit to branch v1-10-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/v1-10-test by this push:
new 7863329 [AIRFLOW-5349] Add schedulername option for KubernetesPodOperator (#6088)
7863329 is described below
commit 78633295c91b97c8c7758c092c1b1cdb62b4973b
Author: antonymayi <an...@users.noreply.github.com>
AuthorDate: Tue Dec 17 20:57:08 2019 +0100
[AIRFLOW-5349] Add schedulername option for KubernetesPodOperator (#6088)
(cherry picked from commit 0d94c8e841cccb63e15a8cc6b5549a744cfe1428)
---
airflow/contrib/operators/kubernetes_pod_operator.py | 3 +++
airflow/kubernetes/pod_generator.py | 5 +++++
2 files changed, 8 insertions(+)
diff --git a/airflow/contrib/operators/kubernetes_pod_operator.py b/airflow/contrib/operators/kubernetes_pod_operator.py
index d439eda..ce8f19c 100644
--- a/airflow/contrib/operators/kubernetes_pod_operator.py
+++ b/airflow/contrib/operators/kubernetes_pod_operator.py
@@ -126,6 +126,8 @@ class KubernetesPodOperator(BaseOperator): # pylint: disable=too-many-instance-
:type security_context: dict
:param dnspolicy: dnspolicy for the pod.
:type dnspolicy: str
+ :param schedulername: Specify a schedulername for the pod
+ :type schedulername: str
:param full_pod_spec: The complete podSpec
:type full_pod_spec: kubernetes.client.models.V1Pod
"""
@@ -345,6 +347,7 @@ class KubernetesPodOperator(BaseOperator): # pylint: disable=too-many-instance-
dnspolicy=self.dnspolicy,
init_containers=self.init_containers,
restart_policy='Never',
+ schedulername=self.schedulername,
priority_class_name=self.priority_class_name,
pod=self.full_pod_spec,
).gen_pod()
diff --git a/airflow/kubernetes/pod_generator.py b/airflow/kubernetes/pod_generator.py
index dd0da30..6956fc3 100644
--- a/airflow/kubernetes/pod_generator.py
+++ b/airflow/kubernetes/pod_generator.py
@@ -146,6 +146,8 @@ class PodGenerator:
:type configmaps: str
:param dnspolicy: Specify a dnspolicy for the pod
:type dnspolicy: str
+ :param schedulername: Specify a schedulername for the pod
+ :type schedulername: str
:param pod: The fully specified pod.
:type pod: kubernetes.client.models.V1Pod
:param extract_xcom: Whether to bring up a container for xcom
@@ -178,6 +180,7 @@ class PodGenerator:
security_context=None,
configmaps=None,
dnspolicy=None,
+ schedulername=None,
priority_class_name=None,
pod=None,
extract_xcom=False,
@@ -230,6 +233,7 @@ class PodGenerator:
self.spec.security_context = security_context
self.spec.tolerations = tolerations
self.spec.dns_policy = dnspolicy
+ self.spec.scheduler_name = schedulername
self.spec.host_network = hostnetwork
self.spec.affinity = affinity
self.spec.service_account_name = service_account_name
@@ -367,6 +371,7 @@ class PodGenerator:
security_context=namespaced.get('security_context'),
configmaps=namespaced.get('configmaps'),
dnspolicy=namespaced.get('dnspolicy'),
+ schedulername=namespaced.get('schedulername'),
pod=namespaced.get('pod'),
extract_xcom=namespaced.get('extract_xcom'),
)