YARN-10615. Fix Auto Queue Creation hierarchy construction to use queue path instead of short queue name. Contributed by Andras Gyori
This commit is contained in:
parent
c19326c051
commit
5aa9866ec2
@ -55,13 +55,15 @@ public class CapacitySchedulerAutoQueueHandler {
|
|||||||
List<ApplicationPlacementContext> parentsToCreate = new ArrayList<>();
|
List<ApplicationPlacementContext> parentsToCreate = new ArrayList<>();
|
||||||
|
|
||||||
ApplicationPlacementContext queueCandidateContext = parentContext;
|
ApplicationPlacementContext queueCandidateContext = parentContext;
|
||||||
CSQueue existingQueueCandidate = getQueue(queueCandidateContext.getQueue());
|
CSQueue existingQueueCandidate = getQueue(
|
||||||
|
queueCandidateContext.getFullQueuePath());
|
||||||
|
|
||||||
while (existingQueueCandidate == null) {
|
while (existingQueueCandidate == null) {
|
||||||
parentsToCreate.add(queueCandidateContext);
|
parentsToCreate.add(queueCandidateContext);
|
||||||
queueCandidateContext = CSQueueUtils.extractQueuePath(
|
queueCandidateContext = CSQueueUtils.extractQueuePath(
|
||||||
queueCandidateContext.getParentQueue());
|
queueCandidateContext.getParentQueue());
|
||||||
existingQueueCandidate = getQueue(queueCandidateContext.getQueue());
|
existingQueueCandidate = getQueue(
|
||||||
|
queueCandidateContext.getFullQueuePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reverse the collection to to represent the hierarchy to be created
|
// Reverse the collection to to represent the hierarchy to be created
|
||||||
|
@ -525,6 +525,25 @@ public class TestCapacitySchedulerNewQueueAutoCreation
|
|||||||
user0LeafQueue.getMinimumAllocation()).getMemorySize(), 1e-6);
|
user0LeafQueue.getMinimumAllocation()).getMemorySize(), 1e-6);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testAutoCreateQueueIfAmbiguousQueueNames() throws Exception {
|
||||||
|
startScheduler();
|
||||||
|
|
||||||
|
AbstractCSQueue b = (AbstractCSQueue) cs.getQueue("root.b");
|
||||||
|
Assert.assertFalse(b.isDynamicQueue());
|
||||||
|
|
||||||
|
createQueue("root.a.b.b");
|
||||||
|
|
||||||
|
AbstractCSQueue bAutoParent = (AbstractCSQueue) cs.getQueue("root.a.b");
|
||||||
|
Assert.assertTrue(bAutoParent.isDynamicQueue());
|
||||||
|
Assert.assertTrue(bAutoParent.hasChildQueues());
|
||||||
|
|
||||||
|
AbstractCSQueue bAutoLeafQueue =
|
||||||
|
(AbstractCSQueue) cs.getQueue("root.a.b.b");
|
||||||
|
Assert.assertTrue(bAutoLeafQueue.isDynamicQueue());
|
||||||
|
Assert.assertFalse(bAutoLeafQueue.hasChildQueues());
|
||||||
|
}
|
||||||
|
|
||||||
private LeafQueue createQueue(String queuePath) throws YarnException {
|
private LeafQueue createQueue(String queuePath) throws YarnException {
|
||||||
return autoQueueHandler.autoCreateQueue(
|
return autoQueueHandler.autoCreateQueue(
|
||||||
CSQueueUtils.extractQueuePath(queuePath));
|
CSQueueUtils.extractQueuePath(queuePath));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user