Skip to content

Commit d0a39c5

Browse files
committed
Make the default-application-priority attribute of queues globally configurable
1 parent 171ad67 commit d0a39c5

File tree

2 files changed

+28
-4
lines changed

2 files changed

+28
-4
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/CapacitySchedulerConfiguration.java

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,10 @@ public class CapacitySchedulerConfiguration extends ReservationSchedulerConfigur
334334
@Private
335335
public static final Integer DEFAULT_CONFIGURATION_APPLICATION_PRIORITY = 0;
336336

337+
@Private
338+
public static final String DEFAULT_APPLICATION_PRIORITY_GLOBAL =
339+
PREFIX + "default-application-priority";
340+
337341
@Private
338342
public static final String AVERAGE_CAPACITY = "average-capacity";
339343

@@ -1815,11 +1819,17 @@ public Priority getClusterLevelApplicationMaxPriority() {
18151819
YarnConfiguration.DEFAULT_CLUSTER_LEVEL_APPLICATION_PRIORITY));
18161820
}
18171821

1818-
public Integer getDefaultApplicationPriorityConfPerQueue(QueuePath queue) {
1819-
Integer defaultPriority = getInt(getQueuePrefix(queue)
1820-
+ DEFAULT_APPLICATION_PRIORITY,
1822+
/**
1823+
* Get the global default application priority setting.
1824+
* @return global default priority or DEFAULT_CONFIGURATION_APPLICATION_PRIORITY if not set */
1825+
private Integer getDefaultApplicationPriority() {
1826+
return getInt(DEFAULT_APPLICATION_PRIORITY_GLOBAL,
18211827
DEFAULT_CONFIGURATION_APPLICATION_PRIORITY);
1822-
return defaultPriority;
1828+
}
1829+
1830+
public Integer getDefaultApplicationPriorityConfPerQueue(QueuePath queue) {
1831+
return getInt(getQueuePrefix(queue) + DEFAULT_APPLICATION_PRIORITY,
1832+
getDefaultApplicationPriority());
18231833
}
18241834

18251835
@VisibleForTesting

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,20 @@ public void testLimitsComputation() throws Exception {
384384
csConf.getMaximumApplicationMasterResourcePerQueuePercent(
385385
queue.getQueuePathObject()), epsilon);
386386

387+
assertEquals(
388+
(int)CapacitySchedulerConfiguration.DEFAULT_CONFIGURATION_APPLICATION_PRIORITY,
389+
(int)csConf.getDefaultApplicationPriorityConfPerQueue(
390+
queue.getQueuePathObject())
391+
);
392+
393+
csConf.setInt(PREFIX + queue.getQueuePath()
394+
+ ".default-application-priority", 6);
395+
396+
assertEquals((int) 6,
397+
(int) csConf.getDefaultApplicationPriorityConfPerQueue(
398+
queue.getQueuePathObject())
399+
);
400+
387401
assertThat(queue.calculateAndGetAMResourceLimit()).isEqualTo(
388402
Resource.newInstance(800 * GB, 1));
389403
assertThat(queue.getUserAMResourceLimit()).isEqualTo(

0 commit comments

Comments
 (0)