Search in sources :

Example 6 with ResourceGroupInfo

use of io.prestosql.server.ResourceGroupInfo in project hetu-core by openlookeng.

the class SqlQueryScheduler method getOptimalSmallSplitGroupSize.

private int getOptimalSmallSplitGroupSize() {
    ResourceGroupInfo resourceGroupInfo = queryStateMachine.getResourceGroupManager().getResourceGroupInfo(queryStateMachine.getResourceGroup());
    long queries = resourceGroupInfo.getNumRunningQueries();
    int result = 0;
    for (int i = 0; i < SPLIT_GROUP_BUCKETS.length; i++, result++) {
        if (queries <= SPLIT_GROUP_BUCKETS[i]) {
            break;
        }
    }
    return SPLIT_GROUP_GRADATION[result];
}
Also used : ResourceGroupInfo(io.prestosql.server.ResourceGroupInfo)

Example 7 with ResourceGroupInfo

use of io.prestosql.server.ResourceGroupInfo in project hetu-core by openlookeng.

the class TestResourceGroupIntegration method testPathToRoot.

@Test
public void testPathToRoot() throws Exception {
    try (DistributedQueryRunner queryRunner = TpchQueryRunnerBuilder.builder().build()) {
        queryRunner.installPlugin(new ResourceGroupManagerPlugin());
        InternalResourceGroupManager<?> manager = getResourceGroupManager(queryRunner);
        manager.setConfigurationManager("file", ImmutableMap.of("resource-groups.config-file", getResourceFilePath("resource_groups_config_dashboard.json")));
        queryRunner.execute(testSessionBuilder().setCatalog("tpch").setSchema("tiny").setSource("dashboard-foo").build(), "SELECT COUNT(*), clerk FROM orders GROUP BY clerk");
        List<ResourceGroupInfo> path = manager.getPathToRoot(new ResourceGroupId(new ResourceGroupId(new ResourceGroupId("global"), "user-user"), "dashboard-user"));
        assertEquals(path.size(), 3);
        assertTrue(path.get(1).getSubGroups() != null);
        assertEquals(path.get(2).getId(), new ResourceGroupId("global"));
        assertEquals(path.get(2).getHardConcurrencyLimit(), 100);
        assertEquals(path.get(2).getRunningQueries(), null);
    }
}
Also used : DistributedQueryRunner(io.prestosql.tests.DistributedQueryRunner) ResourceGroupId(io.prestosql.spi.resourcegroups.ResourceGroupId) ResourceGroupManagerPlugin(io.prestosql.plugin.resourcegroups.ResourceGroupManagerPlugin) ResourceGroupInfo(io.prestosql.server.ResourceGroupInfo) Test(org.testng.annotations.Test)

Example 8 with ResourceGroupInfo

use of io.prestosql.server.ResourceGroupInfo in project hetu-core by openlookeng.

the class TestQueuesDb method testRunningQuery.

@Test(timeOut = 60_000)
public void testRunningQuery() throws Exception {
    queryRunner.execute("SELECT COUNT(*), clerk FROM orders GROUP BY clerk");
    while (true) {
        ResourceGroupInfo global = queryRunner.getCoordinator().getResourceGroupManager().get().getResourceGroupInfo(new ResourceGroupId(new ResourceGroupId("global"), "bi-user"));
        if (global.getSoftMemoryLimit().toBytes() > 0) {
            break;
        }
        TimeUnit.SECONDS.sleep(2);
    }
}
Also used : ResourceGroupId(io.prestosql.spi.resourcegroups.ResourceGroupId) TestQueues.createResourceGroupId(io.prestosql.execution.TestQueues.createResourceGroupId) ResourceGroupInfo(io.prestosql.server.ResourceGroupInfo) Test(org.testng.annotations.Test)

Aggregations

ResourceGroupInfo (io.prestosql.server.ResourceGroupInfo)8 Test (org.testng.annotations.Test)6 MockManagedQueryExecution (io.prestosql.execution.MockManagedQueryExecution)4 DataSize (io.airlift.units.DataSize)3 ResourceGroupId (io.prestosql.spi.resourcegroups.ResourceGroupId)3 QueryStateInfo (io.prestosql.server.QueryStateInfo)2 TestQueues.createResourceGroupId (io.prestosql.execution.TestQueues.createResourceGroupId)1 ResourceGroupManagerPlugin (io.prestosql.plugin.resourcegroups.ResourceGroupManagerPlugin)1 DistributedQueryRunner (io.prestosql.tests.DistributedQueryRunner)1