You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/04/23 18:19:32 UTC

[GitHub] [airflow] MatthewRBruce commented on a change in pull request #15490: Fix unsuccessful KubernetesPod final_state call when `is_delete_operator_pod=True`

MatthewRBruce commented on a change in pull request #15490:
URL: https://github.com/apache/airflow/pull/15490#discussion_r619415183



##########
File path: airflow/providers/cncf/kubernetes/operators/kubernetes_pod.py
##########
@@ -365,7 +365,10 @@ def execute(self, context) -> Optional[str]:
                 self.log.info("creating pod with labels %s and launcher %s", labels, launcher)
                 final_state, _, result = self.create_new_pod_for_operator(labels, launcher)
             if final_state != State.SUCCESS:
-                status = self.client.read_namespaced_pod(self.pod.metadata.name, self.namespace)
+                if self.is_delete_operator_pod:
+                    status = final_state

Review comment:
       That's a good idea - we could modify `monitor_pod` to return a Tuple of `[State, event, result]` instead of just `[State, result]` (https://github.com/apache/airflow/blob/b844621a6f42cc20b3103bc70c774023268f8de8/airflow/providers/cncf/kubernetes/utils/pod_launcher.py#L170).  Then `create_new_pod_for_operator` could pass that back through to `execute` too (or `create_new_pod_for_operator` could read the pod again in it's `finally` clause and pass that back)




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

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