|
@@ -210,8 +210,13 @@ public class TestRMWebApp {
|
|
|
}
|
|
|
|
|
|
public static ResourceManager mockRm(RMContext rmContext) throws IOException {
|
|
|
+ return mockRm(rmContext, false);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static ResourceManager mockRm(RMContext rmContext,
|
|
|
+ boolean useDRC) throws IOException {
|
|
|
ResourceManager rm = mock(ResourceManager.class);
|
|
|
- ResourceScheduler rs = mockCapacityScheduler();
|
|
|
+ ResourceScheduler rs = mockCapacityScheduler(useDRC);
|
|
|
ApplicationACLsManager aclMgr = mockAppACLsManager();
|
|
|
ClientRMService clientRMService = mockClientRMService(rmContext);
|
|
|
when(rm.getResourceScheduler()).thenReturn(rs);
|
|
@@ -222,9 +227,14 @@ public class TestRMWebApp {
|
|
|
}
|
|
|
|
|
|
public static CapacityScheduler mockCapacityScheduler() throws IOException {
|
|
|
+ return mockCapacityScheduler(false);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static CapacityScheduler mockCapacityScheduler(boolean useDRC)
|
|
|
+ throws IOException {
|
|
|
// stolen from TestCapacityScheduler
|
|
|
CapacitySchedulerConfiguration conf = new CapacitySchedulerConfiguration();
|
|
|
- setupQueueConfiguration(conf);
|
|
|
+ setupQueueConfiguration(conf, useDRC);
|
|
|
|
|
|
CapacityScheduler cs = new CapacityScheduler();
|
|
|
YarnConfiguration yarnConf = new YarnConfiguration();
|
|
@@ -276,6 +286,11 @@ public class TestRMWebApp {
|
|
|
|
|
|
|
|
|
static void setupQueueConfiguration(CapacitySchedulerConfiguration conf) {
|
|
|
+ setupQueueConfiguration(conf, false);
|
|
|
+ }
|
|
|
+
|
|
|
+ static void setupQueueConfiguration(CapacitySchedulerConfiguration conf,
|
|
|
+ boolean useDRC) {
|
|
|
// Define top-level queues
|
|
|
conf.setQueues(CapacitySchedulerConfiguration.ROOT, new String[] {"a", "b", "c"});
|
|
|
|
|
@@ -321,6 +336,10 @@ public class TestRMWebApp {
|
|
|
conf.setCapacity(C11, 15);
|
|
|
conf.setCapacity(C12, 45);
|
|
|
conf.setCapacity(C13, 40);
|
|
|
+ if (useDRC) {
|
|
|
+ conf.set("yarn.scheduler.capacity.resource-calculator",
|
|
|
+ "org.apache.hadoop.yarn.util.resource.DominantResourceCalculator");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public static ResourceManager mockFifoRm(int apps, int racks, int nodes,
|