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:
parent
bd750f160b
commit
3884948d6c
|
@ -120,6 +120,9 @@ Release 2.8.0 - UNRELEASED
|
|||
|
||||
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
|
||||
|
||||
YARN-3339. TestDockerContainerExecutor should pull a single image and not
|
||||
|
|
|
@ -24,10 +24,11 @@ import static org.apache.hadoop.yarn.webapp.view.JQueryUI.tableInit;
|
|||
public class WebPageUtils {
|
||||
|
||||
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
|
||||
// FairSchedulerPage's table is a bit different
|
||||
return tableInit()
|
||||
|
@ -35,22 +36,30 @@ public class WebPageUtils {
|
|||
.append(", bDeferRender: true")
|
||||
.append(", bProcessing: true")
|
||||
.append("\n, aoColumnDefs: ")
|
||||
.append(getAppsTableColumnDefs(isFairSchedulerPage))
|
||||
.append(getAppsTableColumnDefs(isFairSchedulerPage, isResourceManager))
|
||||
// Sort by id upon page load
|
||||
.append(", aaSorting: [[0, 'desc']]}").toString();
|
||||
}
|
||||
|
||||
private static String getAppsTableColumnDefs(boolean isFairSchedulerPage) {
|
||||
private static String getAppsTableColumnDefs(
|
||||
boolean isFairSchedulerPage, boolean isResourceManager) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
return sb
|
||||
.append("[\n")
|
||||
sb.append("[\n")
|
||||
.append("{'sType':'string', 'aTargets': [0]")
|
||||
.append(", 'mRender': parseHadoopID }")
|
||||
.append("\n, {'sType':'numeric', 'aTargets': " +
|
||||
(isFairSchedulerPage ? "[6, 7]": "[5, 6]"))
|
||||
.append(", 'mRender': renderHadoopDate }")
|
||||
.append("\n, {'sType':'numeric', bSearchable:false, 'aTargets': [9]")
|
||||
.append(", 'mRender': parseHadoopProgress }]").toString();
|
||||
.append("\n, {'sType':'numeric', bSearchable:false, 'aTargets':");
|
||||
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() {
|
||||
|
|
|
@ -42,6 +42,7 @@ public class AppInfo {
|
|||
protected String host;
|
||||
protected int rpcPort;
|
||||
protected YarnApplicationState appState;
|
||||
protected int runningContainers;
|
||||
protected float progress;
|
||||
protected String diagnosticsInfo;
|
||||
protected String originalTrackingUrl;
|
||||
|
@ -77,6 +78,10 @@ public class AppInfo {
|
|||
finishedTime = app.getFinishTime();
|
||||
elapsedTime = Times.elapsed(startedTime, finishedTime);
|
||||
finalAppStatus = app.getFinalApplicationStatus();
|
||||
if (app.getApplicationResourceUsageReport() != null) {
|
||||
runningContainers =
|
||||
app.getApplicationResourceUsageReport().getNumUsedContainers();
|
||||
}
|
||||
progress = app.getProgress() * 100; // in percent
|
||||
if (app.getApplicationTags() != null && !app.getApplicationTags().isEmpty()) {
|
||||
this.applicationTags = CSV_JOINER.join(app.getApplicationTags());
|
||||
|
@ -119,6 +124,10 @@ public class AppInfo {
|
|||
return appState;
|
||||
}
|
||||
|
||||
public int getRunningContainers() {
|
||||
return runningContainers;
|
||||
}
|
||||
|
||||
public float getProgress() {
|
||||
return progress;
|
||||
}
|
||||
|
|
|
@ -91,6 +91,7 @@ public class FairSchedulerAppsBlock extends HtmlBlock {
|
|||
th(".finishtime", "FinishTime").
|
||||
th(".state", "State").
|
||||
th(".finalstatus", "FinalStatus").
|
||||
th(".runningcontainer", "Running Containers").
|
||||
th(".progress", "Progress").
|
||||
th(".ui", "Tracking UI")._()._().
|
||||
tbody();
|
||||
|
@ -132,6 +133,7 @@ public class FairSchedulerAppsBlock extends HtmlBlock {
|
|||
.append(appInfo.getFinishTime()).append("\",\"")
|
||||
.append(appInfo.getState()).append("\",\"")
|
||||
.append(appInfo.getFinalStatus()).append("\",\"")
|
||||
.append(appInfo.getRunningContainers()).append("\",\"")
|
||||
// Progress bar
|
||||
.append("<br title='").append(percent)
|
||||
.append("'> <div class='").append(C_PROGRESSBAR).append("' title='")
|
||||
|
|
|
@ -237,7 +237,7 @@ public class FairSchedulerPage extends RmView {
|
|||
|
||||
@Override
|
||||
protected String initAppsTable() {
|
||||
return WebPageUtils.appsTableInit(true);
|
||||
return WebPageUtils.appsTableInit(true, false);
|
||||
}
|
||||
|
||||
static String percent(float f) {
|
||||
|
|
|
@ -57,7 +57,9 @@ public class RMAppsBlock extends AppsBlock {
|
|||
.th(".name", "Name").th(".type", "Application Type")
|
||||
.th(".queue", "Queue").th(".starttime", "StartTime")
|
||||
.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")._()
|
||||
._().tbody();
|
||||
|
||||
|
@ -108,6 +110,8 @@ public class RMAppsBlock extends AppsBlock {
|
|||
.append("\",\"")
|
||||
.append(app.getFinalAppStatus())
|
||||
.append("\",\"")
|
||||
.append(String.valueOf(app.getRunningContainers()))
|
||||
.append("\",\"")
|
||||
// Progress bar
|
||||
.append("<br title='").append(percent).append("'> <div class='")
|
||||
.append(C_PROGRESSBAR).append("' title='").append(join(percent, '%'))
|
||||
|
|
Loading…
Reference in New Issue