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

View File

@ -129,6 +129,12 @@ protected Boolean hasAccess(RMApp app, HttpServletRequest hsr) {
return true;
}
private static String printAppInfo(long value) {
if (value == -1) {
return "N/A";
}
return String.valueOf(value);
}
@Override public void render(Block html) {
TBODY<TABLE<Hamlet>> tbody = html.
@ -193,16 +199,16 @@ protected Boolean hasAccess(RMApp app, HttpServletRequest hsr) {
.append(appInfo.getFinishTime()).append("\",\"")
.append(appInfo.getState()).append("\",\"")
.append(appInfo.getFinalStatus()).append("\",\"")
.append(appInfo.getRunningContainers() == -1 ? "N/A" : String
.valueOf(appInfo.getRunningContainers())).append("\",\"")
.append(appInfo.getAllocatedVCores() == -1 ? "N/A" : String
.valueOf(appInfo.getAllocatedVCores())).append("\",\"")
.append(appInfo.getAllocatedMB() == -1 ? "N/A" : String
.valueOf(appInfo.getAllocatedMB())).append("\",\"")
.append(appInfo.getReservedVCores() == -1 ? "N/A" : String
.valueOf(appInfo.getReservedVCores())).append("\",\"")
.append(appInfo.getReservedMB() == -1 ? "N/A" : String
.valueOf(appInfo.getReservedMB())).append("\",\"")
.append(printAppInfo(appInfo.getRunningContainers()))
.append("\",\"")
.append(printAppInfo(appInfo.getAllocatedVCores()))
.append("\",\"")
.append(printAppInfo(appInfo.getAllocatedMB()))
.append("\",\"")
.append(printAppInfo(appInfo.getReservedVCores()))
.append("\",\"")
.append(printAppInfo(appInfo.getReservedMB()))
.append("\",\"")
// Progress bar
.append("<br title='").append(percent)
.append("'> <div class='").append(C_PROGRESSBAR).append("' title='")