dirrao commented on code in PR #41220:
URL: https://github.com/apache/airflow/pull/41220#discussion_r1709431878


##########
airflow/providers/cncf/kubernetes/executors/kubernetes_executor.py:
##########
@@ -601,34 +601,31 @@ def cleanup_stuck_queued_tasks(self, tis: 
list[TaskInstance]) -> list[str]:
         :param tis: List of Task Instances to clean up
         :return: List of readable task instances for a warning message
         """
-        from airflow.providers.cncf.kubernetes.pod_generator import 
PodGenerator
-
         if TYPE_CHECKING:
             assert self.kube_client
             assert self.kube_scheduler
-        readable_tis = []
+        readable_tis: list[str] = []
+        if not tis:
+            return readable_tis
+        pod_labels_combined_str_to_pod_map = 
self.get_pod_labels_combined_str_to_pod_map()
         for ti in tis:
-            selector = PodGenerator.build_selector_for_k8s_executor_pod(
-                dag_id=ti.dag_id,
-                task_id=ti.task_id,
-                try_number=ti.try_number,

Review Comment:
   We are looking for pending state pods only. More than one pod doesn't exists 
in the same pending state. So, adding try_number doesn't  add any value here. 



-- 
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]

Reply via email to