FS-CS converter: nestedUserQueue with default rule results in invalid queue mapping. Contributed by Gergely Pollak

(cherry picked from commit ac4540dd8e)
This commit is contained in:
Szilard Nemeth 2020-05-21 13:11:44 +02:00
parent 4d30c395f7
commit 9ce913a7bf
2 changed files with 33 additions and 2 deletions

View File

@ -989,12 +989,14 @@ public class CapacityScheduler extends
// not auto-created above, then its parent queue should match // not auto-created above, then its parent queue should match
// the parent queue specified in queue mapping // the parent queue specified in queue mapping
} else if (!queue.getParent().getQueueShortName().equals( } else if (!queue.getParent().getQueueShortName().equals(
placementContext.getParentQueue())) { placementContext.getParentQueue())
&& !queue.getParent().getQueuePath().equals(
placementContext.getParentQueue())) {
String message = String message =
"Auto created Leaf queue " + placementContext.getQueue() + " " "Auto created Leaf queue " + placementContext.getQueue() + " "
+ "already exists under queue : " + queue + "already exists under queue : " + queue
.getParent().getQueueShortName() .getParent().getQueueShortName()
+ ".But Queue mapping configuration " + + ". But Queue mapping configuration " +
CapacitySchedulerConfiguration.QUEUE_MAPPING + " has been " CapacitySchedulerConfiguration.QUEUE_MAPPING + " has been "
+ "updated to a different parent queue : " + "updated to a different parent queue : "
+ placementContext.getParentQueue() + placementContext.getParentQueue()

View File

@ -162,6 +162,35 @@ public class TestCapacitySchedulerAutoQueueCreation
} }
} }
@Test(timeout = 20000)
public void testAutoCreateLeafQueueCreationUsingFullParentPath()
throws Exception {
try {
setupGroupQueueMappings("root.d", cs.getConfiguration(), "%user");
cs.reinitialize(cs.getConfiguration(), mockRM.getRMContext());
submitApp(mockRM, cs.getQueue("d"), TEST_GROUPUSER, TEST_GROUPUSER, 1, 1);
AutoCreatedLeafQueue autoCreatedLeafQueue =
(AutoCreatedLeafQueue) cs.getQueue(TEST_GROUPUSER);
ManagedParentQueue parentQueue = (ManagedParentQueue) cs.getQueue("d");
assertEquals(parentQueue, autoCreatedLeafQueue.getParent());
Map<String, Float> expectedChildQueueAbsCapacity =
new HashMap<String, Float>() {{
put(NO_LABEL, 0.02f);
}};
validateInitialQueueEntitlement(parentQueue, TEST_GROUPUSER,
expectedChildQueueAbsCapacity,
new HashSet<String>() {{ add(NO_LABEL); }});
} finally {
cleanupQueue(USER0);
cleanupQueue(TEST_GROUPUSER);
}
}
@Test @Test
public void testReinitializeStoppedAutoCreatedLeafQueue() throws Exception { public void testReinitializeStoppedAutoCreatedLeafQueue() throws Exception {
try { try {