svn merge -c 1410564 FIXES: YARN-151. Browser thinks RM main page JS is taking too long (Ravi Prakash via bobby)
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1410565 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
af25e22798
commit
0685e9eb75
|
@ -155,6 +155,9 @@ Release 0.23.6 - UNRELEASED
|
||||||
YARN-214. RMContainerImpl does not handle event EXPIRE at state RUNNING
|
YARN-214. RMContainerImpl does not handle event EXPIRE at state RUNNING
|
||||||
(jeagles via bobby)
|
(jeagles via bobby)
|
||||||
|
|
||||||
|
YARN-151. Browser thinks RM main page JS is taking too long
|
||||||
|
(Ravi Prakash via bobby)
|
||||||
|
|
||||||
Release 0.23.5 - UNRELEASED
|
Release 0.23.5 - UNRELEASED
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -106,3 +106,11 @@ function parseHadoopID(data, type, full) {
|
||||||
var splits = data.split('_');
|
var splits = data.split('_');
|
||||||
return splits[parseInt(splits.length-1)].split('<')[0];
|
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];
|
||||||
|
}
|
||||||
|
|
|
@ -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.util.StringHelper.join;
|
||||||
import static org.apache.hadoop.yarn.webapp.YarnWebParams.APP_STATE;
|
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.C_PROGRESSBAR;
|
||||||
import static org.apache.hadoop.yarn.webapp.view.JQueryUI._PROGRESSBAR_VALUE;
|
import static org.apache.hadoop.yarn.webapp.view.JQueryUI.C_PROGRESSBAR_VALUE;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashSet;
|
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.RMApp;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppState;
|
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppState;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppInfo;
|
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppInfo;
|
||||||
|
@ -72,41 +73,50 @@ class AppsBlock extends HtmlBlock {
|
||||||
reqAppStates.add(RMAppState.valueOf(stateString));
|
reqAppStates.add(RMAppState.valueOf(stateString));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
StringBuilder appsTableData = new StringBuilder("[\n");
|
||||||
for (RMApp app : list.apps.values()) {
|
for (RMApp app : list.apps.values()) {
|
||||||
if (reqAppStates != null && !reqAppStates.contains(app.getState())) {
|
if (reqAppStates != null && !reqAppStates.contains(app.getState())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
AppInfo appInfo = new AppInfo(app, true);
|
AppInfo appInfo = new AppInfo(app, true);
|
||||||
String percent = String.format("%.1f", appInfo.getProgress());
|
String percent = String.format("%.1f", appInfo.getProgress());
|
||||||
String startTime = Times.format(appInfo.getStartTime());
|
//AppID numerical value parsed by parseHadoopID in yarn.dt.plugins.js
|
||||||
String finishTime = Times.format(appInfo.getFinishTime());
|
appsTableData.append("[\"<a href='")
|
||||||
tbody.
|
.append(url("app", appInfo.getAppId())).append("'>")
|
||||||
tr().
|
.append(appInfo.getAppId()).append("</a>\",\"")
|
||||||
td().
|
.append(StringEscapeUtils.escapeHtml(appInfo.getUser()))
|
||||||
br().$title(appInfo.getAppIdNum())._(). // for sorting
|
.append("\",\"")
|
||||||
a(url("app", appInfo.getAppId()), appInfo.getAppId())._().
|
.append(StringEscapeUtils.escapeHtml(appInfo.getName()))
|
||||||
td(appInfo.getUser()).
|
.append("\",\"")
|
||||||
td(appInfo.getName()).
|
.append(StringEscapeUtils.escapeHtml(appInfo.getQueue()))
|
||||||
td(appInfo.getQueue()).
|
.append("\",\"")
|
||||||
td().
|
.append(appInfo.getStartTime()).append("\",\"")
|
||||||
br().$title(String.valueOf(appInfo.getStartTime()))._().
|
.append(appInfo.getFinishTime()).append("\",\"")
|
||||||
_(startTime)._().
|
.append(appInfo.getState()).append("\",\"")
|
||||||
td().
|
.append(appInfo.getFinalStatus()).append("\",\"")
|
||||||
br().$title(String.valueOf(appInfo.getFinishTime()))._().
|
// Progress bar
|
||||||
_(finishTime)._().
|
.append("<br title='").append(percent)
|
||||||
td(appInfo.getState()).
|
.append("'> <div class='").append(C_PROGRESSBAR).append("' title='")
|
||||||
td(appInfo.getFinalStatus()).
|
.append(join(percent, '%')).append("'> ").append("<div class='")
|
||||||
td().
|
.append(C_PROGRESSBAR_VALUE).append("' style='")
|
||||||
br().$title(percent)._(). // for sorting
|
.append(join("width:", percent, '%')).append("'> </div> </div>")
|
||||||
div(_PROGRESSBAR).
|
.append("\",\"<a href='");
|
||||||
$title(join(percent, '%')). // tooltip
|
|
||||||
div(_PROGRESSBAR_VALUE).
|
String trackingURL =
|
||||||
$style(join("width:", percent, '%'))._()._()._().
|
!appInfo.isTrackingUrlReady()? "#" : appInfo.getTrackingUrlPretty();
|
||||||
td().
|
|
||||||
a(!appInfo.isTrackingUrlReady()?
|
appsTableData.append(trackingURL).append("'>")
|
||||||
"#" : appInfo.getTrackingUrlPretty(), appInfo.getTrackingUI())._()._();
|
.append(appInfo.getTrackingUI()).append("</a>\"],\n");
|
||||||
|
|
||||||
if (list.rendering != Render.HTML && ++i >= 20) break;
|
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._()._();
|
tbody._()._();
|
||||||
|
|
||||||
if (list.rendering == Render.JS_ARRAY) {
|
if (list.rendering == Render.JS_ARRAY) {
|
||||||
|
|
|
@ -62,13 +62,23 @@ public class RmView extends TwoColumnLayout {
|
||||||
private String appsTableInit() {
|
private String appsTableInit() {
|
||||||
AppsList list = getInstance(AppsList.class);
|
AppsList list = getInstance(AppsList.class);
|
||||||
// id, user, name, queue, starttime, finishtime, state, status, progress, ui
|
// id, user, name, queue, starttime, finishtime, state, status, progress, ui
|
||||||
StringBuilder init = tableInit().
|
StringBuilder init = tableInit()
|
||||||
append(", aoColumns:[{sType:'title-numeric'}, null, null, null, ").
|
.append(", 'aaData': appsTableData")
|
||||||
append("{sType:'title-numeric'}, {sType:'title-numeric'} , null, ").
|
.append(", bDeferRender: true")
|
||||||
append("null,{sType:'title-numeric', bSearchable:false}, null]");
|
.append(", bProcessing: true")
|
||||||
|
|
||||||
|
.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
|
// Sort by id upon page load
|
||||||
init.append(", aaSorting: [[0, 'desc']]");
|
.append(", aaSorting: [[0, 'desc']]");
|
||||||
|
|
||||||
String rows = $("rowlimit");
|
String rows = $("rowlimit");
|
||||||
int rowLimit = rows.isEmpty() ? MAX_DISPLAY_ROWS : Integer.parseInt(rows);
|
int rowLimit = rows.isEmpty() ? MAX_DISPLAY_ROWS : Integer.parseInt(rows);
|
||||||
|
|
Loading…
Reference in New Issue