use of com.facebook.presto.spi.resourceGroups.ResourceGroup in project presto by prestodb.
the class TestFileResourceGroupConfigurationManager method testConfiguration.
@Test
public void testConfiguration() {
ResourceGroupConfigurationManager manager = parse("resource_groups_config.json");
ResourceGroup global = new TestingResourceGroup(new ResourceGroupId("global"));
manager.configure(global, new SelectionContext(true, "user", Optional.empty(), 1));
assertEquals(global.getSoftMemoryLimit(), new DataSize(1, MEGABYTE));
assertEquals(global.getSoftCpuLimit(), new Duration(1, HOURS));
assertEquals(global.getHardCpuLimit(), new Duration(1, DAYS));
assertEquals(global.getCpuQuotaGenerationMillisPerSecond(), 1000 * 24);
assertEquals(global.getMaxQueuedQueries(), 1000);
assertEquals(global.getMaxRunningQueries(), 100);
assertEquals(global.getSchedulingPolicy(), WEIGHTED);
assertEquals(global.getSchedulingWeight(), 0);
assertEquals(global.getJmxExport(), true);
ResourceGroup sub = new TestingResourceGroup(new ResourceGroupId(new ResourceGroupId("global"), "sub"));
manager.configure(sub, new SelectionContext(true, "user", Optional.empty(), 1));
assertEquals(sub.getSoftMemoryLimit(), new DataSize(2, MEGABYTE));
assertEquals(sub.getMaxRunningQueries(), 3);
assertEquals(sub.getMaxQueuedQueries(), 4);
assertEquals(sub.getSchedulingPolicy(), null);
assertEquals(sub.getSchedulingWeight(), 5);
assertEquals(sub.getJmxExport(), false);
}
use of com.facebook.presto.spi.resourceGroups.ResourceGroup in project presto by prestodb.
the class TestFileResourceGroupConfigurationManager method testMissing.
@Test(expectedExceptions = IllegalStateException.class, expectedExceptionsMessageRegExp = "No matching configuration found for: missing")
public void testMissing() {
ResourceGroupConfigurationManager manager = parse("resource_groups_config.json");
ResourceGroup missing = new TestingResourceGroup(new ResourceGroupId("missing"));
manager.configure(missing, new SelectionContext(true, "user", Optional.empty(), 1));
}
Aggregations