diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index 702d4d648c7..52667f1f342 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -698,6 +698,9 @@ Release 2.7.0 - UNRELEASED YARN-3287. Made TimelineClient put methods do as the correct login context. (Daryn Sharp and Jonathan Eagles via zjshen) + YARN-3300. Outstanding_resource_requests table should not be shown in AHS. + (Xuan Gong via jianhe) + Release 2.6.0 - 2014-11-18 INCOMPATIBLE CHANGES diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AppAttemptPage.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AppAttemptPage.java index 1e0a3421ae7..540f6e6bde9 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AppAttemptPage.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AppAttemptPage.java @@ -42,6 +42,8 @@ public class AppAttemptPage extends AHSView { set(DATATABLES_ID, "containers"); set(initID(DATATABLES, "containers"), WebPageUtils.containersTableInit()); setTableStyles(html, "containers", ".queue {width:6em}", ".ui {width:8em}"); + + set(YarnWebParams.WEB_UI_TYPE, YarnWebParams.APP_HISTORY_WEB_UI); } @Override diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/AppAttemptBlock.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/AppAttemptBlock.java index ea33f4f3f36..1bba4d8c4a4 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/AppAttemptBlock.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/AppAttemptBlock.java @@ -19,6 +19,11 @@ package org.apache.hadoop.yarn.server.webapp; import static org.apache.hadoop.yarn.util.StringHelper.join; import static org.apache.hadoop.yarn.webapp.YarnWebParams.APPLICATION_ATTEMPT_ID; +import static org.apache.hadoop.yarn.webapp.YarnWebParams.WEB_UI_TYPE; +import static org.apache.hadoop.yarn.webapp.view.JQueryUI._EVEN; +import static org.apache.hadoop.yarn.webapp.view.JQueryUI._INFO_WRAP; +import static org.apache.hadoop.yarn.webapp.view.JQueryUI._ODD; +import static org.apache.hadoop.yarn.webapp.view.JQueryUI._TH; import java.security.PrivilegedExceptionAction; import java.util.Collection; @@ -38,7 +43,9 @@ import org.apache.hadoop.yarn.api.records.YarnApplicationAttemptState; import org.apache.hadoop.yarn.server.webapp.dao.AppAttemptInfo; import org.apache.hadoop.yarn.server.webapp.dao.ContainerInfo; import org.apache.hadoop.yarn.util.ConverterUtils; +import org.apache.hadoop.yarn.webapp.YarnWebParams; import org.apache.hadoop.yarn.webapp.hamlet.Hamlet; +import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.DIV; import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.TABLE; import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.TBODY; import org.apache.hadoop.yarn.webapp.view.HtmlBlock; @@ -59,6 +66,7 @@ public class AppAttemptBlock extends HtmlBlock { @Override protected void render(Block html) { + String webUiType = $(WEB_UI_TYPE); String attemptid = $(APPLICATION_ATTEMPT_ID); if (attemptid.isEmpty()) { puts("Bad request: requires application attempt ID"); @@ -213,6 +221,45 @@ public class AppAttemptBlock extends HtmlBlock { ._("var containersTableData=" + containersTableData)._(); tbody._()._(); + + if (webUiType.equals(YarnWebParams.RM_WEB_UI)) { + createContainerLocalityTable(html); // TODO:YARN-3284 + } + } + + //TODO: YARN-3284 + //The containerLocality metrics will be exposed from AttemptReport + private void createContainerLocalityTable(Block html) { + int totalAllocatedContainers = 0; //TODO: YARN-3284 + int[][] localityStatistics = new int[0][0];//TODO:YARN-3284 + DIV div = html.div(_INFO_WRAP); + TABLE> table = + div.h3( + "Total Allocated Containers: " + + totalAllocatedContainers).h3("Each table cell" + + " represents the number of NodeLocal/RackLocal/OffSwitch containers" + + " satisfied by NodeLocal/RackLocal/OffSwitch resource requests.").table( + "#containerLocality"); + table. + tr(). + th(_TH, ""). + th(_TH, "Node Local Request"). + th(_TH, "Rack Local Request"). + th(_TH, "Off Switch Request"). + _(); + + String[] containersType = + { "Num Node Local Containers (satisfied by)", "Num Rack Local Containers (satisfied by)", + "Num Off Switch Containers (satisfied by)" }; + boolean odd = false; + for (int i = 0; i < localityStatistics.length; i++) { + table.tr((odd = !odd) ? _ODD : _EVEN).td(containersType[i]) + .td(String.valueOf(localityStatistics[i][0])) + .td(i == 0 ? "" : String.valueOf(localityStatistics[i][1])) + .td(i <= 1 ? "" : String.valueOf(localityStatistics[i][2]))._(); + } + table._(); + div._(); } private boolean hasAMContainer(ContainerId containerId, diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/AppBlock.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/AppBlock.java index 2db88aeec21..d4c20d49e70 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/AppBlock.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/AppBlock.java @@ -21,11 +21,7 @@ package org.apache.hadoop.yarn.server.webapp; import static org.apache.hadoop.yarn.util.StringHelper.join; import static org.apache.hadoop.yarn.webapp.YarnWebParams.APPLICATION_ID; import static org.apache.hadoop.yarn.webapp.YarnWebParams.WEB_UI_TYPE; -import static org.apache.hadoop.yarn.webapp.view.JQueryUI._EVEN; import static org.apache.hadoop.yarn.webapp.view.JQueryUI._INFO_WRAP; -import static org.apache.hadoop.yarn.webapp.view.JQueryUI._ODD; -import static org.apache.hadoop.yarn.webapp.view.JQueryUI._TH; - import java.security.PrivilegedExceptionAction; import java.util.Collection; import java.util.List; @@ -327,43 +323,9 @@ public class AppBlock extends HtmlBlock { tbody._()._(); - createContainerLocalityTable(html); //TODO:YARN-3284 - createResourceRequestsTable(html, null); //TODO:YARN-3284 - } - - //TODO: YARN-3284 - //The containerLocality metrics will be exposed from AttemptReport - private void createContainerLocalityTable(Block html) { - int totalAllocatedContainers = 0; //TODO: YARN-3284 - int[][] localityStatistics = new int[0][0];//TODO:YARN-3284 - DIV div = html.div(_INFO_WRAP); - TABLE> table = - div.h3( - "Total Allocated Containers: " - + totalAllocatedContainers).h3("Each table cell" - + " represents the number of NodeLocal/RackLocal/OffSwitch containers" - + " satisfied by NodeLocal/RackLocal/OffSwitch resource requests.").table( - "#containerLocality"); - table. - tr(). - th(_TH, ""). - th(_TH, "Node Local Request"). - th(_TH, "Rack Local Request"). - th(_TH, "Off Switch Request"). - _(); - - String[] containersType = - { "Num Node Local Containers (satisfied by)", "Num Rack Local Containers (satisfied by)", - "Num Off Switch Containers (satisfied by)" }; - boolean odd = false; - for (int i = 0; i < localityStatistics.length; i++) { - table.tr((odd = !odd) ? _ODD : _EVEN).td(containersType[i]) - .td(String.valueOf(localityStatistics[i][0])) - .td(i == 0 ? "" : String.valueOf(localityStatistics[i][1])) - .td(i <= 1 ? "" : String.valueOf(localityStatistics[i][2]))._(); + if (webUiType != null && webUiType.equals(YarnWebParams.RM_WEB_UI)) { + createResourceRequestsTable(html, null); // TODO:YARN-3284 } - table._(); - div._(); } //TODO:YARN-3284 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/AppAttemptPage.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/AppAttemptPage.java index 92eae48485d..6e4cfade9ff 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/AppAttemptPage.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/AppAttemptPage.java @@ -45,6 +45,8 @@ public class AppAttemptPage extends RmView { set(DATATABLES_ID, "containers"); set(initID(DATATABLES, "containers"), WebPageUtils.containersTableInit()); setTableStyles(html, "containers", ".queue {width:6em}", ".ui {width:8em}"); + + set(YarnWebParams.WEB_UI_TYPE, YarnWebParams.RM_WEB_UI); } @Override