Skip to content

Commit

Permalink
Remove checks + assert pod running with completed state
Browse files Browse the repository at this point in the history
  • Loading branch information
kornys committed Jan 30, 2024
1 parent 1c00e58 commit 2692a61
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,47 +68,48 @@ public boolean waitForReadiness(DataScienceCluster resource) {
LOGGER.debug("DataScienceCluster {} Workbenches status: {}", resource.getMetadata().getName(), workbenchesStatus);
dscReady = dscReady && workbenchesStatus.equals("True");

// Wait for CodeFlare
if (resource.getSpec().getComponents().getCodeflare().getManagementState().equals(Codeflare.ManagementState.MANAGED)) {
String codeflareStatus = KubeUtils.getDscConditionByType(dsc.getStatus().getConditions(), "codeflareReady").getStatus();
LOGGER.debug("DataScienceCluster {} CodeFlare status: {}", resource.getMetadata().getName(), codeflareStatus);
dscReady = dscReady && codeflareStatus.equals("True");
}

// Wait for ModelMesh
if (resource.getSpec().getComponents().getModelmeshserving().getManagementState().equals(Modelmeshserving.ManagementState.MANAGED)) {
String modemeshStatus = KubeUtils.getDscConditionByType(dsc.getStatus().getConditions(), "model-meshReady").getStatus();
LOGGER.debug("DataScienceCluster {} ModelMesh status: {}", resource.getMetadata().getName(), modemeshStatus);
dscReady = dscReady && modemeshStatus.equals("True");
}

// Wait for Ray
if (resource.getSpec().getComponents().getRay().getManagementState().equals(Ray.ManagementState.MANAGED)) {
String rayStatus = KubeUtils.getDscConditionByType(dsc.getStatus().getConditions(), "rayReady").getStatus();
LOGGER.debug("DataScienceCluster {} Ray status: {}", resource.getMetadata().getName(), rayStatus);
dscReady = dscReady && rayStatus.equals("True");
}

// Wait for TrustyAi
if (resource.getSpec().getComponents().getTrustyai().getManagementState().equals(Trustyai.ManagementState.MANAGED)) {
String trustyAiStatus = KubeUtils.getDscConditionByType(dsc.getStatus().getConditions(), "trustyaiReady").getStatus();
LOGGER.debug("DataScienceCluster {} TrustyAI status: {}", resource.getMetadata().getName(), trustyAiStatus);
dscReady = dscReady && trustyAiStatus.equals("True");
}

// Wait for KServe
if (resource.getSpec().getComponents().getKserve().getManagementState().equals(Kserve.ManagementState.MANAGED)) {
String kserveStatus = KubeUtils.getDscConditionByType(dsc.getStatus().getConditions(), "kserveReady").getStatus();
LOGGER.debug("DataScienceCluster {} KServe status: {}", resource.getMetadata().getName(), kserveStatus);
dscReady = dscReady && kserveStatus.equals("True");
}

// Wait for PipelinesOperator
if (resource.getSpec().getComponents().getDatasciencepipelines().getManagementState().equals(Datasciencepipelines.ManagementState.MANAGED)) {
String pipelinesStatus = KubeUtils.getDscConditionByType(dsc.getStatus().getConditions(), "data-science-pipelines-operatorReady").getStatus();
LOGGER.debug("DataScienceCluster {} DataSciencePipelines status: {}", resource.getMetadata().getName(), pipelinesStatus);
dscReady = dscReady && pipelinesStatus.equals("True");
}
// TODO uncomment once https://issues.redhat.com/browse/RHOAIENG-416 is fixed
// // Wait for CodeFlare
// if (resource.getSpec().getComponents().getCodeflare().getManagementState().equals(Codeflare.ManagementState.MANAGED)) {
// String codeflareStatus = KubeUtils.getDscConditionByType(dsc.getStatus().getConditions(), "codeflareReady").getStatus();
// LOGGER.debug("DataScienceCluster {} CodeFlare status: {}", resource.getMetadata().getName(), codeflareStatus);
// dscReady = dscReady && codeflareStatus.equals("True");
// }
//
// // Wait for ModelMesh
// if (resource.getSpec().getComponents().getModelmeshserving().getManagementState().equals(Modelmeshserving.ManagementState.MANAGED)) {
// String modemeshStatus = KubeUtils.getDscConditionByType(dsc.getStatus().getConditions(), "model-meshReady").getStatus();
// LOGGER.debug("DataScienceCluster {} ModelMesh status: {}", resource.getMetadata().getName(), modemeshStatus);
// dscReady = dscReady && modemeshStatus.equals("True");
// }
//
// // Wait for Ray
// if (resource.getSpec().getComponents().getRay().getManagementState().equals(Ray.ManagementState.MANAGED)) {
// String rayStatus = KubeUtils.getDscConditionByType(dsc.getStatus().getConditions(), "rayReady").getStatus();
// LOGGER.debug("DataScienceCluster {} Ray status: {}", resource.getMetadata().getName(), rayStatus);
// dscReady = dscReady && rayStatus.equals("True");
// }
//
// // Wait for TrustyAi
// if (resource.getSpec().getComponents().getTrustyai().getManagementState().equals(Trustyai.ManagementState.MANAGED)) {
// String trustyAiStatus = KubeUtils.getDscConditionByType(dsc.getStatus().getConditions(), "trustyaiReady").getStatus();
// LOGGER.debug("DataScienceCluster {} TrustyAI status: {}", resource.getMetadata().getName(), trustyAiStatus);
// dscReady = dscReady && trustyAiStatus.equals("True");
// }
//
// // Wait for KServe
// if (resource.getSpec().getComponents().getKserve().getManagementState().equals(Kserve.ManagementState.MANAGED)) {
// String kserveStatus = KubeUtils.getDscConditionByType(dsc.getStatus().getConditions(), "kserveReady").getStatus();
// LOGGER.debug("DataScienceCluster {} KServe status: {}", resource.getMetadata().getName(), kserveStatus);
// dscReady = dscReady && kserveStatus.equals("True");
// }
//
// // Wait for PipelinesOperator
// if (resource.getSpec().getComponents().getDatasciencepipelines().getManagementState().equals(Datasciencepipelines.ManagementState.MANAGED)) {
// String pipelinesStatus = KubeUtils.getDscConditionByType(dsc.getStatus().getConditions(), "data-science-pipelines-operatorReady").getStatus();
// LOGGER.debug("DataScienceCluster {} DataSciencePipelines status: {}", resource.getMetadata().getName(), pipelinesStatus);
// dscReady = dscReady && pipelinesStatus.equals("True");
// }

return dscReady;
}, () -> { });
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/io/odh/test/utils/PodUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public static void waitForPodsReady(String namespaceName, boolean containers, Ru
return false;
}
for (Pod pod : pods) {
if (!Readiness.isPodReady(pod)) {
if (!(Readiness.isPodReady(pod) || Readiness.isPodSucceeded(pod))) {
LOGGER.debug("Pod not ready: {}/{}", namespaceName, pod.getMetadata().getName());
return false;
} else {
Expand Down Expand Up @@ -74,7 +74,7 @@ public static void waitForPodsReady(String namespaceName, LabelSelector selector
return false;
}
for (Pod pod : pods) {
if (!Readiness.isPodReady(pod)) {
if (!(Readiness.isPodReady(pod) || Readiness.isPodSucceeded(pod))) {
LOGGER.debug("Pod not ready: {}/{}", namespaceName, pod.getMetadata().getName());
return false;
} else {
Expand Down

0 comments on commit 2692a61

Please sign in to comment.