Search in sources :

Example 1 with ResourceGroup

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);
}
Also used : ResourceGroupId(com.facebook.presto.spi.resourceGroups.ResourceGroupId) ResourceGroupConfigurationManager(com.facebook.presto.spi.resourceGroups.ResourceGroupConfigurationManager) DataSize(io.airlift.units.DataSize) Duration(io.airlift.units.Duration) SelectionContext(com.facebook.presto.spi.resourceGroups.SelectionContext) ResourceGroup(com.facebook.presto.spi.resourceGroups.ResourceGroup) Test(org.testng.annotations.Test)

Example 2 with ResourceGroup

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));
}
Also used : ResourceGroupId(com.facebook.presto.spi.resourceGroups.ResourceGroupId) ResourceGroupConfigurationManager(com.facebook.presto.spi.resourceGroups.ResourceGroupConfigurationManager) SelectionContext(com.facebook.presto.spi.resourceGroups.SelectionContext) ResourceGroup(com.facebook.presto.spi.resourceGroups.ResourceGroup) Test(org.testng.annotations.Test)

Aggregations

ResourceGroup (com.facebook.presto.spi.resourceGroups.ResourceGroup)2 ResourceGroupConfigurationManager (com.facebook.presto.spi.resourceGroups.ResourceGroupConfigurationManager)2 ResourceGroupId (com.facebook.presto.spi.resourceGroups.ResourceGroupId)2 SelectionContext (com.facebook.presto.spi.resourceGroups.SelectionContext)2 Test (org.testng.annotations.Test)2 DataSize (io.airlift.units.DataSize)1 Duration (io.airlift.units.Duration)1