Skip to content

Commit

Permalink
Check if job container status is completed
Browse files Browse the repository at this point in the history
Signed-off-by: David Kornel <[email protected]>
  • Loading branch information
kornys committed Jan 30, 2024
1 parent 13c5e10 commit ae1e974
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ private <T extends HasMetadata> void createResource(boolean waitReady, T... reso
}
}
} else {
if (client.getClient().resource(resource).get() != null) {
if (type.get(resource.getMetadata().getNamespace(), resource.getMetadata().getName()) != null) {
type.update(resource);
} else {
type.create(resource);
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/io/odh/test/utils/PodUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ public static void waitForPodsReady(String namespaceName, boolean containers, Ru
} else {
if (containers) {
for (ContainerStatus cs : pod.getStatus().getContainerStatuses()) {
if (!Boolean.TRUE.equals(cs.getReady())) {
if (!(Boolean.TRUE.equals(cs.getReady())
|| cs.getState().getAdditionalProperties().getOrDefault("Reason", "none").equals("Completed"))) {
LOGGER.debug("Container: {} of Pod: {}/{} not ready", namespaceName, pod.getMetadata().getName(), cs.getName());
return false;
}
Expand Down Expand Up @@ -80,7 +81,8 @@ public static void waitForPodsReady(String namespaceName, LabelSelector selector
} else {
if (containers) {
for (ContainerStatus cs : pod.getStatus().getContainerStatuses()) {
if (!Boolean.TRUE.equals(cs.getReady())) {
if (!(Boolean.TRUE.equals(cs.getReady())
|| cs.getState().getAdditionalProperties().getOrDefault("Reason", "none").equals("Completed"))) {
LOGGER.debug("Container: {} of Pod: {}/{} not ready", namespaceName, pod.getMetadata().getName(), cs.getName());
return false;
}
Expand Down

0 comments on commit ae1e974

Please sign in to comment.