use of org.ow2.proactive.resourcemanager.rmnode.RMDeployingNode in project scheduling by ow2-proactive.
the class RestartDownNodesPolicy method activate.
/**
* Activates static policy. Register a listener in RMMonitoring
*/
@Override
public BooleanWrapper activate() {
acquireAllNodes();
timer.schedule(new TimerTask() {
@Override
public void run() {
int numberOfNodesToDeploy = 0;
for (Node downNode : nodeSource.getDownNodes()) {
String nodeUrl = downNode.getNodeInformation().getURL();
logger.info("Removing down node " + nodeUrl);
BooleanWrapper removed = nodeSource.getRMCore().removeNode(nodeUrl, true);
if (removed.getBooleanValue()) {
logger.info("Down node removed " + nodeUrl);
numberOfNodesToDeploy++;
}
}
for (RMDeployingNode lostNode : nodeSource.getDeployingAndLostNodes()) {
if (!lostNode.isLost()) {
continue;
}
String nodeUrl = lostNode.getNodeURL();
logger.info("Removing lost node " + nodeUrl);
BooleanWrapper removed = nodeSource.getRMCore().removeNode(nodeUrl, true);
if (removed.getBooleanValue()) {
logger.info("Lost node removed " + nodeUrl);
numberOfNodesToDeploy++;
}
}
if (numberOfNodesToDeploy > 0) {
logger.info("Acquiring " + numberOfNodesToDeploy + " nodes");
acquireNodes(numberOfNodesToDeploy);
}
}
}, checkNodeStateEach, checkNodeStateEach);
return new BooleanWrapper(true);
}
use of org.ow2.proactive.resourcemanager.rmnode.RMDeployingNode in project scheduling by ow2-proactive.
the class InfrastructureManagerTest method testUpdateLostNodeKnownConflictingUrls.
@Test
public void testUpdateLostNodeKnownConflictingUrls() {
RMDeployingNode deployingNode = new RMDeployingNode("deploying", nodeSource, "command", null);
infrastructureManager.addDeployingNodeWithLockAndPersist(deployingNode.getNodeURL(), deployingNode);
RMDeployingNode lostNode = new RMDeployingNode("deploying", nodeSource, "command", null);
lostNode.setLost();
infrastructureManager.addLostNodeWithLockAndPersist(lostNode.getNodeURL(), lostNode);
assertThat(infrastructureManager.getDeployingNodesWithLock()).hasSize(1);
assertThat(infrastructureManager.getPersistedDeployingNodesUrl()).hasSize(1);
assertThat(infrastructureManager.getLostNodesWithLock()).hasSize(1);
assertThat(infrastructureManager.getPersistedLostNodesUrl()).hasSize(1);
RMDeployingNode lostNode2 = new RMDeployingNode("deploying", nodeSource, "command2", null);
lostNode2.setLost();
RMDeployingNode oldRmNode = infrastructureManager.update(lostNode2);
assertThat(oldRmNode).isSameAs(lostNode);
assertThat(oldRmNode).isNotSameAs(deployingNode);
assertThat(infrastructureManager.getDeployingNodesWithLock()).hasSize(1);
assertThat(infrastructureManager.getPersistedDeployingNodesUrl()).hasSize(1);
assertThat(infrastructureManager.getLostNodesWithLock()).hasSize(1);
assertThat(infrastructureManager.getPersistedLostNodesUrl()).hasSize(1);
assertThat(infrastructureManager.getLostNodesWithLock()).contains(lostNode2);
assertThat(infrastructureManager.getPersistedLostNodesUrl()).contains(lostNode.getNodeURL());
assertThat(infrastructureManager.getPersistedLostNodesUrl()).contains(lostNode2.getNodeURL());
}
use of org.ow2.proactive.resourcemanager.rmnode.RMDeployingNode in project scheduling by ow2-proactive.
the class InfrastructureManagerTest method testGetDeployingNodeLostStateKnow.
@Test
public void testGetDeployingNodeLostStateKnow() {
RMDeployingNode deployingNode = new RMDeployingNode("deploying", nodeSource, "command", null);
infrastructureManager.addDeployingNodeWithLockAndPersist(deployingNode.getNodeURL(), deployingNode);
RMDeployingNode lostNode = new RMDeployingNode("lost", nodeSource, "command", null);
lostNode.setLost();
infrastructureManager.addLostNodeWithLockAndPersist(lostNode.getNodeURL(), lostNode);
assertThat(infrastructureManager.getDeployingNodesWithLock()).hasSize(1);
assertThat(infrastructureManager.getPersistedDeployingNodesUrl()).hasSize(1);
assertThat(infrastructureManager.getLostNodesWithLock()).hasSize(1);
assertThat(infrastructureManager.getPersistedLostNodesUrl()).hasSize(1);
RMDeployingNode rmNodeFound = infrastructureManager.getDeployingOrLostNode(lostNode.getNodeURL());
assertThat(rmNodeFound).isSameAs(lostNode);
assertThat(rmNodeFound).isNotSameAs(deployingNode);
rmNodeFound = infrastructureManager.getDeployingOrLostNode(deployingNode.getNodeURL());
assertThat(rmNodeFound).isSameAs(deployingNode);
assertThat(rmNodeFound).isNotSameAs(lostNode);
}
use of org.ow2.proactive.resourcemanager.rmnode.RMDeployingNode in project scheduling by ow2-proactive.
the class InfrastructureManagerTest method testGetDeployingNodeDeployingStateKnow.
@Test
public void testGetDeployingNodeDeployingStateKnow() {
RMDeployingNode rmNode = new RMDeployingNode("deploying", nodeSource, "command", null);
infrastructureManager.addDeployingNodeWithLockAndPersist(rmNode.getNodeURL(), rmNode);
assertThat(infrastructureManager.getDeployingNodesWithLock()).hasSize(1);
assertThat(infrastructureManager.getPersistedDeployingNodesUrl()).hasSize(1);
assertThat(infrastructureManager.getLostNodesWithLock()).hasSize(0);
assertThat(infrastructureManager.getPersistedLostNodesUrl()).hasSize(0);
RMDeployingNode rmNodeFound = infrastructureManager.getDeployingOrLostNode(rmNode.getNodeURL());
assertThat(rmNodeFound).isSameAs(rmNode);
}
use of org.ow2.proactive.resourcemanager.rmnode.RMDeployingNode in project scheduling by ow2-proactive.
the class InfrastructureManagerTest method testGetDeployingNodeConflictingUrls.
@Test
public void testGetDeployingNodeConflictingUrls() {
RMDeployingNode deployingNode = new RMDeployingNode("deploying", nodeSource, "command", null);
infrastructureManager.addDeployingNodeWithLockAndPersist(deployingNode.getNodeURL(), deployingNode);
RMDeployingNode lostNode = new RMDeployingNode("deploying", nodeSource, "command", null);
lostNode.setLost();
infrastructureManager.addLostNodeWithLockAndPersist(lostNode.getNodeURL(), lostNode);
assertThat(infrastructureManager.getDeployingNodesWithLock()).hasSize(1);
assertThat(infrastructureManager.getPersistedDeployingNodesUrl()).hasSize(1);
assertThat(infrastructureManager.getLostNodesWithLock()).hasSize(1);
assertThat(infrastructureManager.getPersistedLostNodesUrl()).hasSize(1);
// deploying nodes have priority over lost nodes
RMDeployingNode rmNodeFound = infrastructureManager.getDeployingOrLostNode(lostNode.getNodeURL());
assertThat(rmNodeFound).isSameAs(deployingNode);
assertThat(rmNodeFound).isNotSameAs(lostNode);
}
Aggregations