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 52fbc52d178de4ec185af3a413fcf9fbcc0bbc1e..896c5253536b3ad468e2620ad7266f1aa8ac1b82 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 @@ -670,9 +670,15 @@ public class PAGateway { public void removeNodes(List nodeNames, Boolean preempt) { nodeNames.forEach(nodeName -> { try { - String nodeUrl = resourceManagerGateway.searchNodes(Collections.singletonList(nodeName), true).get(0); - resourceManagerGateway.removeNode(nodeUrl, preempt); - LOGGER.info("Node " + nodeName + " with URL: " + nodeUrl + " has been removed successfully."); + List nodeURLs = resourceManagerGateway.searchNodes(Collections.singletonList(nodeName), true); + if (!nodeURLs.isEmpty()) { + String nodeUrl = nodeURLs.get(0); + resourceManagerGateway.removeNode(nodeUrl, preempt); + LOGGER.info("Node " + nodeName + " with URL: " + nodeUrl + " has been removed successfully."); + } else { + LOGGER.warn("No Nodes with tag " + nodeName + " has been found in RM. Nothing to be removed here."); + } + } catch (NotConnectedException | RestException e) { LOGGER.error(String.valueOf(e.getStackTrace())); } diff --git a/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/infrastructure/deployment/PAResourceManagerGateway.java b/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/infrastructure/deployment/PAResourceManagerGateway.java index d51d80a8b14e32cbc86813be48e07005e0c06c9c..e847790bd7437d7768478f6937d82ce07c8e7195 100644 --- a/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/infrastructure/deployment/PAResourceManagerGateway.java +++ b/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/infrastructure/deployment/PAResourceManagerGateway.java @@ -197,7 +197,7 @@ public class PAResourceManagerGateway { * @throws RestException In case a Rest exception is thrown */ public List searchNodes(List tags, boolean all) throws NotConnectedException, RestException { - LOGGER.debug("Search for nodes ..."); + LOGGER.debug("Search for nodes with tags " + tags + " ..."); List nodesUrls = new ArrayList<>(rmRestInterface.searchNodes(RMConnectionHelper.getSessionId(), tags, all)); LOGGER.debug("Nodes found: " + nodesUrls); return nodesUrls; @@ -257,7 +257,7 @@ public class PAResourceManagerGateway { * @throws PermissionRestException In case the user does not have valid permissions */ public Boolean removeNode(String nodeUrl, Boolean preempt) throws NotConnectedException, PermissionRestException { - LOGGER.debug("Removing node ..."); + LOGGER.debug("Removing node \'" + nodeUrl + "\' ..."); Boolean result = rmRestInterface.removeNode(RMConnectionHelper.getSessionId(), nodeUrl, preempt); LOGGER.info("Node removed!"); return result; diff --git a/scheduling-abstraction-layer/src/main/resources/log4j.properties b/scheduling-abstraction-layer/src/main/resources/log4j.properties index 83bd98ea2886297adab1a7b8583055a51ef9a10a..b1180c1139b2a23a3903559118cc2cab741e12e1 100644 --- a/scheduling-abstraction-layer/src/main/resources/log4j.properties +++ b/scheduling-abstraction-layer/src/main/resources/log4j.properties @@ -1,6 +1,6 @@ log4j.rootCategory=info,console -log4j.logger.org.activeeon.morphemic=info +log4j.logger.org.activeeon.morphemic=debug log4j.appender.console=org.apache.log4j.ConsoleAppender log4j.appender.console.target=System.out