HsiuChuanHsu commented on code in PR #54115:
URL: https://github.com/apache/airflow/pull/54115#discussion_r2255491951


##########
providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/executors/kubernetes_executor.py:
##########
@@ -417,6 +417,46 @@ def _change_state(
         if TYPE_CHECKING:
             assert self.kube_scheduler
 
+        if state == TaskInstanceState.FAILED:
+            try:
+                if self.kube_client:
+                    pod = self.kube_client.read_namespaced_pod(name=pod_name, 
namespace=namespace)

Review Comment:
   True!!! Moving this logic to `KubernetesJobWatcher.process_status` would be 
much consistent, since `process_status` already reads pod status to determine 
task state. 
   
   This change would reduces load on Kubernetes API server and no need for and 
additional `read_namespaced_pod` call in `_change_state`.
   
   Thanks for this suggestion!



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