YARN-11461. fix NPE in determineMissingParents (auto queue creation / CS). (#5506)
Change-Id: Iaaaf43a545588eaff8a0a20f6f3c27258a45f390
This commit is contained in:
parent
5cf62d1498
commit
69748aae32
@ -576,6 +576,11 @@ public List<String> determineMissingParents(
|
|||||||
firstExistingStaticParent = getQueue(parentCandidate.toString());
|
firstExistingStaticParent = getQueue(parentCandidate.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (firstExistingParent == null || firstExistingStaticParent == null) {
|
||||||
|
throw new SchedulerDynamicEditException("Could not auto-create queue "
|
||||||
|
+ queue + " parent queue does not exist.");
|
||||||
|
}
|
||||||
|
|
||||||
int maximumDepthOfStaticParent = csContext.getConfiguration().getMaximumAutoCreatedQueueDepth(
|
int maximumDepthOfStaticParent = csContext.getConfiguration().getMaximumAutoCreatedQueueDepth(
|
||||||
firstExistingStaticParent.getQueuePath());
|
firstExistingStaticParent.getQueuePath());
|
||||||
if (firstStaticParentDistance > maximumDepthOfStaticParent) {
|
if (firstStaticParentDistance > maximumDepthOfStaticParent) {
|
||||||
|
@ -1251,6 +1251,17 @@ public void testParentQueueDynamicChildRemoval() throws Exception {
|
|||||||
Assert.assertNull("root.e.e1-auto should have been removed", eAuto);
|
Assert.assertNull("root.e.e1-auto should have been removed", eAuto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test()
|
||||||
|
public void testAutoCreateInvalidParent() throws Exception {
|
||||||
|
startScheduler();
|
||||||
|
Assert.assertThrows(SchedulerDynamicEditException.class,
|
||||||
|
() -> createQueue("invalid.queue"));
|
||||||
|
Assert.assertThrows(SchedulerDynamicEditException.class,
|
||||||
|
() -> createQueue("invalid.queue.longer"));
|
||||||
|
Assert.assertThrows(SchedulerDynamicEditException.class,
|
||||||
|
() -> createQueue("invalidQueue"));
|
||||||
|
}
|
||||||
|
|
||||||
protected AbstractLeafQueue createQueue(String queuePath) throws YarnException,
|
protected AbstractLeafQueue createQueue(String queuePath) throws YarnException,
|
||||||
IOException {
|
IOException {
|
||||||
return autoQueueHandler.createQueue(new QueuePath(queuePath));
|
return autoQueueHandler.createQueue(new QueuePath(queuePath));
|
||||||
|
Loading…
Reference in New Issue
Block a user