YARN-6752. Display reserved resources in web UI per application

(Contributed by Abdullah Yousufi via Daniel Templeton)
This commit is contained in:
Daniel Templeton 2017-07-09 19:02:31 +09:00
parent f484a6ff60
commit 0615985886
5 changed files with 42 additions and 1 deletions

View File

@ -61,6 +61,8 @@ public class AppInfo {
protected int priority;
private long allocatedCpuVcores;
private long allocatedMemoryMB;
private long reservedCpuVcores;
private long reservedMemoryMB;
protected boolean unmanagedApplication;
private String appNodeLabelExpression;
private String amNodeLabelExpression;
@ -101,6 +103,10 @@ public class AppInfo {
.getUsedResources().getVirtualCores();
allocatedMemoryMB = app.getApplicationResourceUsageReport()
.getUsedResources().getMemorySize();
reservedCpuVcores = app.getApplicationResourceUsageReport()
.getReservedResources().getVirtualCores();
reservedMemoryMB = app.getApplicationResourceUsageReport()
.getReservedResources().getMemorySize();
}
}
progress = app.getProgress() * 100; // in percent
@ -160,6 +166,14 @@ public class AppInfo {
return allocatedMemoryMB;
}
public long getReservedCpuVcores() {
return reservedCpuVcores;
}
public long getReservedMemoryMB() {
return reservedMemoryMB;
}
public float getProgress() {
return progress;
}

View File

@ -95,6 +95,8 @@ public class FairSchedulerAppsBlock extends HtmlBlock {
th(".runningcontainer", "Running Containers").
th(".allocatedCpu", "Allocated CPU VCores").
th(".allocatedMemory", "Allocated Memory MB").
th(".reservedCpu", "Reserved CPU VCores").
th(".reservedMemory", "Reserved Memory MB").
th(".progress", "Progress").
th(".ui", "Tracking UI")._()._().
tbody();
@ -142,6 +144,10 @@ public class FairSchedulerAppsBlock extends HtmlBlock {
.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("\",\"")
// Progress bar
.append("<br title='").append(percent)
.append("'> <div class='").append(C_PROGRESSBAR).append("' title='")

View File

@ -66,6 +66,8 @@ public class RMAppsBlock extends AppsBlock {
.th(".runningcontainer", "Running Containers")
.th(".allocatedCpu", "Allocated CPU VCores")
.th(".allocatedMemory", "Allocated Memory MB")
.th(".reservedCpu", "Reserved CPU VCores")
.th(".reservedMemory", "Reserved Memory MB")
.th(".queuePercentage", "% of Queue")
.th(".clusterPercentage", "% of Cluster")
.th(".progress", "Progress")
@ -146,6 +148,12 @@ public class RMAppsBlock extends AppsBlock {
.append(app.getAllocatedMemoryMB() == -1 ? "N/A" :
String.valueOf(app.getAllocatedMemoryMB()))
.append("\",\"")
.append(app.getReservedCpuVcores() == -1 ? "N/A" : String
.valueOf(app.getReservedCpuVcores()))
.append("\",\"")
.append(app.getReservedMemoryMB() == -1 ? "N/A" :
String.valueOf(app.getReservedMemoryMB()))
.append("\",\"")
.append(queuePercent)
.append("\",\"")
.append(clusterPercent)

View File

@ -93,6 +93,8 @@ public class AppInfo {
private String amRPCAddress;
protected long allocatedMB;
protected long allocatedVCores;
protected long reservedMB;
protected long reservedVCores;
protected int runningContainers;
protected long memorySeconds;
protected long vcoreSeconds;
@ -196,8 +198,11 @@ public class AppInfo {
.getApplicationResourceUsageReport();
if (resourceReport != null) {
Resource usedResources = resourceReport.getUsedResources();
Resource reservedResources = resourceReport.getReservedResources();
allocatedMB = usedResources.getMemorySize();
allocatedVCores = usedResources.getVirtualCores();
reservedMB = reservedResources.getMemorySize();
reservedVCores = reservedResources.getVirtualCores();
runningContainers = resourceReport.getNumUsedContainers();
queueUsagePercentage = resourceReport.getQueueUsagePercentage();
clusterUsagePercentage = resourceReport.getClusterUsagePercentage();
@ -404,6 +409,14 @@ public class AppInfo {
return this.allocatedVCores;
}
public long getReservedMB() {
return this.reservedMB;
}
public long getReservedVCores() {
return this.reservedVCores;
}
public long getPreemptedMB() {
return preemptedResourceMB;
}

View File

@ -1528,7 +1528,7 @@ public class TestRMWebServicesApps extends JerseyTestBase {
public void verifyAppInfo(JSONObject info, RMApp app, boolean hasResourceReqs)
throws JSONException, Exception {
int expectedNumberOfElements = 34 + (hasResourceReqs ? 2 : 0);
int expectedNumberOfElements = 36 + (hasResourceReqs ? 2 : 0);
String appNodeLabelExpression = null;
String amNodeLabelExpression = null;
if (app.getApplicationSubmissionContext()