YARN-6766. Add helper method in FairSchedulerAppsBlock to print app info. Contributed by Riya Khandelwal

This commit is contained in:
Szilard Nemeth 2022-10-10 15:28:27 +02:00 committed by Szilard Nemeth
parent 62ff4e36cf
commit 0c515b0ef0
1 changed files with 16 additions and 10 deletions

View File

@ -129,6 +129,12 @@ public class FairSchedulerAppsBlock extends HtmlBlock {
return true; return true;
} }
private static String printAppInfo(long value) {
if (value == -1) {
return "N/A";
}
return String.valueOf(value);
}
@Override public void render(Block html) { @Override public void render(Block html) {
TBODY<TABLE<Hamlet>> tbody = html. TBODY<TABLE<Hamlet>> tbody = html.
@ -193,16 +199,16 @@ 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() == -1 ? "N/A" : String .append(printAppInfo(appInfo.getRunningContainers()))
.valueOf(appInfo.getRunningContainers())).append("\",\"") .append("\",\"")
.append(appInfo.getAllocatedVCores() == -1 ? "N/A" : String .append(printAppInfo(appInfo.getAllocatedVCores()))
.valueOf(appInfo.getAllocatedVCores())).append("\",\"") .append("\",\"")
.append(appInfo.getAllocatedMB() == -1 ? "N/A" : String .append(printAppInfo(appInfo.getAllocatedMB()))
.valueOf(appInfo.getAllocatedMB())).append("\",\"") .append("\",\"")
.append(appInfo.getReservedVCores() == -1 ? "N/A" : String .append(printAppInfo(appInfo.getReservedVCores()))
.valueOf(appInfo.getReservedVCores())).append("\",\"") .append("\",\"")
.append(appInfo.getReservedMB() == -1 ? "N/A" : String .append(printAppInfo(appInfo.getReservedMB()))
.valueOf(appInfo.getReservedMB())).append("\",\"") .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='")