Search in sources :

Example 16 with RMNodeData

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);
    }
}
Also used : RMNodeData(org.ow2.proactive.resourcemanager.db.RMNodeData) Test(org.junit.Test)

Example 17 with RMNodeData

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);
    }
}
Also used : RMNodeData(org.ow2.proactive.resourcemanager.db.RMNodeData) Test(org.junit.Test)

Example 18 with RMNodeData

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());
    }
}
Also used : RMNodeData(org.ow2.proactive.resourcemanager.db.RMNodeData)

Example 19 with RMNodeData

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());
    }
}
Also used : RMNodeData(org.ow2.proactive.resourcemanager.db.RMNodeData)

Example 20 with RMNodeData

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());
}
Also used : RMNode(org.ow2.proactive.resourcemanager.rmnode.RMNode) NodeState(org.ow2.proactive.resourcemanager.common.NodeState) HashMap(java.util.HashMap) RMNode(org.ow2.proactive.resourcemanager.rmnode.RMNode) Node(org.objectweb.proactive.core.node.Node) RMNodeData(org.ow2.proactive.resourcemanager.db.RMNodeData)

Aggregations

RMNodeData (org.ow2.proactive.resourcemanager.db.RMNodeData)18 Test (org.junit.Test)12 RMNode (org.ow2.proactive.resourcemanager.rmnode.RMNode)4 HashMap (java.util.HashMap)2 NodeSourceData (org.ow2.proactive.resourcemanager.db.NodeSourceData)2 Node (org.objectweb.proactive.core.node.Node)1 NodeState (org.ow2.proactive.resourcemanager.common.NodeState)1 AbstractRMNode (org.ow2.proactive.resourcemanager.rmnode.AbstractRMNode)1 RMNodeImpl (org.ow2.proactive.resourcemanager.rmnode.RMNodeImpl)1