From 5bed5bb829abbcbfd5e4f2707c0836d814603b72 Mon Sep 17 00:00:00 2001 From: Sanford Ryza Date: Fri, 11 Oct 2013 22:13:57 +0000 Subject: [PATCH] YARN-1044. used/min/max resources do not display info in the scheduler page (Sangjin Lee via Sandy Ryza) git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1531447 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-yarn-project/CHANGES.txt | 3 +++ .../resourcemanager/webapp/CapacitySchedulerPage.java | 2 +- .../resourcemanager/webapp/FairSchedulerPage.java | 10 +++++++--- .../webapp/dao/CapacitySchedulerQueueInfo.java | 6 ------ .../webapp/TestRMWebServicesCapacitySched.java | 10 ++-------- 5 files changed, 13 insertions(+), 18 deletions(-) diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index 98487c9e0f..0fa03143d2 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -105,6 +105,9 @@ Release 2.2.1 - UNRELEASED YARN-1265. Fair Scheduler chokes on unhealthy node reconnect (Sandy Ryza) + YARN-1044. used/min/max resources do not display info in the scheduler page + (Sangjin Lee via Sandy Ryza) + Release 2.2.0 - 2013-10-13 INCOMPATIBLE CHANGES diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/CapacitySchedulerPage.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/CapacitySchedulerPage.java index 900c1a62dd..a3e48b3155 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/CapacitySchedulerPage.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/CapacitySchedulerPage.java @@ -109,7 +109,7 @@ protected void render(Block html) { _("Absolute Used Capacity:", percent(lqinfo.getAbsoluteUsedCapacity() / 100)). _("Absolute Capacity:", percent(lqinfo.getAbsoluteCapacity() / 100)). _("Absolute Max Capacity:", percent(lqinfo.getAbsoluteMaxCapacity() / 100)). - _("Used Resources:", StringEscapeUtils.escapeHtml(lqinfo.getUsedResources().toString())). + _("Used Resources:", StringEscapeUtils.escapeHtml(lqinfo.getResourcesUsed().toString())). _("Num Schedulable Applications:", Integer.toString(lqinfo.getNumActiveApplications())). _("Num Non-Schedulable Applications:", Integer.toString(lqinfo.getNumPendingApplications())). _("Num Containers:", Integer.toString(lqinfo.getNumContainers())). diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/FairSchedulerPage.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/FairSchedulerPage.java index c5065b121b..69478f8517 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/FairSchedulerPage.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/FairSchedulerPage.java @@ -22,6 +22,7 @@ import java.util.Collection; +import org.apache.commons.lang.StringEscapeUtils; import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairScheduler; import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.FairSchedulerInfo; @@ -64,11 +65,14 @@ static class LeafQueueBlock extends HtmlBlock { @Override protected void render(Block html) { ResponseInfo ri = info("\'" + qinfo.getQueueName() + "\' Queue Status"). - _("Used Resources:", qinfo.getUsedResources().toString()). + _("Used Resources:", StringEscapeUtils.escapeHtml( + qinfo.getUsedResources().toString())). _("Num Active Applications:", qinfo.getNumActiveApplications()). _("Num Pending Applications:", qinfo.getNumPendingApplications()). - _("Min Resources:", qinfo.getMinResources().toString()). - _("Max Resources:", qinfo.getMaxResources().toString()); + _("Min Resources:", StringEscapeUtils.escapeHtml( + qinfo.getMinResources().toString())). + _("Max Resources:", StringEscapeUtils.escapeHtml( + qinfo.getMaxResources().toString())); int maxApps = qinfo.getMaxApplications(); if (maxApps < Integer.MAX_VALUE) { ri._("Max Running Applications:", qinfo.getMaxApplications()); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/dao/CapacitySchedulerQueueInfo.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/dao/CapacitySchedulerQueueInfo.java index 2cfa660a35..ac16ce0e63 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/dao/CapacitySchedulerQueueInfo.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/dao/CapacitySchedulerQueueInfo.java @@ -44,7 +44,6 @@ public class CapacitySchedulerQueueInfo { protected float absoluteMaxCapacity; protected float absoluteUsedCapacity; protected int numApplications; - protected String usedResources; protected String queueName; protected QueueState state; protected CapacitySchedulerQueueInfoList queues; @@ -67,7 +66,6 @@ public class CapacitySchedulerQueueInfo { absoluteMaxCapacity = cap(q.getAbsoluteMaximumCapacity(), 0f, 1f) * 100; absoluteUsedCapacity = cap(q.getAbsoluteUsedCapacity(), 0f, 1f) * 100; numApplications = q.getNumApplications(); - usedResources = q.getUsedResources().toString(); queueName = q.getQueueName(); state = q.getState(); resourcesUsed = new ResourceInfo(q.getUsedResources()); @@ -101,10 +99,6 @@ public int getNumApplications() { return numApplications; } - public String getUsedResources() { - return usedResources; - } - public String getQueueName() { return this.queueName; } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebServicesCapacitySched.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebServicesCapacitySched.java index 490f540fba..e57e5cfea8 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebServicesCapacitySched.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebServicesCapacitySched.java @@ -75,7 +75,6 @@ private class QueueInfo { float absoluteMaxCapacity; float absoluteUsedCapacity; int numApplications; - String usedResources; String queueName; String state; } @@ -283,8 +282,6 @@ public void verifySubQueueXML(Element qElem, String q, WebServicesTestUtils.getXmlFloat(qElem, "absoluteUsedCapacity"); qi.numApplications = WebServicesTestUtils.getXmlInt(qElem, "numApplications"); - qi.usedResources = - WebServicesTestUtils.getXmlString(qElem, "usedResources"); qi.queueName = WebServicesTestUtils.getXmlString(qElem, "queueName"); qi.state = WebServicesTestUtils.getXmlString(qElem, "state"); verifySubQueueGeneric(q, qi, parentAbsCapacity, parentAbsMaxCapacity); @@ -360,10 +357,10 @@ private void verifyClusterSchedulerGeneric(String type, float usedCapacity, private void verifySubQueue(JSONObject info, String q, float parentAbsCapacity, float parentAbsMaxCapacity) throws JSONException, Exception { - int numExpectedElements = 12; + int numExpectedElements = 11; boolean isParentQueue = true; if (!info.has("queues")) { - numExpectedElements = 22; + numExpectedElements = 21; isParentQueue = false; } assertEquals("incorrect number of elements", numExpectedElements, info.length()); @@ -376,7 +373,6 @@ private void verifySubQueue(JSONObject info, String q, qi.absoluteMaxCapacity = (float) info.getDouble("absoluteMaxCapacity"); qi.absoluteUsedCapacity = (float) info.getDouble("absoluteUsedCapacity"); qi.numApplications = info.getInt("numApplications"); - qi.usedResources = info.getString("usedResources"); qi.queueName = info.getString("queueName"); qi.state = info.getString("state"); @@ -431,8 +427,6 @@ private void verifySubQueueGeneric(String q, QueueInfo info, assertEquals("absoluteUsedCapacity doesn't match", 0, info.absoluteUsedCapacity, 1e-3f); assertEquals("numApplications doesn't match", 0, info.numApplications); - assertTrue("usedResources doesn't match ", - info.usedResources.matches("")); assertTrue("queueName doesn't match, got: " + info.queueName + " expected: " + q, qshortName.matches(info.queueName)); assertTrue("state doesn't match",