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/trunk@1410564 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ab5039d4f1
commit
a23e8b0929
@ -172,6 +172,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
|
||||
|
@ -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];
|
||||
}
|
||||
|
@ -20,12 +20,13 @@
|
||||
|
||||
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("[\"<a href='")
|
||||
.append(url("app", appInfo.getAppId())).append("'>")
|
||||
.append(appInfo.getAppId()).append("</a>\",\"")
|
||||
.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("<br title='").append(percent)
|
||||
.append("'> <div class='").append(C_PROGRESSBAR).append("' title='")
|
||||
.append(join(percent, '%')).append("'> ").append("<div class='")
|
||||
.append(C_PROGRESSBAR_VALUE).append("' style='")
|
||||
.append(join("width:", percent, '%')).append("'> </div> </div>")
|
||||
.append("\",\"<a href='");
|
||||
|
||||
String trackingURL =
|
||||
!appInfo.isTrackingUrlReady()? "#" : appInfo.getTrackingUrlPretty();
|
||||
|
||||
appsTableData.append(trackingURL).append("'>")
|
||||
.append(appInfo.getTrackingUI()).append("</a>\"],\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) {
|
||||
|
@ -62,13 +62,23 @@ protected Class<? extends SubView> content() {
|
||||
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")
|
||||
|
||||
.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
|
||||
init.append(", aaSorting: [[0, 'desc']]");
|
||||
.append(", aaSorting: [[0, 'desc']]");
|
||||
|
||||
String rows = $("rowlimit");
|
||||
int rowLimit = rows.isEmpty() ? MAX_DISPLAY_ROWS : Integer.parseInt(rows);
|
||||
|
Loading…
Reference in New Issue
Block a user