shahar1 commented on code in PR #59097:
URL: https://github.com/apache/airflow/pull/59097#discussion_r2683335208
##########
providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/operators/pod.py:
##########
@@ -1422,12 +1422,21 @@ def process_duplicate_label_pods(self, pod_list:
list[k8s.V1Pod]) -> k8s.V1Pod:
self.process_pod_deletion(old_pod)
return new_pod
- @staticmethod
- def _get_most_recent_pod_index(pod_list: list[k8s.V1Pod]) -> int:
+ def _get_most_recent_pod_index(self, pod_list: list[k8s.V1Pod]) -> int:
"""Loop through a list of V1Pod objects and get the index of the most
recent one."""
pod_start_times: list[datetime.datetime] = [
pod.to_dict().get("status").get("start_time") for pod in pod_list
]
+ if not all(pod_start_times):
+ self.log.info(
+ "Some of the start_time values are None, switch to
creation_timestamp to choose most recent pod"
+ )
Review Comment:
```suggestion
self.log.info(
"Unable to determine most recent pod using start_time (some
pods have not started yet). Falling back to creation_timestamp from pod
metadata."
)
```
--
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]