use of com.facebook.presto.spi.resourceGroups.ResourceGroupConfigurationManager in project presto by prestodb.
the class InternalResourceGroupManager method setConfigurationManager.
@VisibleForTesting
public void setConfigurationManager(String name, Map<String, String> properties) {
requireNonNull(name, "name is null");
requireNonNull(properties, "properties is null");
log.info("-- Loading resource group configuration manager --");
ResourceGroupConfigurationManagerFactory configurationManagerFactory = configurationManagerFactories.get(name);
checkState(configurationManagerFactory != null, "Resource group configuration manager %s is not registered", name);
ResourceGroupConfigurationManager configurationManager = configurationManagerFactory.create(ImmutableMap.copyOf(properties), () -> memoryPoolManager);
checkState(this.configurationManager.compareAndSet(null, configurationManager), "configurationManager already set");
log.info("-- Loaded resource group configuration manager %s --", name);
}
use of com.facebook.presto.spi.resourceGroups.ResourceGroupConfigurationManager 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.ResourceGroupConfigurationManager 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