use of com.facebook.presto.server.ResourceGroupInfo in project presto by prestodb.
the class TestResourceGroupIntegration method waitForGlobalResourceGroup.
public static void waitForGlobalResourceGroup(DistributedQueryRunner queryRunner) throws InterruptedException {
long startTime = System.nanoTime();
while (true) {
SECONDS.sleep(1);
ResourceGroupInfo global = getResourceGroupManager(queryRunner).getResourceGroupInfo(new ResourceGroupId("global"), true, true, true);
if (global.getSoftMemoryLimit().toBytes() > 0) {
break;
}
assertLessThan(nanosSince(startTime).roundTo(SECONDS), 60L);
}
}
use of com.facebook.presto.server.ResourceGroupInfo in project presto by prestodb.
the class TestDistributedResourceGroupInfoResource method testGetResourceGroupInfo.
@Test(timeOut = 220_000)
public void testGetResourceGroupInfo() throws InterruptedException, TimeoutException {
runToCompletion(client, coordinator1, "SELECT 1", "user1");
runToFirstResult(client, coordinator2, "SELECT * from tpch.sf100.orders", "user1");
runToFirstResult(client, coordinator1, "SELECT * from tpch.sf101.orders", "user2");
waitUntilCoordinatorsDiscoveredHealthyInRM(SECONDS.toMillis(15));
ResourceGroupInfo resourceGroupInfo = getResponseEntity(client, coordinator1, "/v1/resourceGroupState/global", JsonCodec.jsonCodec(ResourceGroupInfo.class));
assertEquals(resourceGroupInfo.getNumRunningQueries(), 2);
Set<ResourceGroupId> subGroupResourceIdSet = resourceGroupInfo.getSubGroups().stream().map(a -> a.getId()).collect(Collectors.toSet());
assertEquals(subGroupResourceIdSet.size(), 2);
assertTrue(subGroupResourceIdSet.contains(new ResourceGroupId(resourceGroupInfo.getId(), "user-user1")));
assertTrue(subGroupResourceIdSet.contains(new ResourceGroupId(resourceGroupInfo.getId(), "user-user2")));
}
Aggregations