Skip to content

Commit 5aa9866

Browse files
YARN-10615. Fix Auto Queue Creation hierarchy construction to use queue path instead of short queue name. Contributed by Andras Gyori
1 parent c19326c commit 5aa9866

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/CapacitySchedulerAutoQueueHandler.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,15 @@ public LeafQueue autoCreateQueue(ApplicationPlacementContext queue)
5555
List<ApplicationPlacementContext> parentsToCreate = new ArrayList<>();
5656

5757
ApplicationPlacementContext queueCandidateContext = parentContext;
58-
CSQueue existingQueueCandidate = getQueue(queueCandidateContext.getQueue());
58+
CSQueue existingQueueCandidate = getQueue(
59+
queueCandidateContext.getFullQueuePath());
5960

6061
while (existingQueueCandidate == null) {
6162
parentsToCreate.add(queueCandidateContext);
6263
queueCandidateContext = CSQueueUtils.extractQueuePath(
6364
queueCandidateContext.getParentQueue());
64-
existingQueueCandidate = getQueue(queueCandidateContext.getQueue());
65+
existingQueueCandidate = getQueue(
66+
queueCandidateContext.getFullQueuePath());
6567
}
6668

6769
// Reverse the collection to to represent the hierarchy to be created

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestCapacitySchedulerNewQueueAutoCreation.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,25 @@ public void testAutoCreateQueueUserLimitDisabled() throws Exception {
525525
user0LeafQueue.getMinimumAllocation()).getMemorySize(), 1e-6);
526526
}
527527

528+
@Test
529+
public void testAutoCreateQueueIfAmbiguousQueueNames() throws Exception {
530+
startScheduler();
531+
532+
AbstractCSQueue b = (AbstractCSQueue) cs.getQueue("root.b");
533+
Assert.assertFalse(b.isDynamicQueue());
534+
535+
createQueue("root.a.b.b");
536+
537+
AbstractCSQueue bAutoParent = (AbstractCSQueue) cs.getQueue("root.a.b");
538+
Assert.assertTrue(bAutoParent.isDynamicQueue());
539+
Assert.assertTrue(bAutoParent.hasChildQueues());
540+
541+
AbstractCSQueue bAutoLeafQueue =
542+
(AbstractCSQueue) cs.getQueue("root.a.b.b");
543+
Assert.assertTrue(bAutoLeafQueue.isDynamicQueue());
544+
Assert.assertFalse(bAutoLeafQueue.hasChildQueues());
545+
}
546+
528547
private LeafQueue createQueue(String queuePath) throws YarnException {
529548
return autoQueueHandler.autoCreateQueue(
530549
CSQueueUtils.extractQueuePath(queuePath));

0 commit comments

Comments
 (0)