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 command line. (Inigo Goiri, Kenji Kikushima and Junping Du
via 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 IMPROVEMENTS
YARN-644. Basic null check is not performed on passed in arguments before 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. // specific scheduler.
} }
@Override
public Priority getMaxClusterLevelAppPriority() { public Priority getMaxClusterLevelAppPriority() {
return maxClusterLevelAppPriority; return maxClusterLevelAppPriority;
} }

View File

@ -343,4 +343,11 @@ public interface YarnScheduler extends EventHandler<SchedulerEvent> {
*/ */
List<ResourceRequest> getPendingResourceRequestsForAttempt( List<ResourceRequest> getPendingResourceRequestsForAttempt(
ApplicationAttemptId attemptId); 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:", _("Default Node Label Expression:",
lqinfo.getDefaultNodeLabelExpression() == null lqinfo.getDefaultNodeLabelExpression() == null
? NodeLabel.DEFAULT_NODE_LABEL_PARTITION ? 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")._("Scheduling Resource Type")._().
th().$class("ui-state-default")._("Minimum Allocation")._(). th().$class("ui-state-default")._("Minimum Allocation")._().
th().$class("ui-state-default")._("Maximum Allocation")._(). th().$class("ui-state-default")._("Maximum Allocation")._().
th().$class("ui-state-default")
._("Maximum Cluster Application Priority")._().
_(). _().
_(). _().
tbody().$class("ui-widget-content"). tbody().$class("ui-widget-content").
@ -175,6 +177,7 @@ public class MetricsOverviewTable extends HtmlBlock {
td(String.valueOf(schedulerInfo.getSchedulerResourceTypes())). td(String.valueOf(schedulerInfo.getSchedulerResourceTypes())).
td(schedulerInfo.getMinAllocation().toString()). td(schedulerInfo.getMinAllocation().toString()).
td(schedulerInfo.getMaxAllocation().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 ResourceInfo userAMResourceLimit;
protected boolean preemptionDisabled; protected boolean preemptionDisabled;
protected String defaultNodeLabelExpression; protected String defaultNodeLabelExpression;
protected int defaultPriority;
@XmlTransient @XmlTransient
protected String orderingPolicyInfo; protected String orderingPolicyInfo;
@ -64,6 +65,7 @@ public class CapacitySchedulerLeafQueueInfo extends CapacitySchedulerQueueInfo {
preemptionDisabled = q.getPreemptionDisabled(); preemptionDisabled = q.getPreemptionDisabled();
orderingPolicyInfo = q.getOrderingPolicy().getInfo(); orderingPolicyInfo = q.getOrderingPolicy().getInfo();
defaultNodeLabelExpression = q.getDefaultNodeLabelExpression(); defaultNodeLabelExpression = q.getDefaultNodeLabelExpression();
defaultPriority = q.getDefaultApplicationPriority().getPriority();
} }
public int getNumActiveApplications() { public int getNumActiveApplications() {
@ -122,4 +124,8 @@ public class CapacitySchedulerLeafQueueInfo extends CapacitySchedulerQueueInfo {
public String getDefaultNodeLabelExpression() { public String getDefaultNodeLabelExpression() {
return defaultNodeLabelExpression; return defaultNodeLabelExpression;
} }
public int getDefaultApplicationPriority() {
return defaultPriority;
}
} }

View File

@ -38,6 +38,7 @@ public class SchedulerInfo {
protected ResourceInfo minAllocResource; protected ResourceInfo minAllocResource;
protected ResourceInfo maxAllocResource; protected ResourceInfo maxAllocResource;
protected EnumSet<SchedulerResourceTypes> schedulingResourceTypes; protected EnumSet<SchedulerResourceTypes> schedulingResourceTypes;
protected int maximumClusterPriority;
public SchedulerInfo() { public SchedulerInfo() {
} // JAXB needs this } // JAXB needs this
@ -55,6 +56,8 @@ public class SchedulerInfo {
this.minAllocResource = new ResourceInfo(rs.getMinimumResourceCapability()); this.minAllocResource = new ResourceInfo(rs.getMinimumResourceCapability());
this.maxAllocResource = new ResourceInfo(rs.getMaximumResourceCapability()); this.maxAllocResource = new ResourceInfo(rs.getMaximumResourceCapability());
this.schedulingResourceTypes = rs.getSchedulingResourceTypes(); this.schedulingResourceTypes = rs.getSchedulingResourceTypes();
this.maximumClusterPriority =
rs.getMaxClusterLevelAppPriority().getPriority();
} }
public String getSchedulerType() { public String getSchedulerType() {
@ -73,4 +76,7 @@ public class SchedulerInfo {
return this.schedulingResourceTypes.toString(); 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 // Number of Actual Table Headers for NodesPage.NodesBlock might change in
// future. In that case this value should be adjusted to the new value. // 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; final int numberOfActualTableHeaders = 13;
private Injector injector; private Injector injector;

View File

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