use of org.ow2.proactive.resourcemanager.db.RMNodeData in project scheduling by ow2-proactive.
the class RMDBManagerTest method testAddDeployingNode.
@Test
public void testAddDeployingNode() {
addRMNodeData(NODE_NAME_BASE, NodeState.DEPLOYING);
Collection<RMNodeData> allNodes = dbManager.getAllNodes();
assertThat(allNodes).hasSize(1);
for (RMNodeData node : allNodes) {
assertThat(node.getName()).isEqualTo(NODE_NAME_BASE);
assertThat(node.getNodeUrl()).isEqualTo(NODE_URL);
assertThat(node.getState()).isEqualTo(NodeState.DEPLOYING);
assertThat(node.getStateChangeTime()).isEqualTo(STATE_CHANGE_TIME_BASE);
assertThat(node.getOwner().getId()).isEqualTo(OWNER_ID);
assertThat(node.getProvider().getId()).isEqualTo(PROVIDER_ID);
assertThat(node.getUserPermission().getName()).isEqualTo(PERMISSION_NAME);
assertThat(node.getHostname()).isEqualTo(HOSTNAME);
assertThat(node.getJmxUrls()[0]).isEqualTo(JMX_URLS[0]);
assertThat(node.getJmxUrls()[1]).isEqualTo(JMX_URLS[1]);
assertThat(node.getJvmName()).isEqualTo(JVM_NAME);
}
}
use of org.ow2.proactive.resourcemanager.db.RMNodeData in project scheduling by ow2-proactive.
the class RMDBManagerTest method testAddAllRMNodeData.
@Test
public void testAddAllRMNodeData() {
Map<String, RMNodeData> rmNodeDataEntries = addNRMNodeData(10);
Collection<RMNodeData> allNodes = dbManager.getAllNodes();
assertThat(allNodes).hasSize(10);
for (RMNodeData node : allNodes) {
assertThat(node.getName()).startsWith(NODE_NAME_BASE);
assertThat(node.getNodeUrl()).isEqualTo(NODE_URL);
assertThat(node.getState()).isEqualTo(NODE_STATE_BASE);
assertThat(node.getStateChangeTime()).isEqualTo(STATE_CHANGE_TIME_BASE);
assertThat(node.getOwner().getId()).isEqualTo(OWNER_ID);
assertThat(node.getProvider().getId()).isEqualTo(PROVIDER_ID);
assertThat(node.getUserPermission().getName()).isEqualTo(PERMISSION_NAME);
assertThat(node.getHostname()).isEqualTo(HOSTNAME);
assertThat(node.getJmxUrls()[0]).isEqualTo(JMX_URLS[0]);
assertThat(node.getJmxUrls()[1]).isEqualTo(JMX_URLS[1]);
assertThat(node.getJvmName()).isEqualTo(JVM_NAME);
}
}
use of org.ow2.proactive.resourcemanager.db.RMNodeData in project scheduling by ow2-proactive.
the class RMCore method persistUpdatedRMNodeIfRecoveryEnabled.
/**
* Update the information of the given node in database.
*
* @param rmNode the node to update in database
*/
private void persistUpdatedRMNodeIfRecoveryEnabled(RMNode rmNode) {
if (nodesRecoveryEnabledForNode(rmNode)) {
RMNodeData rmNodeData = RMNodeData.createRMNodeData(rmNode);
dbManager.updateNode(rmNodeData, rmNode.getNodeSourceName());
}
}
use of org.ow2.proactive.resourcemanager.db.RMNodeData in project scheduling by ow2-proactive.
the class RMCore method persistNewRMNodeIfRecoveryEnabled.
/**
* Add the information of the given node to the database.
*
* @param rmNode the node to add to the database
*/
private void persistNewRMNodeIfRecoveryEnabled(RMNode rmNode) {
if (nodesRecoveryEnabledForNode(rmNode)) {
RMNodeData rmNodeData = RMNodeData.createRMNodeData(rmNode);
dbManager.addNode(rmNodeData, rmNode.getNodeSourceName());
}
}
use of org.ow2.proactive.resourcemanager.db.RMNodeData in project scheduling by ow2-proactive.
the class NodesRecoveryManager method recoverNodes.
protected void recoverNodes(NodeSource nodeSource) {
// this log line is important for performance tests
logger.info(START_TO_RECOVER_NODES);
int lookUpTimeout = PAResourceManagerProperties.RM_NODELOOKUP_TIMEOUT.getValueAsInt();
String nodeSourceName = nodeSource.getName();
this.logWarnIfNodeSourceHasNoNode(nodeSource, nodeSourceName);
Collection<RMNodeData> nodesData = this.rmCore.getDbManager().getNodesByNodeSource(nodeSourceName);
logger.info("Number of nodes found in database for node source " + nodeSourceName + ": " + nodesData.size());
List<RMNode> recoveredEligibleNodes = Collections.synchronizedList(new ArrayList<RMNode>());
Map<NodeState, Integer> recoveredNodeStatesCounter = new HashMap<>();
// as down node
for (RMNodeData rmNodeData : nodesData) {
String nodeUrl = rmNodeData.getNodeUrl();
Node node = this.tryToLookupNode(nodeSource, lookUpTimeout, nodeUrl);
RMNode rmnode = this.recoverRMNode(nodeSource, recoveredNodeStatesCounter, rmNodeData, nodeUrl, node);
if (this.isEligible(rmnode)) {
recoveredEligibleNodes.add(rmnode);
}
}
this.rmCore.setEligibleNodesToRecover(recoveredEligibleNodes);
this.logNodeRecoverySummary(nodeSourceName, recoveredNodeStatesCounter, recoveredEligibleNodes.size());
}
Aggregations