You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "ephraimbuddy (via GitHub)" <gi...@apache.org> on 2023/06/07 07:31:40 UTC

[GitHub] [airflow] ephraimbuddy commented on a diff in pull request #31274: Fix Kubernetes executor set wrong task status

ephraimbuddy commented on code in PR #31274:
URL: https://github.com/apache/airflow/pull/31274#discussion_r1221046448


##########
airflow/executors/kubernetes_executor.py:
##########
@@ -217,8 +217,11 @@ def process_status(
         event: Any,
     ) -> None:
         """Process status response."""
+        pod = event["object"]
         if status == "Pending":
-            if event["type"] == "DELETED":
+            # deletion_timestamp is set by kube server when a graceful deletion is requested.
+            # since the pod is in intermediate state so set TI status failed
+            if pod.metadata.deletion_timestamp is not None:

Review Comment:
   ```suggestion
               if event["type"] == "DELETED" and pod.metadata.deletion_timestamp is not None:
   ```
   WDYT?



##########
airflow/executors/kubernetes_executor.py:
##########
@@ -246,7 +249,9 @@ def process_status(
             self.log.info("Event: %s Succeeded", pod_name)
             self.watcher_queue.put((pod_name, namespace, None, annotations, resource_version))
         elif status == "Running":
-            if event["type"] == "DELETED":
+            # deletion_timestamp is set by kube server when a graceful deletion is requested.
+            # since the pod is in intermediate state so set TI status failed
+            if pod.metadata.deletion_timestamp is not None:

Review Comment:
   ```suggestion
               if event["type"] == "DELETED" and pod.metadata.deletion_timestamp is not None:
   ```
   Not sure if the `is not None` is necessary



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org