Search in sources :

Example 1 with ResourceManager

use of org.apache.hyracks.control.cc.scheduler.ResourceManager in project asterixdb by apache.

the class NodeManagerTest method testException.

@Test
public void testException() throws HyracksException {
    IResourceManager resourceManager = new ResourceManager();
    INodeManager nodeManager = new NodeManager(makeCCConfig(), resourceManager);
    NodeControllerState ncState1 = mockNodeControllerState(NODE1, true);
    boolean invalidNetworkAddress = false;
    // Verifies states after a failure during adding nodes.
    try {
        nodeManager.addNode(NODE1, ncState1);
    } catch (HyracksException e) {
        invalidNetworkAddress = e.getErrorCode() == ErrorCode.INVALID_NETWORK_ADDRESS;
    }
    Assert.assertTrue(invalidNetworkAddress);
    // Verifies that the cluster is empty.
    verifyEmptyCluster(resourceManager, nodeManager);
}
Also used : IResourceManager(org.apache.hyracks.control.cc.scheduler.IResourceManager) HyracksException(org.apache.hyracks.api.exceptions.HyracksException) ResourceManager(org.apache.hyracks.control.cc.scheduler.ResourceManager) IResourceManager(org.apache.hyracks.control.cc.scheduler.IResourceManager) NodeControllerState(org.apache.hyracks.control.cc.NodeControllerState) Test(org.junit.Test)

Example 2 with ResourceManager

use of org.apache.hyracks.control.cc.scheduler.ResourceManager in project asterixdb by apache.

the class NodeManagerTest method testNullNode.

@Test
public void testNullNode() throws HyracksException {
    IResourceManager resourceManager = new ResourceManager();
    INodeManager nodeManager = new NodeManager(makeCCConfig(), resourceManager);
    boolean invalidParameter = false;
    // Verifies states after a failure during adding nodes.
    try {
        nodeManager.addNode(null, null);
    } catch (HyracksException e) {
        invalidParameter = e.getErrorCode() == ErrorCode.INVALID_INPUT_PARAMETER;
    }
    Assert.assertTrue(invalidParameter);
    // Verifies that the cluster is empty.
    verifyEmptyCluster(resourceManager, nodeManager);
}
Also used : IResourceManager(org.apache.hyracks.control.cc.scheduler.IResourceManager) HyracksException(org.apache.hyracks.api.exceptions.HyracksException) ResourceManager(org.apache.hyracks.control.cc.scheduler.ResourceManager) IResourceManager(org.apache.hyracks.control.cc.scheduler.IResourceManager) Test(org.junit.Test)

Example 3 with ResourceManager

use of org.apache.hyracks.control.cc.scheduler.ResourceManager in project asterixdb by apache.

the class NodeManagerTest method testNormal.

@Test
public void testNormal() throws HyracksException {
    IResourceManager resourceManager = new ResourceManager();
    INodeManager nodeManager = new NodeManager(makeCCConfig(), resourceManager);
    NodeControllerState ncState1 = mockNodeControllerState(NODE1, false);
    NodeControllerState ncState2 = mockNodeControllerState(NODE2, false);
    // Verifies states after adding nodes.
    nodeManager.addNode(NODE1, ncState1);
    nodeManager.addNode(NODE2, ncState2);
    Assert.assertTrue(nodeManager.getIpAddressNodeNameMap().size() == 1);
    Assert.assertTrue(nodeManager.getAllNodeIds().size() == 2);
    Assert.assertTrue(nodeManager.getAllNodeControllerStates().size() == 2);
    Assert.assertTrue(nodeManager.getNodeControllerState(NODE1) == ncState1);
    Assert.assertTrue(nodeManager.getNodeControllerState(NODE2) == ncState2);
    Assert.assertTrue(resourceManager.getCurrentCapacity().getAggregatedMemoryByteSize() == NODE_MEMORY_SIZE * 2);
    Assert.assertTrue(resourceManager.getCurrentCapacity().getAggregatedCores() == NODE_CORES * 2);
    Assert.assertTrue(resourceManager.getMaximumCapacity().getAggregatedMemoryByteSize() == NODE_MEMORY_SIZE * 2);
    Assert.assertTrue(resourceManager.getMaximumCapacity().getAggregatedCores() == NODE_CORES * 2);
    // Verifies states after removing dead nodes.
    nodeManager.removeDeadNodes();
    verifyEmptyCluster(resourceManager, nodeManager);
}
Also used : IResourceManager(org.apache.hyracks.control.cc.scheduler.IResourceManager) ResourceManager(org.apache.hyracks.control.cc.scheduler.ResourceManager) IResourceManager(org.apache.hyracks.control.cc.scheduler.IResourceManager) NodeControllerState(org.apache.hyracks.control.cc.NodeControllerState) Test(org.junit.Test)

Example 4 with ResourceManager

use of org.apache.hyracks.control.cc.scheduler.ResourceManager in project asterixdb by apache.

the class JobCapacityControllerTest method makeResourceManagerWithCapacity.

private IResourceManager makeResourceManagerWithCapacity(long memorySize, int cores) throws HyracksException {
    IResourceManager resourceManager = new ResourceManager();
    resourceManager.update("node1", new NodeCapacity(memorySize, cores));
    return resourceManager;
}
Also used : NodeCapacity(org.apache.hyracks.api.job.resource.NodeCapacity) IResourceManager(org.apache.hyracks.control.cc.scheduler.IResourceManager) ResourceManager(org.apache.hyracks.control.cc.scheduler.ResourceManager) IResourceManager(org.apache.hyracks.control.cc.scheduler.IResourceManager)

Aggregations

IResourceManager (org.apache.hyracks.control.cc.scheduler.IResourceManager)4 ResourceManager (org.apache.hyracks.control.cc.scheduler.ResourceManager)4 Test (org.junit.Test)3 HyracksException (org.apache.hyracks.api.exceptions.HyracksException)2 NodeControllerState (org.apache.hyracks.control.cc.NodeControllerState)2 NodeCapacity (org.apache.hyracks.api.job.resource.NodeCapacity)1