From 06159858868a9cbeefc31bc6be5ae48a59cc8a6c Mon Sep 17 00:00:00 2001 From: Daniel Templeton Date: Sun, 9 Jul 2017 19:02:31 +0900 Subject: [PATCH] YARN-6752. Display reserved resources in web UI per application (Contributed by Abdullah Yousufi via Daniel Templeton) --- .../hadoop/yarn/server/webapp/dao/AppInfo.java | 14 ++++++++++++++ .../webapp/FairSchedulerAppsBlock.java | 6 ++++++ .../server/resourcemanager/webapp/RMAppsBlock.java | 8 ++++++++ .../server/resourcemanager/webapp/dao/AppInfo.java | 13 +++++++++++++ .../webapp/TestRMWebServicesApps.java | 2 +- 5 files changed, 42 insertions(+), 1 deletion(-) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/dao/AppInfo.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/dao/AppInfo.java index ff4519da388..ac2f8da6aa2 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/dao/AppInfo.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/dao/AppInfo.java @@ -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; } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/FairSchedulerAppsBlock.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/FairSchedulerAppsBlock.java index 41b5fe7e4c3..b7a7a9372c8 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/FairSchedulerAppsBlock.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/FairSchedulerAppsBlock.java @@ -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("