|
@@ -42,6 +42,7 @@ import java.util.Map;
|
|
|
import java.util.concurrent.BrokenBarrierException;
|
|
|
import java.util.concurrent.CyclicBarrier;
|
|
|
|
|
|
+import com.google.common.collect.Sets;
|
|
|
import org.apache.commons.logging.Log;
|
|
|
import org.apache.commons.logging.LogFactory;
|
|
|
import org.apache.hadoop.conf.Configuration;
|
|
@@ -123,6 +124,7 @@ import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainerImpl
|
|
|
import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainerState;
|
|
|
import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNode;
|
|
|
import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNodeResourceUpdateEvent;
|
|
|
+import org.apache.hadoop.yarn.server.resourcemanager.scheduler.QueueResourceQuotas;
|
|
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.AbstractYarnScheduler;
|
|
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.Allocation;
|
|
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.ContainerUpdates;
|
|
@@ -991,6 +993,45 @@ public class TestCapacityScheduler extends CapacitySchedulerTestBase {
|
|
|
new ClientToAMTokenSecretManagerInRM(), null));
|
|
|
}
|
|
|
|
|
|
+ @Test
|
|
|
+ public void testParseQueueWithAbsoluteResource() {
|
|
|
+ String childQueue = "testQueue";
|
|
|
+ String labelName = "testLabel";
|
|
|
+
|
|
|
+ CapacityScheduler cs = new CapacityScheduler();
|
|
|
+ cs.setConf(new YarnConfiguration());
|
|
|
+ cs.setRMContext(resourceManager.getRMContext());
|
|
|
+ CapacitySchedulerConfiguration conf = new CapacitySchedulerConfiguration();
|
|
|
+
|
|
|
+ conf.setQueues("root", new String[] {childQueue});
|
|
|
+ conf.setCapacity("root." + childQueue, "[memory=20480,vcores=200]");
|
|
|
+ conf.setAccessibleNodeLabels("root." + childQueue,
|
|
|
+ Sets.newHashSet(labelName));
|
|
|
+ conf.setCapacityByLabel("root", labelName, "[memory=10240,vcores=100]");
|
|
|
+ conf.setCapacityByLabel("root." + childQueue, labelName,
|
|
|
+ "[memory=4096,vcores=10]");
|
|
|
+
|
|
|
+ cs.init(conf);
|
|
|
+ cs.start();
|
|
|
+
|
|
|
+ Resource rootQueueLableCapacity =
|
|
|
+ cs.getQueue("root").getQueueResourceQuotas()
|
|
|
+ .getConfiguredMinResource(labelName);
|
|
|
+ assertEquals(10240, rootQueueLableCapacity.getMemorySize());
|
|
|
+ assertEquals(100, rootQueueLableCapacity.getVirtualCores());
|
|
|
+
|
|
|
+ QueueResourceQuotas childQueueQuotas =
|
|
|
+ cs.getQueue(childQueue).getQueueResourceQuotas();
|
|
|
+ Resource childQueueCapacity = childQueueQuotas.getConfiguredMinResource();
|
|
|
+ assertEquals(20480, childQueueCapacity.getMemorySize());
|
|
|
+ assertEquals(200, childQueueCapacity.getVirtualCores());
|
|
|
+
|
|
|
+ Resource childQueueLabelCapacity =
|
|
|
+ childQueueQuotas.getConfiguredMinResource(labelName);
|
|
|
+ assertEquals(4096, childQueueLabelCapacity.getMemorySize());
|
|
|
+ assertEquals(10, childQueueLabelCapacity.getVirtualCores());
|
|
|
+ }
|
|
|
+
|
|
|
@Test
|
|
|
public void testReconnectedNode() throws Exception {
|
|
|
CapacitySchedulerConfiguration csConf =
|