Search in sources :

Example 1 with ResourceGroupManagerPlugin

use of io.prestosql.plugin.resourcegroups.ResourceGroupManagerPlugin in project hetu-core by openlookeng.

the class TestQueues method testResourceGroupManagerWithTwoDashboardQueriesRequestedAtTheSameTime.

@Test(timeOut = 240_000)
public void testResourceGroupManagerWithTwoDashboardQueriesRequestedAtTheSameTime() throws Exception {
    try (DistributedQueryRunner queryRunner = createQueryRunner()) {
        queryRunner.installPlugin(new ResourceGroupManagerPlugin());
        queryRunner.getCoordinator().getResourceGroupManager().get().setConfigurationManager("file", ImmutableMap.of("resource-groups.config-file", getResourceFilePath("resource_groups_config_dashboard.json")));
        QueryId firstDashboardQuery = createDashboardQuery(queryRunner);
        QueryId secondDashboardQuery = createDashboardQuery(queryRunner);
        ImmutableSet<QueryState> queuedOrRunning = ImmutableSet.of(QUEUED, RUNNING);
        waitForQueryState(queryRunner, firstDashboardQuery, queuedOrRunning);
        waitForQueryState(queryRunner, secondDashboardQuery, queuedOrRunning);
    }
}
Also used : DistributedQueryRunner(io.prestosql.tests.DistributedQueryRunner) QueryId(io.prestosql.spi.QueryId) ResourceGroupManagerPlugin(io.prestosql.plugin.resourcegroups.ResourceGroupManagerPlugin) TestQueryRunnerUtil.waitForQueryState(io.prestosql.execution.TestQueryRunnerUtil.waitForQueryState) Test(org.testng.annotations.Test)

Example 2 with ResourceGroupManagerPlugin

use of io.prestosql.plugin.resourcegroups.ResourceGroupManagerPlugin in project hetu-core by openlookeng.

the class TestQueues method testQueryTypeBasedSelection.

@Test(timeOut = 240_000)
public void testQueryTypeBasedSelection() throws Exception {
    try (DistributedQueryRunner queryRunner = TpchQueryRunnerBuilder.builder().build()) {
        queryRunner.installPlugin(new ResourceGroupManagerPlugin());
        queryRunner.getCoordinator().getResourceGroupManager().get().setConfigurationManager("file", ImmutableMap.of("resource-groups.config-file", getResourceFilePath("resource_groups_query_type_based_config.json")));
        assertResourceGroup(queryRunner, newAdhocSession(), LONG_LASTING_QUERY, createResourceGroupId("global", "select"));
        assertResourceGroup(queryRunner, newAdhocSession(), "SHOW TABLES", createResourceGroupId("global", "describe"));
        assertResourceGroup(queryRunner, newAdhocSession(), "EXPLAIN " + LONG_LASTING_QUERY, createResourceGroupId("global", "explain"));
        assertResourceGroup(queryRunner, newAdhocSession(), "DESCRIBE lineitem", createResourceGroupId("global", "describe"));
        assertResourceGroup(queryRunner, newAdhocSession(), "RESET SESSION " + HASH_PARTITION_COUNT, createResourceGroupId("global", "data_definition"));
    }
}
Also used : DistributedQueryRunner(io.prestosql.tests.DistributedQueryRunner) ResourceGroupManagerPlugin(io.prestosql.plugin.resourcegroups.ResourceGroupManagerPlugin) Test(org.testng.annotations.Test)

Example 3 with ResourceGroupManagerPlugin

use of io.prestosql.plugin.resourcegroups.ResourceGroupManagerPlugin in project hetu-core by openlookeng.

the class TestQueues method testClientTagsBasedSelection.

@Test(timeOut = 240_000)
public void testClientTagsBasedSelection() throws Exception {
    try (DistributedQueryRunner queryRunner = createQueryRunner()) {
        queryRunner.installPlugin(new ResourceGroupManagerPlugin());
        queryRunner.getCoordinator().getResourceGroupManager().get().setConfigurationManager("file", ImmutableMap.of("resource-groups.config-file", getResourceFilePath("resource_groups_client_tags_based_config.json")));
        assertResourceGroup(queryRunner, newSessionWithTags(ImmutableSet.of("a")), LONG_LASTING_QUERY, createResourceGroupId("global", "a", "default"));
        assertResourceGroup(queryRunner, newSessionWithTags(ImmutableSet.of("b")), LONG_LASTING_QUERY, createResourceGroupId("global", "b"));
        assertResourceGroup(queryRunner, newSessionWithTags(ImmutableSet.of("a", "c")), LONG_LASTING_QUERY, createResourceGroupId("global", "a", "c"));
    }
}
Also used : DistributedQueryRunner(io.prestosql.tests.DistributedQueryRunner) ResourceGroupManagerPlugin(io.prestosql.plugin.resourcegroups.ResourceGroupManagerPlugin) Test(org.testng.annotations.Test)

