Skip to content

Commit

Permalink
[TWTR][EWT-472] Add lifecycle support while launching worker pods (ap…
Browse files Browse the repository at this point in the history
  • Loading branch information
msumit committed Sep 21, 2020
1 parent 0cd5928 commit bac4acd
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -262,3 +262,8 @@ def _apply_env_from(pod, req):
def extract_priority_class(pod, req):
if pod.priority_class:
req['spec']['priorityClassName'] = pod.priority_class

@staticmethod
def extract_lifecycle(pod, req):
if pod.lifecycle:
req['spec']['containers'][0]['lifecycle'] = pod.lifecycle
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ def create(self, pod):
self.extract_security_context(pod, req)
self.extract_dnspolicy(pod, req)
self.extract_priority_class(pod, req)
self.extract_lifecycle(pod, req)
return req


Expand Down Expand Up @@ -137,4 +138,5 @@ def create(self, pod):
self.extract_security_context(pod, req)
self.extract_dnspolicy(pod, req)
self.extract_priority_class(pod, req)
self.extract_lifecycle(pod, req)
return req
4 changes: 3 additions & 1 deletion airflow/contrib/kubernetes/pod.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ def __init__(
configmaps=None,
pod_runtime_info_envs=None,
dnspolicy=None,
priority_class=None
priority_class=None,
lifecycle=None
):
self.image = image
self.envs = envs or {}
Expand Down Expand Up @@ -143,3 +144,4 @@ def __init__(
self.pod_runtime_info_envs = pod_runtime_info_envs or []
self.dnspolicy = dnspolicy
self.priority_class = priority_class
self.lifecycle = lifecycle or {}
2 changes: 1 addition & 1 deletion airflow/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@
# under the License.
#

version = '1.10.4+twtr18'
version = '1.10.4+twtr19'

0 comments on commit bac4acd

Please sign in to comment.