YARN-7067. [YARN-3926] Optimize ResourceType information display in UI. Contributed by Wangda Tan.

This commit is contained in:
Sunil G 2017-08-22 16:59:29 +05:30 committed by Wangda Tan
parent 39240b61a1
commit a333ba54e3
2 changed files with 13 additions and 5 deletions

View File

@ -153,8 +153,11 @@ public static void copy(ResourceTypeInfo src, ResourceTypeInfo dst) {
@Override @Override
public String toString() { public String toString() {
return "name: " + this.getName() + ", units: " + this.getDefaultUnit() StringBuilder sb = new StringBuilder();
+ ", type: " + getResourceType(); sb.append("<name=").append(this.getName()).append(" default-unit=").append(
this.getDefaultUnit()).append(" type=" + getResourceType()).append(
">");
return sb.toString();
} }
@Override @Override

View File

@ -19,17 +19,21 @@
package org.apache.hadoop.yarn.server.resourcemanager.webapp; package org.apache.hadoop.yarn.server.resourcemanager.webapp;
import org.apache.hadoop.util.StringUtils; import org.apache.hadoop.util.StringUtils;
import org.apache.hadoop.yarn.api.records.ResourceTypeInfo;
import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager; import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager;
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ClusterMetricsInfo; import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ClusterMetricsInfo;
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.SchedulerInfo; import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.SchedulerInfo;
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.UserMetricsInfo; import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.UserMetricsInfo;
import org.apache.hadoop.yarn.util.resource.ResourceUtils;
import org.apache.hadoop.yarn.webapp.hamlet2.Hamlet; import org.apache.hadoop.yarn.webapp.hamlet2.Hamlet;
import org.apache.hadoop.yarn.webapp.hamlet2.Hamlet.DIV; import org.apache.hadoop.yarn.webapp.hamlet2.Hamlet.DIV;
import org.apache.hadoop.yarn.webapp.view.HtmlBlock; import org.apache.hadoop.yarn.webapp.view.HtmlBlock;
import com.google.inject.Inject; import com.google.inject.Inject;
import java.util.Arrays;
/** /**
* Provides an table with an overview of many cluster wide metrics and if * Provides an table with an overview of many cluster wide metrics and if
* per user metrics are enabled it will show an overview of what the * per user metrics are enabled it will show an overview of what the
@ -169,7 +173,7 @@ protected void render(Block html) {
} }
} }
SchedulerInfo schedulerInfo=new SchedulerInfo(this.rm); SchedulerInfo schedulerInfo = new SchedulerInfo(this.rm);
div.h3("Scheduler Metrics"). div.h3("Scheduler Metrics").
table("#schedulermetricsoverview"). table("#schedulermetricsoverview").
@ -186,7 +190,8 @@ protected void render(Block html) {
tbody().$class("ui-widget-content"). tbody().$class("ui-widget-content").
tr(). tr().
td(String.valueOf(schedulerInfo.getSchedulerType())). td(String.valueOf(schedulerInfo.getSchedulerType())).
td(String.valueOf(schedulerInfo.getSchedulerResourceTypes())). td(String.valueOf(Arrays.toString(ResourceUtils.getResourcesTypeInfo()
.toArray(new ResourceTypeInfo[0])))).
td(schedulerInfo.getMinAllocation().toString()). td(schedulerInfo.getMinAllocation().toString()).
td(schedulerInfo.getMaxAllocation().toString()). td(schedulerInfo.getMaxAllocation().toString()).
td(String.valueOf(schedulerInfo.getMaxClusterLevelAppPriority())). td(String.valueOf(schedulerInfo.getMaxClusterLevelAppPriority())).