use of com.facebook.presto.spi.resourceGroups.ResourceGroupInfo in project presto by prestodb.
the class TestResourceGroupIntegration method testMemoryFraction.
@Test
public void testMemoryFraction() throws Exception {
try (DistributedQueryRunner queryRunner = createQueryRunner(ImmutableMap.of(), ImmutableMap.of("experimental.resource-groups-enabled", "true"))) {
queryRunner.installPlugin(new ResourceGroupManagerPlugin());
queryRunner.getCoordinator().getResourceGroupManager().get().setConfigurationManager("file", ImmutableMap.of("resource-groups.config-file", getResourceFilePath("resource_groups_memory_percentage.json")));
queryRunner.execute("SELECT COUNT(*), clerk FROM orders GROUP BY clerk");
long startTime = System.nanoTime();
while (true) {
SECONDS.sleep(1);
ResourceGroupInfo global = queryRunner.getCoordinator().getResourceGroupManager().get().getResourceGroupInfo(new ResourceGroupId("global"));
if (global.getSoftMemoryLimit().toBytes() > 0) {
break;
}
assertLessThan(nanosSince(startTime).roundTo(SECONDS), 60L);
}
}
}
use of com.facebook.presto.spi.resourceGroups.ResourceGroupInfo in project presto by prestodb.
the class TestQueues method testRunningQuery.
@Test(timeOut = 60_000)
public void testRunningQuery() throws Exception {
try (DistributedQueryRunner queryRunner = getSimpleQueryRunner()) {
queryRunner.execute("SELECT COUNT(*), clerk FROM orders GROUP BY clerk");
while (true) {
TimeUnit.SECONDS.sleep(2);
ResourceGroupInfo global = queryRunner.getCoordinator().getResourceGroupManager().get().getResourceGroupInfo(new ResourceGroupId(new ResourceGroupId("global"), "bi-user"));
if (global.getSoftMemoryLimit().toBytes() > 0) {
break;
}
}
}
}
Aggregations