YARN-6751. Display reserved resources in web UI per queue

(Contributed by Abdullah Yousufi via Daniel Templeton)
This commit is contained in:
Daniel Templeton 2017-06-29 16:52:46 -07:00
parent 441378e7e4
commit ec97519779
3 changed files with 17 additions and 2 deletions

View File

@ -57,6 +57,7 @@ public abstract class FSQueue implements Queue, Schedulable {
private Resource fairShare = Resources.createResource(0, 0); private Resource fairShare = Resources.createResource(0, 0);
private Resource steadyFairShare = Resources.createResource(0, 0); private Resource steadyFairShare = Resources.createResource(0, 0);
private Resource reservedResource = Resources.createResource(0, 0);
private final String name; private final String name;
protected final FairScheduler scheduler; protected final FairScheduler scheduler;
private final YarnAuthorizationProvider authorizer; private final YarnAuthorizationProvider authorizer;
@ -161,6 +162,12 @@ public abstract class FSQueue implements Queue, Schedulable {
this.maxShare = maxShare; this.maxShare = maxShare;
} }
public Resource getReservedResource() {
reservedResource.setMemorySize(metrics.getReservedMB());
reservedResource.setVirtualCores(metrics.getReservedVirtualCores());
return reservedResource;
}
@Override @Override
public Resource getMaxShare() { public Resource getMaxShare() {
return maxShare; return maxShare;

View File

@ -75,7 +75,8 @@ public class FairSchedulerPage extends RmView {
_("Num Active Applications:", qinfo.getNumActiveApplications()). _("Num Active Applications:", qinfo.getNumActiveApplications()).
_("Num Pending Applications:", qinfo.getNumPendingApplications()). _("Num Pending Applications:", qinfo.getNumPendingApplications()).
_("Min Resources:", qinfo.getMinResources().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(); int maxApps = qinfo.getMaxApplications();
if (maxApps < Integer.MAX_VALUE) { if (maxApps < Integer.MAX_VALUE) {
ri._("Max Running Applications:", qinfo.getMaxApplications()); ri._("Max Running Applications:", qinfo.getMaxApplications());
@ -103,7 +104,8 @@ public class FairSchedulerPage extends RmView {
ResponseInfo ri = info("\'" + qinfo.getQueueName() + "\' Queue Status"). ResponseInfo ri = info("\'" + qinfo.getQueueName() + "\' Queue Status").
_("Used Resources:", qinfo.getUsedResources().toString()). _("Used Resources:", qinfo.getUsedResources().toString()).
_("Min Resources:", qinfo.getMinResources().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(); int maxApps = qinfo.getMaxApplications();
if (maxApps < Integer.MAX_VALUE) { if (maxApps < Integer.MAX_VALUE) {
ri._("Max Running Applications:", qinfo.getMaxApplications()); ri._("Max Running Applications:", qinfo.getMaxApplications());

View File

@ -58,6 +58,7 @@ public class FairSchedulerQueueInfo {
private ResourceInfo steadyFairResources; private ResourceInfo steadyFairResources;
private ResourceInfo fairResources; private ResourceInfo fairResources;
private ResourceInfo clusterResources; private ResourceInfo clusterResources;
private ResourceInfo reservedResources;
private long pendingContainers; private long pendingContainers;
private long allocatedContainers; private long allocatedContainers;
@ -93,6 +94,7 @@ public class FairSchedulerQueueInfo {
maxResources = new ResourceInfo( maxResources = new ResourceInfo(
Resources.componentwiseMin(queue.getMaxShare(), Resources.componentwiseMin(queue.getMaxShare(),
scheduler.getClusterResource())); scheduler.getClusterResource()));
reservedResources = new ResourceInfo(queue.getReservedResource());
fractionMemSteadyFairShare = fractionMemSteadyFairShare =
(float)steadyFairResources.getMemorySize() / clusterResources.getMemorySize(); (float)steadyFairResources.getMemorySize() / clusterResources.getMemorySize();
@ -186,6 +188,10 @@ public class FairSchedulerQueueInfo {
return maxResources; return maxResources;
} }
public ResourceInfo getReservedResources() {
return reservedResources;
}
public int getMaxApplications() { public int getMaxApplications() {
return maxApps; return maxApps;
} }