From 6c80e599d1f158d429a5f3ed707c6326837a8835 Mon Sep 17 00:00:00 2001 From: Karthik Kambatla Date: Sat, 30 May 2015 13:36:24 -0700 Subject: [PATCH] YARN-3467. Expose allocatedMB, allocatedVCores, and runningContainers metrics on running Applications in RM Web UI. (Anubhav Dhoot via kasha) (cherry picked from commit a8acdd65b3f0e8633050a1100136fd5e02ebdcfa) --- hadoop-yarn-project/CHANGES.txt | 3 +++ .../hadoop/yarn/server/webapp/WebPageUtils.java | 4 ++-- .../hadoop/yarn/server/webapp/dao/AppInfo.java | 14 ++++++++++++++ .../webapp/FairSchedulerAppsBlock.java | 6 ++++++ .../server/resourcemanager/webapp/RMAppsBlock.java | 8 ++++++++ 5 files changed, 33 insertions(+), 2 deletions(-) diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index 09984bff234..d20dcf5875a 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -235,6 +235,9 @@ Release 2.8.0 - UNRELEASED YARN-3713. Remove duplicate function call storeContainerDiagnostics in ContainerDiagnosticsUpdateTransition (zxu via rkanter) + YARN-3467. Expose allocatedMB, allocatedVCores, and runningContainers metrics on + running Applications in RM Web UI. (Anubhav Dhoot via kasha) + OPTIMIZATIONS YARN-3339. TestDockerContainerExecutor should pull a single image and not diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/WebPageUtils.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/WebPageUtils.java index 6ca5011a72a..ed0fe38f86b 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/WebPageUtils.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/WebPageUtils.java @@ -52,9 +52,9 @@ public class WebPageUtils { .append(", 'mRender': renderHadoopDate }") .append("\n, {'sType':'numeric', bSearchable:false, 'aTargets':"); if (isFairSchedulerPage) { - sb.append("[11]"); + sb.append("[13]"); } else if (isResourceManager) { - sb.append("[10]"); + sb.append("[12]"); } else { sb.append("[9]"); } 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 5d9ba6f669b..0cc5f756457 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 @@ -58,6 +58,8 @@ public class AppInfo { protected long finishedTime; protected long elapsedTime; protected String applicationTags; + private int allocatedCpuVcores; + private int allocatedMemoryMB; public AppInfo() { // JAXB needs this @@ -86,6 +88,10 @@ public class AppInfo { if (app.getApplicationResourceUsageReport() != null) { runningContainers = app.getApplicationResourceUsageReport().getNumUsedContainers(); + allocatedCpuVcores = app.getApplicationResourceUsageReport() + .getUsedResources().getVirtualCores(); + allocatedMemoryMB = app.getApplicationResourceUsageReport() + .getUsedResources().getMemory(); } progress = app.getProgress() * 100; // in percent if (app.getApplicationTags() != null && !app.getApplicationTags().isEmpty()) { @@ -133,6 +139,14 @@ public class AppInfo { return runningContainers; } + public int getAllocatedCpuVcores() { + return allocatedCpuVcores; + } + + public int getAllocatedMemoryMB() { + return allocatedMemoryMB; + } + 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 80099d05a69..f257656107c 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 @@ -93,6 +93,8 @@ public class FairSchedulerAppsBlock extends HtmlBlock { th(".state", "State"). th(".finalstatus", "FinalStatus"). th(".runningcontainer", "Running Containers"). + th(".allocatedCpu", "Allocated CPU VCores"). + th(".allocatedMemory", "Allocated Memory MB"). th(".progress", "Progress"). th(".ui", "Tracking UI")._()._(). tbody(); @@ -136,6 +138,10 @@ public class FairSchedulerAppsBlock extends HtmlBlock { .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("\",\"") // Progress bar .append("