Example 4 with ResourceGroupManagerPlugin

use of io.prestosql.plugin.resourcegroups.ResourceGroupManagerPlugin in project hetu-core by openlookeng.

the class TestEventListener method setUp.

@BeforeClass
private void setUp() throws Exception {
    session = testSessionBuilder().setSystemProperty("task_concurrency", "1").setCatalog("tpch").setSchema("tiny").setClientInfo("{\"clientVersion\":\"testVersion\"}").build();
    queryRunner = new DistributedQueryRunner(session, 1);
    queryRunner.installPlugin(new TpchPlugin());
    queryRunner.installPlugin(new TestingEventListenerPlugin(generatedEvents));
    queryRunner.installPlugin(new ResourceGroupManagerPlugin());
    queryRunner.createCatalog("tpch", "tpch", ImmutableMap.of("tpch.splits-per-node", Integer.toString(SPLITS_PER_NODE)));
    queryRunner.getCoordinator().getResourceGroupManager().get().setConfigurationManager("file", ImmutableMap.of("resource-groups.config-file", getResourceFilePath("resource_groups_config_simple.json")));
}
Also used : TestingEventListenerPlugin(io.prestosql.execution.TestEventListenerPlugin.TestingEventListenerPlugin) DistributedQueryRunner(io.prestosql.tests.DistributedQueryRunner) TpchPlugin(io.prestosql.plugin.tpch.TpchPlugin) ResourceGroupManagerPlugin(io.prestosql.plugin.resourcegroups.ResourceGroupManagerPlugin) BeforeClass(org.testng.annotations.BeforeClass)

Example 5 with ResourceGroupManagerPlugin

use of io.prestosql.plugin.resourcegroups.ResourceGroupManagerPlugin in project hetu-core by openlookeng.

the class TestResourceGroupIntegration method testMemoryFraction.

@Test
public void testMemoryFraction() throws Exception {
    try (DistributedQueryRunner queryRunner = TpchQueryRunnerBuilder.builder().build()) {
        queryRunner.installPlugin(new ResourceGroupManagerPlugin());
        getResourceGroupManager(queryRunner).setConfigurationManager("file", ImmutableMap.of("resource-groups.config-file", getResourceFilePath("resource_groups_memory_percentage.json")));
        queryRunner.execute("SELECT COUNT(*), clerk FROM orders GROUP BY clerk");
        waitForGlobalResourceGroup(queryRunner);
    }
}
Also used : DistributedQueryRunner(io.prestosql.tests.DistributedQueryRunner) ResourceGroupManagerPlugin(io.prestosql.plugin.resourcegroups.ResourceGroupManagerPlugin) Test(org.testng.annotations.Test)

Aggregations

ResourceGroupManagerPlugin (io.prestosql.plugin.resourcegroups.ResourceGroupManagerPlugin)11 DistributedQueryRunner (io.prestosql.tests.DistributedQueryRunner)11 Test (org.testng.annotations.Test)9 QueryId (io.prestosql.spi.QueryId)5 DispatchManager (io.prestosql.dispatcher.DispatchManager)1 TestingEventListenerPlugin (io.prestosql.execution.TestEventListenerPlugin.TestingEventListenerPlugin)1 TestQueryRunnerUtil.waitForQueryState (io.prestosql.execution.TestQueryRunnerUtil.waitForQueryState)1 TpchPlugin (io.prestosql.plugin.tpch.TpchPlugin)1 ResourceGroupInfo (io.prestosql.server.ResourceGroupInfo)1 ResourceGroupId (io.prestosql.spi.resourcegroups.ResourceGroupId)1 ResourceEstimates (io.prestosql.spi.session.ResourceEstimates)1 BeforeClass (org.testng.annotations.BeforeClass)1