Search in sources :

Example 1 with QueryQueueConfig

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

the class TestRMConfigLoad method testDefaultRMConfig.

@Test
public void testDefaultRMConfig() throws Exception {
    ClusterFixtureBuilder fixtureBuilder = ClusterFixture.builder(dirTestWatcher).configProperty(ExecConstants.RM_ENABLED, true).configProperty(ExecConstants.DRILL_PORT_HUNT, true).withLocalZk();
    try (ClusterFixture cluster = fixtureBuilder.build()) {
        ResourceManager resourceManager = cluster.drillbit().getContext().getResourceManager();
        assertTrue(resourceManager instanceof DistributedResourceManager);
        ResourcePoolTree poolTree = ((DistributedResourceManager) resourceManager).getRmPoolTree();
        assertTrue("In drill-rm-default root pool is not leaf pool", poolTree.getRootPool().isLeafPool());
        assertTrue("selector in drill-rm-default is not acl selector", poolTree.getRootPool().getSelector() instanceof AclSelector);
        assertEquals("max_query_memory_per_node in drill-rm-default is not configured with expected default value", 8 * 1024L, poolTree.getRootPool().getMaxQueryMemoryPerNode());
        assertEquals("queue_selection_policy in drill-rm-default is not configured with expected default value", RMCommonDefaults.ROOT_POOL_DEFAULT_QUEUE_SELECTION_POLICY, poolTree.getSelectionPolicyInUse().getSelectionPolicy());
        assertEquals("memory share of root pool in drill-rm-default is not configured with expected default value", RMCommonDefaults.ROOT_POOL_DEFAULT_MEMORY_PERCENT, poolTree.getResourceShare(), 0);
        final QueryQueueConfig defaultQueue = poolTree.getRootPool().getQueryQueue();
        assertEquals("max_admissible in drill-rm-default is not configured with expected default value", RMCommonDefaults.MAX_ADMISSIBLE_QUERY_COUNT, defaultQueue.getMaxAdmissibleQueries());
        assertEquals("max_waiting in drill-rm-default is not configured with expected default value", RMCommonDefaults.MAX_WAITING_QUERY_COUNT, defaultQueue.getMaxWaitingQueries());
        assertEquals("max_wait_timeout in drill-rm-default is not configured with expected default value", RMCommonDefaults.MAX_WAIT_TIMEOUT_IN_MS, defaultQueue.getWaitTimeoutInMs());
        assertEquals("wait_for_preferred_nodes in drill-rm-default is not configured with expected default value", RMCommonDefaults.WAIT_FOR_PREFERRED_NODES, defaultQueue.waitForPreferredNodes());
    }
}
Also used : ClusterFixture(org.apache.drill.test.ClusterFixture) QueryQueueConfig(org.apache.drill.exec.resourcemgr.config.QueryQueueConfig) ResourcePoolTree(org.apache.drill.exec.resourcemgr.config.ResourcePoolTree) ClusterFixtureBuilder(org.apache.drill.test.ClusterFixtureBuilder) DefaultResourceManager(org.apache.drill.exec.work.foreman.rm.DefaultResourceManager) DistributedResourceManager(org.apache.drill.exec.work.foreman.rm.DistributedResourceManager) ResourceManager(org.apache.drill.exec.work.foreman.rm.ResourceManager) DistributedResourceManager(org.apache.drill.exec.work.foreman.rm.DistributedResourceManager) AclSelector(org.apache.drill.exec.resourcemgr.config.selectors.AclSelector) Test(org.junit.Test) ResourceManagerTest(org.apache.drill.categories.ResourceManagerTest) DrillTest(org.apache.drill.test.DrillTest)

Example 2 with QueryQueueConfig

use of org.apache.drill.exec.resourcemgr.config.QueryQueueConfig 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)

Aggregations

QueryQueueConfig (org.apache.drill.exec.resourcemgr.config.QueryQueueConfig)2 ArrayList (java.util.ArrayList)1 ResourceManagerTest (org.apache.drill.categories.ResourceManagerTest)1 ResourcePool (org.apache.drill.exec.resourcemgr.config.ResourcePool)1 ResourcePoolTree (org.apache.drill.exec.resourcemgr.config.ResourcePoolTree)1 AclSelector (org.apache.drill.exec.resourcemgr.config.selectors.AclSelector)1 DefaultResourceManager (org.apache.drill.exec.work.foreman.rm.DefaultResourceManager)1 DistributedResourceManager (org.apache.drill.exec.work.foreman.rm.DistributedResourceManager)1 ResourceManager (org.apache.drill.exec.work.foreman.rm.ResourceManager)1 ClusterFixture (org.apache.drill.test.ClusterFixture)1 ClusterFixtureBuilder (org.apache.drill.test.ClusterFixtureBuilder)1 DrillTest (org.apache.drill.test.DrillTest)1 Test (org.junit.Test)1