diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index 47f4722f7b5..9c82619ca64 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -155,6 +155,9 @@ Release 0.23.6 - UNRELEASED YARN-214. RMContainerImpl does not handle event EXPIRE at state RUNNING (jeagles via bobby) + YARN-151. Browser thinks RM main page JS is taking too long + (Ravi Prakash via bobby) + Release 0.23.5 - UNRELEASED INCOMPATIBLE CHANGES diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/webapps/static/yarn.dt.plugins.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/webapps/static/yarn.dt.plugins.js index 17c1b27d0ce..5d78aaaf7fb 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/webapps/static/yarn.dt.plugins.js +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/webapps/static/yarn.dt.plugins.js @@ -106,3 +106,11 @@ function parseHadoopID(data, type, full) { var splits = data.split('_'); return splits[parseInt(splits.length-1)].split('<')[0]; } + +function parseHadoopProgress(data, type, full) { + if (type === 'display') { + return data; + } + //Return the title attribute for 'sort', 'filter', 'type' and undefined + return data.split("'")[1]; +} 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/AppsBlock.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/AppsBlock.java index 12d5554e9cd..fad5dd82591 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/AppsBlock.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/AppsBlock.java @@ -20,12 +20,13 @@ package org.apache.hadoop.yarn.server.resourcemanager.webapp; import static org.apache.hadoop.yarn.util.StringHelper.join; import static org.apache.hadoop.yarn.webapp.YarnWebParams.APP_STATE; -import static org.apache.hadoop.yarn.webapp.view.JQueryUI._PROGRESSBAR; -import static org.apache.hadoop.yarn.webapp.view.JQueryUI._PROGRESSBAR_VALUE; +import static org.apache.hadoop.yarn.webapp.view.JQueryUI.C_PROGRESSBAR; +import static org.apache.hadoop.yarn.webapp.view.JQueryUI.C_PROGRESSBAR_VALUE; import java.util.Collection; import java.util.HashSet; +import org.apache.commons.lang.StringEscapeUtils; import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp; import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppState; import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppInfo; @@ -72,41 +73,50 @@ class AppsBlock extends HtmlBlock { reqAppStates.add(RMAppState.valueOf(stateString)); } } + StringBuilder appsTableData = new StringBuilder("[\n"); for (RMApp app : list.apps.values()) { if (reqAppStates != null && !reqAppStates.contains(app.getState())) { continue; } AppInfo appInfo = new AppInfo(app, true); String percent = String.format("%.1f", appInfo.getProgress()); - String startTime = Times.format(appInfo.getStartTime()); - String finishTime = Times.format(appInfo.getFinishTime()); - tbody. - tr(). - td(). - br().$title(appInfo.getAppIdNum())._(). // for sorting - a(url("app", appInfo.getAppId()), appInfo.getAppId())._(). - td(appInfo.getUser()). - td(appInfo.getName()). - td(appInfo.getQueue()). - td(). - br().$title(String.valueOf(appInfo.getStartTime()))._(). - _(startTime)._(). - td(). - br().$title(String.valueOf(appInfo.getFinishTime()))._(). - _(finishTime)._(). - td(appInfo.getState()). - td(appInfo.getFinalStatus()). - td(). - br().$title(percent)._(). // for sorting - div(_PROGRESSBAR). - $title(join(percent, '%')). // tooltip - div(_PROGRESSBAR_VALUE). - $style(join("width:", percent, '%'))._()._()._(). - td(). - a(!appInfo.isTrackingUrlReady()? - "#" : appInfo.getTrackingUrlPretty(), appInfo.getTrackingUI())._()._(); + //AppID numerical value parsed by parseHadoopID in yarn.dt.plugins.js + appsTableData.append("[\"") + .append(appInfo.getAppId()).append("\",\"") + .append(StringEscapeUtils.escapeHtml(appInfo.getUser())) + .append("\",\"") + .append(StringEscapeUtils.escapeHtml(appInfo.getName())) + .append("\",\"") + .append(StringEscapeUtils.escapeHtml(appInfo.getQueue())) + .append("\",\"") + .append(appInfo.getStartTime()).append("\",\"") + .append(appInfo.getFinishTime()).append("\",\"") + .append(appInfo.getState()).append("\",\"") + .append(appInfo.getFinalStatus()).append("\",\"") + // Progress bar + .append("
").append("
") + .append("\",\"") + .append(appInfo.getTrackingUI()).append("\"],\n"); + if (list.rendering != Render.HTML && ++i >= 20) break; } + if(appsTableData.charAt(appsTableData.length() - 2) == ',') { + appsTableData.delete(appsTableData.length()-2, appsTableData.length()-1); + } + appsTableData.append("]"); + html.script().$type("text/javascript"). + _("var appsTableData=" + appsTableData)._(); + tbody._()._(); if (list.rendering == Render.JS_ARRAY) { 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/RmView.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RmView.java index aca94996cff..0ad11901007 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RmView.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RmView.java @@ -62,13 +62,23 @@ public class RmView extends TwoColumnLayout { private String appsTableInit() { AppsList list = getInstance(AppsList.class); // id, user, name, queue, starttime, finishtime, state, status, progress, ui - StringBuilder init = tableInit(). - append(", aoColumns:[{sType:'title-numeric'}, null, null, null, "). - append("{sType:'title-numeric'}, {sType:'title-numeric'} , null, "). - append("null,{sType:'title-numeric', bSearchable:false}, null]"); + StringBuilder init = tableInit() + .append(", 'aaData': appsTableData") + .append(", bDeferRender: true") + .append(", bProcessing: true") - // Sort by id upon page load - init.append(", aaSorting: [[0, 'desc']]"); + .append("\n, aoColumnDefs: [\n") + .append("{'sType':'numeric', 'aTargets': [0]") + .append(", 'mRender': parseHadoopID }") + + .append("\n, {'sType':'numeric', 'aTargets': [4, 5]") + .append(", 'mRender': renderHadoopDate }") + + .append("\n, {'sType':'numeric', bSearchable:false, 'aTargets': [8]") + .append(", 'mRender': parseHadoopProgress }]") + + // Sort by id upon page load + .append(", aaSorting: [[0, 'desc']]"); String rows = $("rowlimit"); int rowLimit = rows.isEmpty() ? MAX_DISPLAY_ROWS : Integer.parseInt(rows);