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);
}
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);
}
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);
}
Aggregations