From ec975197799417a1d5727dedc395fe6c15c30eb2 Mon Sep 17 00:00:00 2001 From: Daniel Templeton Date: Thu, 29 Jun 2017 16:52:46 -0700 Subject: [PATCH] YARN-6751. Display reserved resources in web UI per queue (Contributed by Abdullah Yousufi via Daniel Templeton) --- .../server/resourcemanager/scheduler/fair/FSQueue.java | 7 +++++++ .../server/resourcemanager/webapp/FairSchedulerPage.java | 6 ++++-- .../resourcemanager/webapp/dao/FairSchedulerQueueInfo.java | 6 ++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/FSQueue.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/FSQueue.java index 12b1b83f1a..10168232a9 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/FSQueue.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/FSQueue.java @@ -57,6 +57,7 @@ public abstract class FSQueue implements Queue, Schedulable { private Resource fairShare = Resources.createResource(0, 0); private Resource steadyFairShare = Resources.createResource(0, 0); + private Resource reservedResource = Resources.createResource(0, 0); private final String name; protected final FairScheduler scheduler; private final YarnAuthorizationProvider authorizer; @@ -161,6 +162,12 @@ public void setMaxShare(Resource maxShare){ this.maxShare = maxShare; } + public Resource getReservedResource() { + reservedResource.setMemorySize(metrics.getReservedMB()); + reservedResource.setVirtualCores(metrics.getReservedVirtualCores()); + return reservedResource; + } + @Override public Resource getMaxShare() { return maxShare; 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/FairSchedulerPage.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/FairSchedulerPage.java index 544275e5b9..5f46841a48 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/FairSchedulerPage.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/FairSchedulerPage.java @@ -75,7 +75,8 @@ protected void render(Block html) { _("Num Active Applications:", qinfo.getNumActiveApplications()). _("Num Pending Applications:", qinfo.getNumPendingApplications()). _("Min Resources:", qinfo.getMinResources().toString()). - _("Max Resources:", qinfo.getMaxResources().toString()); + _("Max Resources:", qinfo.getMaxResources().toString()). + _("Reserved Resources:", qinfo.getReservedResources().toString()); int maxApps = qinfo.getMaxApplications(); if (maxApps < Integer.MAX_VALUE) { ri._("Max Running Applications:", qinfo.getMaxApplications()); @@ -103,7 +104,8 @@ protected void render(Block html) { ResponseInfo ri = info("\'" + qinfo.getQueueName() + "\' Queue Status"). _("Used Resources:", qinfo.getUsedResources().toString()). _("Min Resources:", qinfo.getMinResources().toString()). - _("Max Resources:", qinfo.getMaxResources().toString()); + _("Max Resources:", qinfo.getMaxResources().toString()). + _("Reserved Resources:", qinfo.getReservedResources().toString()); int maxApps = qinfo.getMaxApplications(); if (maxApps < Integer.MAX_VALUE) { ri._("Max Running Applications:", qinfo.getMaxApplications()); 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/dao/FairSchedulerQueueInfo.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/dao/FairSchedulerQueueInfo.java index 64e573b37b..fa14bae967 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/dao/FairSchedulerQueueInfo.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/dao/FairSchedulerQueueInfo.java @@ -58,6 +58,7 @@ public class FairSchedulerQueueInfo { private ResourceInfo steadyFairResources; private ResourceInfo fairResources; private ResourceInfo clusterResources; + private ResourceInfo reservedResources; private long pendingContainers; private long allocatedContainers; @@ -93,6 +94,7 @@ public FairSchedulerQueueInfo(FSQueue queue, FairScheduler scheduler) { maxResources = new ResourceInfo( Resources.componentwiseMin(queue.getMaxShare(), scheduler.getClusterResource())); + reservedResources = new ResourceInfo(queue.getReservedResource()); fractionMemSteadyFairShare = (float)steadyFairResources.getMemorySize() / clusterResources.getMemorySize(); @@ -186,6 +188,10 @@ public ResourceInfo getMaxResources() { return maxResources; } + public ResourceInfo getReservedResources() { + return reservedResources; + } + public int getMaxApplications() { return maxApps; }