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