YARN-10234. FS-CS converter: don't enable auto-create queue property for root. Contributed by Peter Bacsko
(cherry picked from commit 55fcbcb5c2
)
This commit is contained in:
parent
7aad965198
commit
f473473355
|
@ -27,6 +27,7 @@ import java.util.stream.Collectors;
|
||||||
|
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.hadoop.yarn.api.records.Resource;
|
import org.apache.hadoop.yarn.api.records.Resource;
|
||||||
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacitySchedulerConfiguration;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.ConfigurableResource;
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.ConfigurableResource;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSLeafQueue;
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSLeafQueue;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSQueue;
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSQueue;
|
||||||
|
@ -225,7 +226,8 @@ public class FSQueueConverter {
|
||||||
* @param queueName
|
* @param queueName
|
||||||
*/
|
*/
|
||||||
private void emitAutoCreateChildQueue(String queueName, FSQueue queue) {
|
private void emitAutoCreateChildQueue(String queueName, FSQueue queue) {
|
||||||
if (autoCreateChildQueues && !queue.getChildQueues().isEmpty()) {
|
if (autoCreateChildQueues && !queue.getChildQueues().isEmpty()
|
||||||
|
&& !queueName.equals(CapacitySchedulerConfiguration.ROOT)) {
|
||||||
capacitySchedulerConfig.setBoolean(PREFIX + queueName +
|
capacitySchedulerConfig.setBoolean(PREFIX + queueName +
|
||||||
".auto-create-child-queue.enabled", true);
|
".auto-create-child-queue.enabled", true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -649,6 +649,7 @@ public class TestFSConfigToCSConfigConverter {
|
||||||
testAutoCreateChildQueuesWithoutPlacementRules(false);
|
testAutoCreateChildQueuesWithoutPlacementRules(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("checkstyle:linelength")
|
||||||
private void testAutoCreateChildQueuesWithoutPlacementRules(
|
private void testAutoCreateChildQueuesWithoutPlacementRules(
|
||||||
boolean allowUndeclaredPools) throws Exception {
|
boolean allowUndeclaredPools) throws Exception {
|
||||||
config = new Configuration(false);
|
config = new Configuration(false);
|
||||||
|
@ -661,15 +662,27 @@ public class TestFSConfigToCSConfigConverter {
|
||||||
converter.convert(config);
|
converter.convert(config);
|
||||||
|
|
||||||
Configuration convertedConf = converter.getCapacitySchedulerConfig();
|
Configuration convertedConf = converter.getCapacitySchedulerConfig();
|
||||||
String property =
|
String rootUserAutoCreate =
|
||||||
|
"yarn.scheduler.capacity.root.users.auto-create-child-queue.enabled";
|
||||||
|
String rootAutoCreate =
|
||||||
"yarn.scheduler.capacity.root.auto-create-child-queue.enabled";
|
"yarn.scheduler.capacity.root.auto-create-child-queue.enabled";
|
||||||
|
String leafQueueAutoCreate =
|
||||||
|
"yarn.scheduler.capacity.root.users.joe.auto-create-child-queue.enabled";
|
||||||
|
|
||||||
if (allowUndeclaredPools) {
|
if (allowUndeclaredPools) {
|
||||||
assertEquals("Auto-create queue wasn't enabled", true,
|
assertEquals("Auto-create queue wasn't enabled for root.users", true,
|
||||||
convertedConf.getBoolean(property, false));
|
convertedConf.getBoolean(rootUserAutoCreate, false));
|
||||||
|
assertNull("Auto-create queue shouldn't be set for root",
|
||||||
|
convertedConf.get(rootAutoCreate));
|
||||||
|
assertNull("Auto-create queue shouldn't be set for leaf",
|
||||||
|
convertedConf.get(leafQueueAutoCreate));
|
||||||
} else {
|
} else {
|
||||||
assertNull("Auto-create queue shouldn't be set",
|
assertNull("Auto-create queue shouldn't be set for root.users",
|
||||||
convertedConf.get(property));
|
convertedConf.get(rootUserAutoCreate));
|
||||||
|
assertNull("Auto-create queue shouldn't be set for root",
|
||||||
|
convertedConf.get(rootAutoCreate));
|
||||||
|
assertNull("Auto-create queue shouldn't be set for leaf",
|
||||||
|
convertedConf.get(leafQueueAutoCreate));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -316,7 +316,7 @@ public class TestFSQueueConverter {
|
||||||
|
|
||||||
converter.convertQueueHierarchy(rootQueue);
|
converter.convertQueueHierarchy(rootQueue);
|
||||||
|
|
||||||
Set<String> parentQueues = Sets.newHashSet("root",
|
Set<String> parentQueues = Sets.newHashSet(
|
||||||
"root.admins",
|
"root.admins",
|
||||||
"root.users");
|
"root.users");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue