You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by ra...@apache.org on 2026/03/25 11:48:21 UTC

(airflow) 40/46: Clarify reattach order of `find_spark_job` in `SparkKubernetesOperator` (#64186)

This is an automated email from the ASF dual-hosted git repository.

rahulvats pushed a commit to branch py-client-sync
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit 072b72e2e35786ba3f451e42f009aedd9023652d
Author: Nataneljpwd <10...@users.noreply.github.com>
AuthorDate: Tue Mar 24 21:52:17 2026 +0200

    Clarify reattach order of `find_spark_job` in `SparkKubernetesOperator` (#64186)
---
 .../airflow/providers/cncf/kubernetes/operators/spark_kubernetes.py    | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/operators/spark_kubernetes.py b/providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/operators/spark_kubernetes.py
index 0d77361199d..6185b3053ef 100644
--- a/providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/operators/spark_kubernetes.py
+++ b/providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/operators/spark_kubernetes.py
@@ -265,6 +265,9 @@ class SparkKubernetesOperator(KubernetesPodOperator):
             #
             # Pending pods are considered to handle recent driver restarts without
             # prematurely failing the task.
+            # Pending pods are preferred over Running pods, as if a new pod is created
+            # that means the old pod is terminating (which is running state with deletion timestamp)
+            # and we always prefer a new pod over an old pod.
             pod = max(
                 pod_list,
                 key=lambda p: (