mrk-andreev commented on code in PR #43853:
URL: https://github.com/apache/airflow/pull/43853#discussion_r1835814658
##########
providers/src/airflow/providers/cncf/kubernetes/utils/pod_manager.py:
##########
@@ -118,7 +119,13 @@ def get_xcom_sidecar_container_resources(self) -> str |
None:
def get_container_status(pod: V1Pod, container_name: str) -> V1ContainerStatus
| None:
"""Retrieve container status."""
- container_statuses = pod.status.container_statuses if pod and pod.status
else None
+ if pod and pod.status:
+ container_statuses = itertools.chain(
+ pod.status.container_statuses, pod.status.init_container_statuses
+ )
+ else:
+ container_statuses = None
+
Review Comment:
Wthout this changes `get_container_status` for any initContainer will return
False because
```
return next((x for x in container_statuses if x.name == container_name),
None)
```
that affects `logs_available()` inside `PodLogsConsumer` that will ignore
logs because `state is None` in
```
def logs_available(self):
remote_pod = self.read_pod()
if container_is_running(pod=remote_pod,
container_name=self.container_name):
return True
container_status = get_container_status(pod=remote_pod,
container_name=self.container_name)
state = container_status.state if container_status else None
terminated = state.terminated if state else None
if terminated:
termination_time = terminated.finished_at
if termination_time:
return termination_time +
timedelta(seconds=self.post_termination_timeout) > utcnow()
return False
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]