Skip to content

Commit b605838

Browse files
committed
added ulf to -1 only for those queues in which auto-queue-creation is disabled
Change-Id: I99f62b9c4f40027689f2953bb4be946e23261ae5
1 parent 27aa5f8 commit b605838

File tree

2 files changed

+22
-9
lines changed

2 files changed

+22
-9
lines changed

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/converter/FSConfigToCSConfigConverter.java

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.converter;
1818

19+
import static org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacitySchedulerConfiguration.DOT;
1920
import static org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacitySchedulerConfiguration.PREFIX;
2021
import static org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacitySchedulerConfiguration.MAPPING_RULE_FORMAT;
2122
import static org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacitySchedulerConfiguration.MAPPING_RULE_JSON;
@@ -30,6 +31,7 @@
3031
import java.io.IOException;
3132
import java.io.OutputStream;
3233
import java.nio.charset.StandardCharsets;
34+
import java.util.Collection;
3335
import java.util.List;
3436
import java.util.Map;
3537

@@ -49,6 +51,7 @@
4951
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.AllocationConfiguration;
5052
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.AllocationConfigurationException;
5153
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.ConfigurableResource;
54+
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSLeafQueue;
5255
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSParentQueue;
5356
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSQueue;
5457
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairScheduler;
@@ -292,11 +295,11 @@ private void convertYarnSiteXml(Configuration inputYarnSiteConfig) {
292295

293296
private void convertCapacitySchedulerXml(FairScheduler fs) {
294297
FSParentQueue rootQueue = fs.getQueueManager().getRootQueue();
298+
Collection<FSLeafQueue> fsLeafQueue = fs.getQueueManager().getLeafQueues();
295299
emitDefaultQueueMaxParallelApplications();
296300
emitDefaultUserMaxParallelApplications();
297301
emitUserMaxParallelApplications();
298302
emitDefaultMaxAMShare();
299-
emitDefaultUserLimitFactor();
300303
emitDisablePreemptionForObserveOnlyMode();
301304

302305
FSQueueConverter queueConverter = FSQueueConverterBuilder.create()
@@ -312,6 +315,7 @@ private void convertCapacitySchedulerXml(FairScheduler fs) {
312315
.withPercentages(usePercentages)
313316
.build();
314317

318+
emitDefaultUserLimitFactor(fsLeafQueue);
315319
queueConverter.convertQueueHierarchy(rootQueue);
316320
emitACLs(fs);
317321
}
@@ -415,11 +419,17 @@ private void emitDefaultMaxAMShare() {
415419
}
416420
}
417421

418-
private void emitDefaultUserLimitFactor() {
419-
capacitySchedulerConfig.setFloat(
420-
CapacitySchedulerConfiguration.
421-
PREFIX + "root.default." + USER_LIMIT_FACTOR,
422-
-1.0f);
422+
private void emitDefaultUserLimitFactor(Collection<FSLeafQueue> fsLeafQueue) {
423+
fsLeafQueue
424+
.forEach((leafQueue) -> {
425+
if (!capacitySchedulerConfig.
426+
isAutoQueueCreationV2Enabled(leafQueue.getName())) {
427+
capacitySchedulerConfig.setFloat(
428+
CapacitySchedulerConfiguration.
429+
PREFIX + leafQueue.getName() + DOT + USER_LIMIT_FACTOR,
430+
-1.0f);
431+
}
432+
});
423433
}
424434

425435
private void emitDisablePreemptionForObserveOnlyMode() {

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/converter/TestFSConfigToCSConfigConverter.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ public void testDefaultMaxAMShare() throws Exception {
183183
conf.get(PREFIX + "root.admins.alice.maximum-am-resource-percent"));
184184

185185
assertNull("root.users.joe maximum-am-resource-percent should be null",
186-
conf.get(PREFIX + "root.users.joe maximum-am-resource-percent"));
186+
conf.get(PREFIX + "root.users.joe.maximum-am-resource-percent"));
187187
}
188188

189189
@Test
@@ -196,8 +196,11 @@ public void testDefaultUserLimitFactor() throws Exception {
196196

197197
assertEquals("Default user limit factor", "-1.0", userLimitFactor);
198198

199-
assertNull("root.users.joe user-limit-factor should be null",
200-
conf.get(PREFIX + "root.users.joe user-limit-factor"));
199+
assertEquals("root.users.joe user-limit-factor", "-1.0",
200+
conf.get(PREFIX + "root.users.joe.user-limit-factor"));
201+
202+
assertEquals("root.admins.bob user-limit-factor", "-1.0",
203+
conf.get(PREFIX + "root.admins.bob.user-limit-factor"));
201204
}
202205

203206
@Test

0 commit comments

Comments
 (0)