YARN-4034. Render cluster Max Priority in scheduler metrics in RM web UI. Contributed by Rohith Sharma K S

(cherry picked from commit 6c6e734f0b)
This commit is contained in:
Jian He 2015-09-17 14:55:50 +08:00
parent d5936aa48c
commit 5d2f85021f
9 changed files with 31 additions and 3 deletions

View File

@ -139,6 +139,9 @@ Release 2.8.0 - UNRELEASED
command line. (Inigo Goiri, Kenji Kikushima and Junping Du
via junping_du)
YARN-4034. Render cluster Max Priority in scheduler metrics in RM web
UI. (Rohith Sharma K S via jianhe)
IMPROVEMENTS
YARN-644. Basic null check is not performed on passed in arguments before

View File

@ -713,6 +713,7 @@ public abstract class AbstractYarnScheduler
// specific scheduler.
}
@Override
public Priority getMaxClusterLevelAppPriority() {
return maxClusterLevelAppPriority;
}

View File

@ -343,4 +343,11 @@ public interface YarnScheduler extends EventHandler<SchedulerEvent> {
*/
List<ResourceRequest> getPendingResourceRequestsForAttempt(
ApplicationAttemptId attemptId);
/**
* Get cluster max priority.
*
* @return maximum priority of cluster
*/
Priority getMaxClusterLevelAppPriority();
}

View File

@ -158,7 +158,9 @@ class CapacitySchedulerPage extends RmView {
_("Default Node Label Expression:",
lqinfo.getDefaultNodeLabelExpression() == null
? NodeLabel.DEFAULT_NODE_LABEL_PARTITION
: lqinfo.getDefaultNodeLabelExpression());
: lqinfo.getDefaultNodeLabelExpression()).
_("Default Application Priority:",
Integer.toString(lqinfo.getDefaultApplicationPriority()));
}
}

View File

@ -167,6 +167,8 @@ public class MetricsOverviewTable extends HtmlBlock {
th().$class("ui-state-default")._("Scheduling Resource Type")._().
th().$class("ui-state-default")._("Minimum Allocation")._().
th().$class("ui-state-default")._("Maximum Allocation")._().
th().$class("ui-state-default")
._("Maximum Cluster Application Priority")._().
_().
_().
tbody().$class("ui-widget-content").
@ -175,6 +177,7 @@ public class MetricsOverviewTable extends HtmlBlock {
td(String.valueOf(schedulerInfo.getSchedulerResourceTypes())).
td(schedulerInfo.getMinAllocation().toString()).
td(schedulerInfo.getMaxAllocation().toString()).
td(String.valueOf(schedulerInfo.getMaxClusterLevelAppPriority())).
_().
_()._();

View File

@ -41,6 +41,7 @@ public class CapacitySchedulerLeafQueueInfo extends CapacitySchedulerQueueInfo {
protected ResourceInfo userAMResourceLimit;
protected boolean preemptionDisabled;
protected String defaultNodeLabelExpression;
protected int defaultPriority;
@XmlTransient
protected String orderingPolicyInfo;
@ -64,6 +65,7 @@ public class CapacitySchedulerLeafQueueInfo extends CapacitySchedulerQueueInfo {
preemptionDisabled = q.getPreemptionDisabled();
orderingPolicyInfo = q.getOrderingPolicy().getInfo();
defaultNodeLabelExpression = q.getDefaultNodeLabelExpression();
defaultPriority = q.getDefaultApplicationPriority().getPriority();
}
public int getNumActiveApplications() {
@ -122,4 +124,8 @@ public class CapacitySchedulerLeafQueueInfo extends CapacitySchedulerQueueInfo {
public String getDefaultNodeLabelExpression() {
return defaultNodeLabelExpression;
}
public int getDefaultApplicationPriority() {
return defaultPriority;
}
}

View File

@ -38,6 +38,7 @@ public class SchedulerInfo {
protected ResourceInfo minAllocResource;
protected ResourceInfo maxAllocResource;
protected EnumSet<SchedulerResourceTypes> schedulingResourceTypes;
protected int maximumClusterPriority;
public SchedulerInfo() {
} // JAXB needs this
@ -55,6 +56,8 @@ public class SchedulerInfo {
this.minAllocResource = new ResourceInfo(rs.getMinimumResourceCapability());
this.maxAllocResource = new ResourceInfo(rs.getMaximumResourceCapability());
this.schedulingResourceTypes = rs.getSchedulingResourceTypes();
this.maximumClusterPriority =
rs.getMaxClusterLevelAppPriority().getPriority();
}
public String getSchedulerType() {
@ -73,4 +76,7 @@ public class SchedulerInfo {
return this.schedulingResourceTypes.toString();
}
public int getMaxClusterLevelAppPriority() {
return this.maximumClusterPriority;
}
}

View File

@ -48,7 +48,7 @@ public class TestNodesPage {
// Number of Actual Table Headers for NodesPage.NodesBlock might change in
// future. In that case this value should be adjusted to the new value.
final int numberOfThInMetricsTable = 21;
final int numberOfThInMetricsTable = 22;
final int numberOfActualTableHeaders = 13;
private Injector injector;

View File

@ -352,7 +352,7 @@ public class TestRMWebServicesCapacitySched extends JerseyTestBase {
int numExpectedElements = 16;
boolean isParentQueue = true;
if (!info.has("queues")) {
numExpectedElements = 28;
numExpectedElements = 29;
isParentQueue = false;
}
assertEquals("incorrect number of elements", numExpectedElements, info.length());