Skip to content

Commit 593af87

Browse files
YARN-10108. FS-CS converter: nestedUserQueue with default rule results in invalid queue mapping. Contributed by Gergely Pollak
1 parent fb030f3 commit 593af87

File tree

2 files changed

+33
-2
lines changed

2 files changed

+33
-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/CapacityScheduler.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -992,12 +992,14 @@ private void addApplication(ApplicationId applicationId, String queueName,
992992
// not auto-created above, then its parent queue should match
993993
// the parent queue specified in queue mapping
994994
} else if (!queue.getParent().getQueueShortName().equals(
995-
placementContext.getParentQueue())) {
995+
placementContext.getParentQueue())
996+
&& !queue.getParent().getQueuePath().equals(
997+
placementContext.getParentQueue())) {
996998
String message =
997999
"Auto created Leaf queue " + placementContext.getQueue() + " "
9981000
+ "already exists under queue : " + queue
9991001
.getParent().getQueueShortName()
1000-
+ ".But Queue mapping configuration " +
1002+
+ ". But Queue mapping configuration " +
10011003
CapacitySchedulerConfiguration.QUEUE_MAPPING + " has been "
10021004
+ "updated to a different parent queue : "
10031005
+ placementContext.getParentQueue()

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

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,35 @@ public void testAutoCreateLeafQueueCreation() throws Exception {
162162
}
163163
}
164164

165+
@Test(timeout = 20000)
166+
public void testAutoCreateLeafQueueCreationUsingFullParentPath()
167+
throws Exception {
168+
169+
try {
170+
setupGroupQueueMappings("root.d", cs.getConfiguration(), "%user");
171+
cs.reinitialize(cs.getConfiguration(), mockRM.getRMContext());
172+
173+
submitApp(mockRM, cs.getQueue("d"), TEST_GROUPUSER, TEST_GROUPUSER, 1, 1);
174+
AutoCreatedLeafQueue autoCreatedLeafQueue =
175+
(AutoCreatedLeafQueue) cs.getQueue(TEST_GROUPUSER);
176+
ManagedParentQueue parentQueue = (ManagedParentQueue) cs.getQueue("d");
177+
assertEquals(parentQueue, autoCreatedLeafQueue.getParent());
178+
179+
Map<String, Float> expectedChildQueueAbsCapacity =
180+
new HashMap<String, Float>() {{
181+
put(NO_LABEL, 0.02f);
182+
}};
183+
184+
validateInitialQueueEntitlement(parentQueue, TEST_GROUPUSER,
185+
expectedChildQueueAbsCapacity,
186+
new HashSet<String>() {{ add(NO_LABEL); }});
187+
188+
} finally {
189+
cleanupQueue(USER0);
190+
cleanupQueue(TEST_GROUPUSER);
191+
}
192+
}
193+
165194
@Test
166195
public void testReinitializeStoppedAutoCreatedLeafQueue() throws Exception {
167196
try {

0 commit comments

Comments
 (0)