Search in sources :

Example 6 with ResourcePool

use of org.apache.drill.exec.resourcemgr.config.ResourcePool in project drill by apache.

the class TestBestFitSelectionPolicy method testCommonHelper.

private void testCommonHelper(long expectedPoolMem) throws Exception {
    List<ResourcePool> inputPools = new ArrayList<>();
    ResourcePool expectedPool = null;
    for (Long poolMemory : poolMemory) {
        final ResourcePool testPool = mock(ResourcePool.class);
        final QueryQueueConfig testPoolQueue = mock(QueryQueueConfig.class);
        when(testPool.getQueryQueue()).thenReturn(testPoolQueue);
        when(testPoolQueue.getMaxQueryMemoryInMBPerNode()).thenReturn(poolMemory);
        inputPools.add(testPool);
        if (poolMemory == expectedPoolMem) {
            expectedPool = testPool;
        }
    }
    ResourcePool selectedPool = selectionPolicy.selectQueue(inputPools, queryContext, queryMaxResources);
    assertEquals("Selected Pool and expected pool is different", expectedPool, selectedPool);
}
Also used : QueryQueueConfig(org.apache.drill.exec.resourcemgr.config.QueryQueueConfig) ArrayList(java.util.ArrayList) ResourcePool(org.apache.drill.exec.resourcemgr.config.ResourcePool)

Example 7 with ResourcePool

use of org.apache.drill.exec.resourcemgr.config.ResourcePool in project drill by apache.

the class TestDefaultSelectionPolicy method testWithMultipleDefaultPool.

@Test
public void testWithMultipleDefaultPool() throws Exception {
    List<ResourcePool> inputPools = new ArrayList<>();
    final ResourcePool testPool1 = mock(ResourcePool.class);
    when(testPool1.isDefaultPool()).thenReturn(true);
    final ResourcePool testPool2 = mock(ResourcePool.class);
    when(testPool2.isDefaultPool()).thenReturn(true);
    inputPools.add(testPool1);
    inputPools.add(testPool2);
    final ResourcePool selectedPool = selectionPolicy.selectQueue(inputPools, queryContext, null);
    assertEquals("Selected Pool and expected pool is different", testPool1, selectedPool);
}
Also used : ArrayList(java.util.ArrayList) ResourcePool(org.apache.drill.exec.resourcemgr.config.ResourcePool) Test(org.junit.Test) BaseTest(org.apache.drill.test.BaseTest) ResourceManagerTest(org.apache.drill.categories.ResourceManagerTest)

Example 8 with ResourcePool

use of org.apache.drill.exec.resourcemgr.config.ResourcePool in project drill by apache.

the class TestDefaultSelectionPolicy method testMixOfDefaultAndNonDefaultPool.

@Test
public void testMixOfDefaultAndNonDefaultPool() throws Exception {
    List<ResourcePool> inputPools = new ArrayList<>();
    final ResourcePool testPool1 = mock(ResourcePool.class);
    when(testPool1.isDefaultPool()).thenReturn(false);
    final ResourcePool testPool2 = mock(ResourcePool.class);
    when(testPool2.isDefaultPool()).thenReturn(true);
    inputPools.add(testPool1);
    inputPools.add(testPool2);
    final ResourcePool selectedPool = selectionPolicy.selectQueue(inputPools, queryContext, null);
    assertEquals("Selected Pool and expected pool is different", testPool2, selectedPool);
}
Also used : ArrayList(java.util.ArrayList) ResourcePool(org.apache.drill.exec.resourcemgr.config.ResourcePool) Test(org.junit.Test) BaseTest(org.apache.drill.test.BaseTest) ResourceManagerTest(org.apache.drill.categories.ResourceManagerTest)

Aggregations

ResourcePool (org.apache.drill.exec.resourcemgr.config.ResourcePool)8 ArrayList (java.util.ArrayList)6 ResourceManagerTest (org.apache.drill.categories.ResourceManagerTest)5 BaseTest (org.apache.drill.test.BaseTest)5 Test (org.junit.Test)5 QueueSelectionException (org.apache.drill.exec.resourcemgr.config.exception.QueueSelectionException)2 HashMap (java.util.HashMap)1 QueryQueueConfig (org.apache.drill.exec.resourcemgr.config.QueryQueueConfig)1 QueueAssignmentResult (org.apache.drill.exec.resourcemgr.config.QueueAssignmentResult)1 ResourcePoolTree (org.apache.drill.exec.resourcemgr.config.ResourcePoolTree)1 OptionValue (org.apache.drill.exec.server.options.OptionValue)1