From 7745f5e186503b5fe3ddb0771c82023a12a96867 Mon Sep 17 00:00:00 2001 From: Ali_fahs Date: Thu, 25 Nov 2021 13:03:16 +0100 Subject: [PATCH 1/2] fixing empty host name bug --- .../morphemic/service/ByonUtils.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/service/ByonUtils.java b/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/service/ByonUtils.java index c939a2a..4ced1c5 100644 --- a/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/service/ByonUtils.java +++ b/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/service/ByonUtils.java @@ -16,6 +16,10 @@ public class ByonUtils { private ByonUtils() {} + static final int MAX_CONNECTION_RETRIES = 5; + + static final int INTERVAL = 5000; + public static void init(String paURL) { resourceManagerGateway = new PAResourceManagerGateway(paURL); } @@ -101,7 +105,9 @@ public class ByonUtils { * @return The BYON Host Name */ public static String getBYONHostname(String nsName) { + LOGGER.info("Getting the byon node host name for: " + nsName); List nodeHostnames = new LinkedList<>(); + int retries=0; try { nodeHostnames = resourceManagerGateway.getAsyncDeployedNodesInformation(nsName, "hostname"); } @@ -123,6 +129,22 @@ public class ByonUtils { } } } + while (nodeHostnames.get(0).equals("")) + { + LOGGER.warn("The node host name is empty, retrying to get node information"); + try { + Thread.sleep(INTERVAL); + nodeHostnames = resourceManagerGateway.getAsyncDeployedNodesInformation(nsName, "hostname"); + } + catch(Exception e) { + LOGGER.error(" resourceManagerGateway threw an exception: " + e); + } + if (retries > MAX_CONNECTION_RETRIES) { + LOGGER.error("The node host name is empty after " + retries+ " retries" ); + throw new IllegalStateException("Node hostname is empty"); + } + retries++; + } LOGGER.info("The hostname is retrieved successfully: " + nodeHostnames.get(0)); return nodeHostnames.get(0); -- GitLab From 85d67c83e12589d09bcee6db9975ca1d256161f5 Mon Sep 17 00:00:00 2001 From: Ali_fahs Date: Thu, 25 Nov 2021 17:20:05 +0100 Subject: [PATCH 2/2] remove extra passed spaces in the BYON IP value --- .../src/main/java/org/activeeon/morphemic/PAGateway.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/PAGateway.java b/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/PAGateway.java index ec6808f..9eec301 100644 --- a/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/PAGateway.java +++ b/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/PAGateway.java @@ -475,7 +475,7 @@ public class PAGateway { for(ByonNode byonNode: byonNodeList){ List tempListIP=byonNode.getIpAddresses(); assert !tempListIP.isEmpty(); - byonIPs= byonIPs + tempListIP.get(0).getValue() + ","; + byonIPs= byonIPs + tempListIP.get(0).getValue().replace(" ", "") + ","; } // Collect the pamr router address and port number try { -- GitLab