YARN-11071. AutoCreatedQueueTemplate incorrect wildcard level. Contributed by Tamas Domok

This commit is contained in:
Szilard Nemeth 2022-02-17 19:03:44 +01:00
parent 5f6a294fab
commit d58c10c3a5
2 changed files with 12 additions and 2 deletions

View File

@ -170,8 +170,7 @@ private void setTemplateConfigEntries(CapacitySchedulerConfiguration configurati
int wildcardLevel = 0; int wildcardLevel = 0;
// root can not be wildcarded // root can not be wildcarded
// MAX_WILDCARD_LEVEL will be configurable in the future // MAX_WILDCARD_LEVEL will be configurable in the future
int supportedWildcardLevel = Math.min(queuePathMaxIndex - 1, int supportedWildcardLevel = Math.min(queuePathMaxIndex, MAX_WILDCARD_LEVEL);
MAX_WILDCARD_LEVEL);
// Allow root to have template properties // Allow root to have template properties
if (queuePath.isRoot()) { if (queuePath.isRoot()) {
supportedWildcardLevel = 0; supportedWildcardLevel = 0;

View File

@ -88,6 +88,17 @@ public void testIgnoredWhenNoParent() {
conf.getNonLabeledQueueWeight(ROOT), 10e-6); conf.getNonLabeledQueueWeight(ROOT), 10e-6);
} }
@Test
public void testWildcardAfterRoot() {
conf.set(getTemplateKey("root.*", "acl_submit_applications"), "user");
AutoCreatedQueueTemplate template =
new AutoCreatedQueueTemplate(conf, new QueuePath("root.a"));
template.setTemplateEntriesForChild(conf, "root.a");
Assert.assertEquals("acl_submit_applications is set", "user",
template.getTemplateProperties().get("acl_submit_applications"));
}
@Test @Test
public void testTemplatePrecedence() { public void testTemplatePrecedence() {
conf.set(getTemplateKey("root.a.b", "capacity"), "6w"); conf.set(getTemplateKey("root.a.b", "capacity"), "6w");