You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/05/26 05:33:11 UTC
[GitHub] [airflow] dstandish commented on a diff in pull request #23450: Add await all containers option to Kubernetes Pod Operator
dstandish commented on code in PR #23450:
URL: https://github.com/apache/airflow/pull/23450#discussion_r882329273
##########
airflow/providers/cncf/kubernetes/utils/pod_manager.py:
##########
@@ -259,16 +259,16 @@ def await_container_completion(self, pod: V1Pod, container_name: str) -> None:
while not self.container_is_running(pod=pod, container_name=container_name):
time.sleep(1)
- def await_pod_completion(self, pod: V1Pod) -> V1Pod:
+ def await_pod_completion(self, pod: V1Pod, base_container: str) -> V1Pod:
Review Comment:
if i were gonna add this param, i would not call it 'base_container'. this method doesn't know that the caller is providing the "base" container, so better to just be generic with `container_name` or something. BUT i am not sure we should change this method anyway, since the purpose is to wait for pod termination.
##########
airflow/providers/cncf/kubernetes/utils/pod_manager.py:
##########
@@ -259,16 +259,16 @@ def await_container_completion(self, pod: V1Pod, container_name: str) -> None:
while not self.container_is_running(pod=pod, container_name=container_name):
time.sleep(1)
- def await_pod_completion(self, pod: V1Pod) -> V1Pod:
+ def await_pod_completion(self, pod: V1Pod, base_container: str) -> V1Pod:
"""
- Monitors a pod and returns the final state
+ Monitors the base container in a pod and returns the final state
:param pod: pod spec that will be monitored
:return: Tuple[State, Optional[str]]
"""
while True:
remote_pod = self.read_pod(pod)
- if remote_pod.status.phase in PodPhase.terminal_states:
+ if not self.container_is_running(pod=remote_pod, container_name=base_container):
Review Comment:
this changes the meaning of this method from "await pod completion" to "await container completion"
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org