uranusjr commented on code in PR #31663:
URL: https://github.com/apache/airflow/pull/31663#discussion_r1243154847
##########
airflow/providers/cncf/kubernetes/utils/pod_manager.py:
##########
@@ -498,6 +581,17 @@ def read_pod_logs(
post_termination_timeout=post_termination_timeout,
)
+ @tenacity.retry(stop=tenacity.stop_after_attempt(3),
wait=tenacity.wait_exponential(), reraise=True)
+ def get_container_names(self, pod: V1Pod) -> list[str]:
+ """Return container names from the POD except for the
airflow-xcom-sidecar container."""
+ containers = []
+ pod_info = self.read_pod(pod)
+ for container_spec in pod_info.spec.containers:
+ if container_spec.name != ContainerNames.XCOM_CONTAINER:
+ containers.append(container_spec.name)
+
+ return containers
Review Comment:
This seems to be a simpler equivalent
```suggestion
pod_info = self.read_pod(pod)
return [
container_spec.name
for container_spec in pod_info.spec.containers
if container_spec.name != ContainerNames.XCOM_CONTAINER
]
```
--
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]