use of io.trino.spi.resourcegroups.ResourceGroup in project trino by trinodb.
the class TestFileResourceGroupConfigurationManager method testLegacyConfiguration.
@Test
public void testLegacyConfiguration() {
FileResourceGroupConfigurationManager manager = parse("resource_groups_config_legacy.json");
ResourceGroupId globalId = new ResourceGroupId("global");
ResourceGroup global = new TestingResourceGroup(globalId);
manager.configure(global, new SelectionContext<>(globalId, new ResourceGroupIdTemplate("global")));
assertEquals(global.getSoftMemoryLimitBytes(), DataSize.of(3, MEGABYTE).toBytes());
assertEquals(global.getMaxQueuedQueries(), 99);
assertEquals(global.getHardConcurrencyLimit(), 42);
}
use of io.trino.spi.resourcegroups.ResourceGroup in project trino by trinodb.
the class TestFileResourceGroupConfigurationManager method testConfiguration.
@Test
public void testConfiguration() {
FileResourceGroupConfigurationManager manager = parse("resource_groups_config.json");
ResourceGroupId globalId = new ResourceGroupId("global");
ResourceGroup global = new TestingResourceGroup(globalId);
manager.configure(global, new SelectionContext<>(globalId, new ResourceGroupIdTemplate("global")));
assertEquals(global.getSoftMemoryLimitBytes(), DataSize.of(1, MEGABYTE).toBytes());
assertEquals(global.getSoftCpuLimit(), Duration.ofHours(1));
assertEquals(global.getHardCpuLimit(), Duration.ofDays(1));
assertEquals(global.getCpuQuotaGenerationMillisPerSecond(), 1000 * 24);
assertEquals(global.getMaxQueuedQueries(), 1000);
assertEquals(global.getHardConcurrencyLimit(), 100);
assertEquals(global.getSchedulingPolicy(), WEIGHTED);
assertEquals(global.getSchedulingWeight(), 0);
assertTrue(global.getJmxExport());
ResourceGroupId subId = new ResourceGroupId(globalId, "sub");
ResourceGroup sub = new TestingResourceGroup(subId);
manager.configure(sub, new SelectionContext<>(subId, new ResourceGroupIdTemplate("global.sub")));
assertEquals(sub.getSoftMemoryLimitBytes(), DataSize.of(2, MEGABYTE).toBytes());
assertEquals(sub.getHardConcurrencyLimit(), 3);
assertEquals(sub.getMaxQueuedQueries(), 4);
assertNull(sub.getSchedulingPolicy());
assertEquals(sub.getSchedulingWeight(), 5);
assertFalse(sub.getJmxExport());
}
Aggregations