YARN-10600. Convert root queue in fs2cs weight mode conversion. Contributed by Benjamin Teke.

This commit is contained in:
Peter Bacsko 2021-01-28 20:58:51 +01:00
parent f565476939
commit fa15594ae6
2 changed files with 15 additions and 4 deletions

View File

@ -28,6 +28,7 @@ import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSQueue;
public class WeightToWeightConverter
implements CapacityConverter {
private static final String ROOT_QUEUE = "root";
@Override
public void convertWeightsForChildQueues(FSQueue queue,
@ -35,6 +36,10 @@ public class WeightToWeightConverter
List<FSQueue> children = queue.getChildQueues();
if (queue instanceof FSParentQueue || !children.isEmpty()) {
if (queue.getName().equals(ROOT_QUEUE)) {
csConfig.set(getProperty(queue), getWeightString(queue));
}
children.forEach(fsQueue -> csConfig.set(
getProperty(fsQueue), getWeightString(fsQueue)));
csConfig.setBoolean(getAutoCreateV2EnabledProperty(queue), true);

View File

@ -44,7 +44,9 @@ public class TestWeightToWeightConverter extends WeightConverterTestBase {
FSQueue root = createFSQueues();
converter.convertWeightsForChildQueues(root, config);
assertEquals("Converted items", 1,
assertEquals("root weight", "1.0w",
config.get(PREFIX + "root.capacity"));
assertEquals("Converted items", 2,
config.getPropsWithPrefix(PREFIX).size());
}
@ -53,9 +55,11 @@ public class TestWeightToWeightConverter extends WeightConverterTestBase {
FSQueue root = createFSQueues(1);
converter.convertWeightsForChildQueues(root, config);
assertEquals("root weight", "1.0w",
config.get(PREFIX + "root.capacity"));
assertEquals("root.a weight", "1.0w",
config.get(PREFIX + "root.a.capacity"));
assertEquals("Number of properties", 2,
assertEquals("Number of properties", 3,
config.getPropsWithPrefix(PREFIX).size());
}
@ -65,8 +69,10 @@ public class TestWeightToWeightConverter extends WeightConverterTestBase {
converter.convertWeightsForChildQueues(root, config);
assertEquals("Number of properties", 4,
assertEquals("Number of properties", 5,
config.getPropsWithPrefix(PREFIX).size());
assertEquals("root weight", "1.0w",
config.get(PREFIX + "root.capacity"));
assertEquals("root.a weight", "1.0w",
config.get(PREFIX + "root.a.capacity"));
assertEquals("root.b weight", "2.0w",
@ -90,7 +96,7 @@ public class TestWeightToWeightConverter extends WeightConverterTestBase {
FSQueue root = createParent(new ArrayList<>());
converter.convertWeightsForChildQueues(root, config);
assertEquals("Number of properties", 1,
assertEquals("Number of properties", 2,
config.getPropsWithPrefix(PREFIX).size());
assertTrue("root autocreate v2 enabled",
config.getBoolean(PREFIX + "root.auto-queue-creation-v2.enabled",