aboutsummaryrefslogtreecommitdiffstats
path: root/participant/participant-impl/participant-impl-kserve/src/main/java
diff options
context:
space:
mode:
authoraravind.est <aravindhan.a@est.tech>2023-03-06 16:29:58 +0000
committeraravind.est <aravindhan.a@est.tech>2023-03-06 17:00:45 +0000
commit80111fe3c4c1e2e145485c2f2a833bdaabb3a680 (patch)
treee07f5d0c334aec4b56c3bfdcef50f80678a9928c /participant/participant-impl/participant-impl-kserve/src/main/java
parente297b91468a465cf828f3a95d0e17fdd1ee89887 (diff)
Add log message when kserve setup is unavailable and improve coverage
Add log message when kserve setup is unavailable. Improve code coverage. Issue-ID: POLICY-4525 Signed-off-by: aravind.est <aravindhan.a@est.tech> Change-Id: If92fc38ceb8e3427e4b2c6045d2fd3ffcc106198
Diffstat (limited to 'participant/participant-impl/participant-impl-kserve/src/main/java')
-rwxr-xr-xparticipant/participant-impl/participant-impl-kserve/src/main/java/org/onap/policy/clamp/acm/participant/kserve/handler/AutomationCompositionElementHandler.java5
-rwxr-xr-xparticipant/participant-impl/participant-impl-kserve/src/main/java/org/onap/policy/clamp/acm/participant/kserve/k8s/InferenceServiceValidator.java11
2 files changed, 11 insertions, 5 deletions
diff --git a/participant/participant-impl/participant-impl-kserve/src/main/java/org/onap/policy/clamp/acm/participant/kserve/handler/AutomationCompositionElementHandler.java b/participant/participant-impl/participant-impl-kserve/src/main/java/org/onap/policy/clamp/acm/participant/kserve/handler/AutomationCompositionElementHandler.java
index 07fbce80c..a6e1c9cbc 100755
--- a/participant/participant-impl/participant-impl-kserve/src/main/java/org/onap/policy/clamp/acm/participant/kserve/handler/AutomationCompositionElementHandler.java
+++ b/participant/participant-impl/participant-impl-kserve/src/main/java/org/onap/policy/clamp/acm/participant/kserve/handler/AutomationCompositionElementHandler.java
@@ -32,6 +32,7 @@ import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import javax.validation.Validation;
import javax.validation.ValidationException;
+import lombok.AccessLevel;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
@@ -72,8 +73,8 @@ public class AutomationCompositionElementHandler implements AutomationCompositio
private final KserveClient kserveClient;
- @Getter
- private static final Map<UUID, ConfigurationEntity> configRequestMap = new HashMap<>();
+ @Getter(AccessLevel.PACKAGE)
+ private final Map<UUID, ConfigurationEntity> configRequestMap = new HashMap<>();
private static class ThreadConfig {
diff --git a/participant/participant-impl/participant-impl-kserve/src/main/java/org/onap/policy/clamp/acm/participant/kserve/k8s/InferenceServiceValidator.java b/participant/participant-impl/participant-impl-kserve/src/main/java/org/onap/policy/clamp/acm/participant/kserve/k8s/InferenceServiceValidator.java
index 5cffa48f8..bbf00b4cd 100755
--- a/participant/participant-impl/participant-impl-kserve/src/main/java/org/onap/policy/clamp/acm/participant/kserve/k8s/InferenceServiceValidator.java
+++ b/participant/participant-impl/participant-impl-kserve/src/main/java/org/onap/policy/clamp/acm/participant/kserve/k8s/InferenceServiceValidator.java
@@ -81,11 +81,12 @@ public class InferenceServiceValidator implements Runnable {
private void verifyInferenceServiceStatus()
throws KserveException, IOException, InterruptedException, ApiException {
var isVerified = false;
+ String isvcStatus = null;
long endTime = System.currentTimeMillis() + (timeout * 1000L);
while (!isVerified && System.currentTimeMillis() < endTime) {
- var output = kserveClient.getInferenceServiceStatus(namespace, inferenceServiceName);
- isVerified = output.equalsIgnoreCase(Boolean.TRUE.toString());
+ isvcStatus = kserveClient.getInferenceServiceStatus(namespace, inferenceServiceName);
+ isVerified = isvcStatus.equalsIgnoreCase(Boolean.TRUE.toString());
if (!isVerified) {
logger.info("Waiting for the inference service {} to be active ", inferenceServiceName);
// Recheck status of pods in specific intervals.
@@ -95,7 +96,11 @@ public class InferenceServiceValidator implements Runnable {
}
}
if (!isVerified) {
- throw new KserveException("Time out Exception verifying the status of the inference service");
+ if (isvcStatus != null && isvcStatus.isEmpty()) {
+ throw new KserveException("Kserve setup is unavailable for inference service to be deployed");
+ } else {
+ throw new KserveException("Time out Exception verifying the status of the inference service");
+ }
}
}
}