YARN-6802. Add max AM resource and AM resource usage to leaf queue view in FairScheduler WebUI. (YunFan Zhou via Yufei Gu)

This commit is contained in:
Yufei Gu 2017-07-28 09:51:06 -07:00
parent f735ad1b67
commit 9ea01fd956
2 changed files with 25 additions and 0 deletions

View File

@ -72,6 +72,8 @@ protected void render(Block html) {
ResponseInfo ri = info("\'" + qinfo.getQueueName() + "\' Queue Status"). ResponseInfo ri = info("\'" + qinfo.getQueueName() + "\' Queue Status").
__("Used Resources:", qinfo.getUsedResources().toString()). __("Used Resources:", qinfo.getUsedResources().toString()).
__("Demand Resources:", qinfo.getDemandResources().toString()). __("Demand Resources:", qinfo.getDemandResources().toString()).
__("AM Used Resources:", qinfo.getAMUsedResources().toString()).
__("AM Max Resources:", qinfo.getAMMaxResources().toString()).
__("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()).

View File

@ -28,6 +28,7 @@
import javax.xml.bind.annotation.XmlSeeAlso; import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.bind.annotation.XmlTransient; import javax.xml.bind.annotation.XmlTransient;
import org.apache.hadoop.yarn.api.records.Resource;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.AllocationConfiguration; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.AllocationConfiguration;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSLeafQueue; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSLeafQueue;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSQueue; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSQueue;
@ -54,6 +55,8 @@ public class FairSchedulerQueueInfo {
private ResourceInfo minResources; private ResourceInfo minResources;
private ResourceInfo maxResources; private ResourceInfo maxResources;
private ResourceInfo usedResources; private ResourceInfo usedResources;
private ResourceInfo amUsedResources;
private ResourceInfo amMaxResources;
private ResourceInfo demandResources; private ResourceInfo demandResources;
private ResourceInfo steadyFairResources; private ResourceInfo steadyFairResources;
private ResourceInfo fairResources; private ResourceInfo fairResources;
@ -82,6 +85,12 @@ public FairSchedulerQueueInfo(FSQueue queue, FairScheduler scheduler) {
clusterResources = new ResourceInfo(scheduler.getClusterResource()); clusterResources = new ResourceInfo(scheduler.getClusterResource());
amUsedResources = new ResourceInfo(Resource.newInstance(
queue.getMetrics().getAMResourceUsageMB(),
queue.getMetrics().getAMResourceUsageVCores()));
amMaxResources = new ResourceInfo(Resource.newInstance(
queue.getMetrics().getMaxAMShareMB(),
queue.getMetrics().getMaxAMShareVCores()));
usedResources = new ResourceInfo(queue.getResourceUsage()); usedResources = new ResourceInfo(queue.getResourceUsage());
demandResources = new ResourceInfo(queue.getDemand()); demandResources = new ResourceInfo(queue.getDemand());
fractionMemUsed = (float)usedResources.getMemorySize() / fractionMemUsed = (float)usedResources.getMemorySize() /
@ -204,6 +213,20 @@ public ResourceInfo getUsedResources() {
return usedResources; return usedResources;
} }
/**
* @return the am used resource of this queue.
*/
public ResourceInfo getAMUsedResources() {
return amUsedResources;
}
/**
* @return the am max resource of this queue.
*/
public ResourceInfo getAMMaxResources() {
return amMaxResources;
}
/** /**
* @return the demand resource of this queue. * @return the demand resource of this queue.
*/ */