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 ec6808f28ca20deb2cc1fd9221605f079e3095ee..9eec3019d9fcfcf8a783e5f6f2e72d135e1f1384 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 { 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 c939a2a5404aa0bc112548bccd4616d5085829a7..4ced1c52fd9fcad13e0ae86a14992463667c1350 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);