YARN-3406. Display count of running containers in the RM's Web UI. Contributed by Ryu Kobayashi.

(cherry picked from commit 4a3dabd94f)
This commit is contained in:
Tsuyoshi Ozawa 2015-04-25 07:17:11 +09:00
parent bd750f160b
commit 3884948d6c
6 changed files with 37 additions and 10 deletions

View File

@ -120,6 +120,9 @@ Release 2.8.0 - UNRELEASED
YARN-3511. Add errors and warnings page to ATS. (Varun Vasudev via xgong) YARN-3511. Add errors and warnings page to ATS. (Varun Vasudev via xgong)
YARN-3406. Display count of running containers in the RM's Web UI.
(Ryu Kobayashi via ozawa)
OPTIMIZATIONS OPTIMIZATIONS
YARN-3339. TestDockerContainerExecutor should pull a single image and not YARN-3339. TestDockerContainerExecutor should pull a single image and not

View File

@ -24,10 +24,11 @@ import static org.apache.hadoop.yarn.webapp.view.JQueryUI.tableInit;
public class WebPageUtils { public class WebPageUtils {
public static String appsTableInit() { public static String appsTableInit() {
return appsTableInit(false); return appsTableInit(false, true);
} }
public static String appsTableInit(boolean isFairSchedulerPage) { public static String appsTableInit(
boolean isFairSchedulerPage, boolean isResourceManager) {
// id, user, name, queue, starttime, finishtime, state, status, progress, ui // id, user, name, queue, starttime, finishtime, state, status, progress, ui
// FairSchedulerPage's table is a bit different // FairSchedulerPage's table is a bit different
return tableInit() return tableInit()
@ -35,22 +36,30 @@ public class WebPageUtils {
.append(", bDeferRender: true") .append(", bDeferRender: true")
.append(", bProcessing: true") .append(", bProcessing: true")
.append("\n, aoColumnDefs: ") .append("\n, aoColumnDefs: ")
.append(getAppsTableColumnDefs(isFairSchedulerPage)) .append(getAppsTableColumnDefs(isFairSchedulerPage, isResourceManager))
// Sort by id upon page load // Sort by id upon page load
.append(", aaSorting: [[0, 'desc']]}").toString(); .append(", aaSorting: [[0, 'desc']]}").toString();
} }
private static String getAppsTableColumnDefs(boolean isFairSchedulerPage) { private static String getAppsTableColumnDefs(
boolean isFairSchedulerPage, boolean isResourceManager) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
return sb sb.append("[\n")
.append("[\n")
.append("{'sType':'string', 'aTargets': [0]") .append("{'sType':'string', 'aTargets': [0]")
.append(", 'mRender': parseHadoopID }") .append(", 'mRender': parseHadoopID }")
.append("\n, {'sType':'numeric', 'aTargets': " + .append("\n, {'sType':'numeric', 'aTargets': " +
(isFairSchedulerPage ? "[6, 7]": "[5, 6]")) (isFairSchedulerPage ? "[6, 7]": "[5, 6]"))
.append(", 'mRender': renderHadoopDate }") .append(", 'mRender': renderHadoopDate }")
.append("\n, {'sType':'numeric', bSearchable:false, 'aTargets': [9]") .append("\n, {'sType':'numeric', bSearchable:false, 'aTargets':");
.append(", 'mRender': parseHadoopProgress }]").toString(); if (isFairSchedulerPage) {
sb.append("[11]");
} else if (isResourceManager) {
sb.append("[10]");
} else {
sb.append("[9]");
}
sb.append(", 'mRender': parseHadoopProgress }]");
return sb.toString();
} }
public static String attemptsTableInit() { public static String attemptsTableInit() {

View File

@ -42,6 +42,7 @@ public class AppInfo {
protected String host; protected String host;
protected int rpcPort; protected int rpcPort;
protected YarnApplicationState appState; protected YarnApplicationState appState;
protected int runningContainers;
protected float progress; protected float progress;
protected String diagnosticsInfo; protected String diagnosticsInfo;
protected String originalTrackingUrl; protected String originalTrackingUrl;
@ -77,6 +78,10 @@ public class AppInfo {
finishedTime = app.getFinishTime(); finishedTime = app.getFinishTime();
elapsedTime = Times.elapsed(startedTime, finishedTime); elapsedTime = Times.elapsed(startedTime, finishedTime);
finalAppStatus = app.getFinalApplicationStatus(); finalAppStatus = app.getFinalApplicationStatus();
if (app.getApplicationResourceUsageReport() != null) {
runningContainers =
app.getApplicationResourceUsageReport().getNumUsedContainers();
}
progress = app.getProgress() * 100; // in percent progress = app.getProgress() * 100; // in percent
if (app.getApplicationTags() != null && !app.getApplicationTags().isEmpty()) { if (app.getApplicationTags() != null && !app.getApplicationTags().isEmpty()) {
this.applicationTags = CSV_JOINER.join(app.getApplicationTags()); this.applicationTags = CSV_JOINER.join(app.getApplicationTags());
@ -119,6 +124,10 @@ public class AppInfo {
return appState; return appState;
} }
public int getRunningContainers() {
return runningContainers;
}
public float getProgress() { public float getProgress() {
return progress; return progress;
} }

View File

@ -91,6 +91,7 @@ public class FairSchedulerAppsBlock extends HtmlBlock {
th(".finishtime", "FinishTime"). th(".finishtime", "FinishTime").
th(".state", "State"). th(".state", "State").
th(".finalstatus", "FinalStatus"). th(".finalstatus", "FinalStatus").
th(".runningcontainer", "Running Containers").
th(".progress", "Progress"). th(".progress", "Progress").
th(".ui", "Tracking UI")._()._(). th(".ui", "Tracking UI")._()._().
tbody(); tbody();
@ -132,6 +133,7 @@ public class FairSchedulerAppsBlock extends HtmlBlock {
.append(appInfo.getFinishTime()).append("\",\"") .append(appInfo.getFinishTime()).append("\",\"")
.append(appInfo.getState()).append("\",\"") .append(appInfo.getState()).append("\",\"")
.append(appInfo.getFinalStatus()).append("\",\"") .append(appInfo.getFinalStatus()).append("\",\"")
.append(appInfo.getRunningContainers()).append("\",\"")
// Progress bar // Progress bar
.append("<br title='").append(percent) .append("<br title='").append(percent)
.append("'> <div class='").append(C_PROGRESSBAR).append("' title='") .append("'> <div class='").append(C_PROGRESSBAR).append("' title='")

View File

@ -237,7 +237,7 @@ public class FairSchedulerPage extends RmView {
@Override @Override
protected String initAppsTable() { protected String initAppsTable() {
return WebPageUtils.appsTableInit(true); return WebPageUtils.appsTableInit(true, false);
} }
static String percent(float f) { static String percent(float f) {

View File

@ -57,7 +57,9 @@ public class RMAppsBlock extends AppsBlock {
.th(".name", "Name").th(".type", "Application Type") .th(".name", "Name").th(".type", "Application Type")
.th(".queue", "Queue").th(".starttime", "StartTime") .th(".queue", "Queue").th(".starttime", "StartTime")
.th(".finishtime", "FinishTime").th(".state", "State") .th(".finishtime", "FinishTime").th(".state", "State")
.th(".finalstatus", "FinalStatus").th(".progress", "Progress") .th(".finalstatus", "FinalStatus")
.th(".runningcontainer", "Running Containers")
.th(".progress", "Progress")
.th(".ui", "Tracking UI").th(".blacklisted", "Blacklisted Nodes")._() .th(".ui", "Tracking UI").th(".blacklisted", "Blacklisted Nodes")._()
._().tbody(); ._().tbody();
@ -108,6 +110,8 @@ public class RMAppsBlock extends AppsBlock {
.append("\",\"") .append("\",\"")
.append(app.getFinalAppStatus()) .append(app.getFinalAppStatus())
.append("\",\"") .append("\",\"")
.append(String.valueOf(app.getRunningContainers()))
.append("\",\"")
// Progress bar // Progress bar
.append("<br title='").append(percent).append("'> <div class='") .append("<br title='").append(percent).append("'> <div class='")
.append(C_PROGRESSBAR).append("' title='").append(join(percent, '%')) .append(C_PROGRESSBAR).append("' title='").append(join(percent, '%'))