jtele2 commented on code in PR #31389:
URL: https://github.com/apache/airflow/pull/31389#discussion_r1285109173
##########
airflow/providers/cncf/kubernetes/utils/pod_manager.py:
##########
@@ -153,6 +153,31 @@ def container_is_terminated(pod: V1Pod, container_name:
str) -> bool:
return container_status.state.terminated is not None
+def container_is_completed(pod: V1Pod, container_name: str) -> bool:
+ """
+ Examines V1Pod ``pod`` to determine whether ``container_name`` is
completed.
+ If that container is present and completed, returns True. Returns False
otherwise.
+ """
+ container_status = get_container_status(pod, container_name)
+ if not container_status:
+ return False
+ return container_status.state.terminated is not None
+
+
+def container_is_succeeded(pod: V1Pod, container_name: str) -> bool:
+ """
+ Examines V1Pod ``pod`` to determine whether ``container_name`` is
completed and succeeded.
+ If that container is present and completed and succeeded, returns True.
Returns False otherwise.
+ """
+ if not container_is_completed(pod, container_name):
+ return False
+
+ container_status = get_container_status(pod, container_name)
+ if not container_status:
+ return False
+ return container_status.state.terminated.exit_code == 0
+
+
Review Comment:
I thought they had been merged already, just waiting on the new release so I
don't have to build from source to use this. But still very eagerly waiting.
--
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]