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 06a5f1df144..cf4e020d35e 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 @@ -33,8 +33,10 @@ public class WebPageUtils { public static String appsTableInit( boolean isFairSchedulerPage, boolean isResourceManager) { - // id, user, name, queue, starttime, finishtime, state, status, progress, ui + // id, user, name, app type, app tags, queue, priority, + // starttime, launchtime, finishtime, state, status, progress, ui // FairSchedulerPage's table is a bit different + // This is define in RMAppsBlock.COLUMNS for the RM return tableInit() .append(", 'aaData': appsTableData") .append(", bDeferRender: true") @@ -51,24 +53,26 @@ public class WebPageUtils { String progressIndex = "[11]"; StringBuilder sb = new StringBuilder(); sb.append("[\n") - .append("{'sType':'natural', 'aTargets': [0]") - .append(", 'mRender': parseHadoopID }") - .append("\n, {'sType':'num-ignore-str', 'aTargets': [6, 7, 8]") - .append(", 'mRender': renderHadoopDate }"); + .append("{'sType':'natural', 'aTargets': [0], ") + .append("'mRender': parseHadoopID },\n") + .append("{'sType':'num-ignore-str', 'aTargets': [7, 8, 9], ") + .append("'mRender': renderHadoopDate },\n"); if (isResourceManager) { // Update following line if any column added in RM page before column 11 - sb.append("\n, {'sType':'num-ignore-str', 'aTargets': [11, 12, 13, 14, 15] }"); - // set progress column index to 18 - progressIndex = "[18]"; + sb.append("{'sType':'num-ignore-str', ") + .append("'aTargets': [12, 13, 14, 15, 16] },\n"); + // set progress column index to 19 + progressIndex = "[19]"; } else if (isFairSchedulerPage) { // Update following line if any column added in scheduler page before column 11 - sb.append("\n, {'sType':'num-ignore-str', 'aTargets': [11, 12, 13, 14, 15] }"); + sb.append("{'sType':'num-ignore-str', ") + .append("'aTargets': [11, 12, 13, 14, 15] },\n"); // set progress column index to 16 progressIndex = "[16]"; } - sb.append("\n, {'sType':'numeric', bSearchable:false, 'aTargets':"); - sb.append(progressIndex); - sb.append(", 'mRender': parseHadoopProgress }]"); + sb.append("{'sType':'numeric', bSearchable:false, 'aTargets':") + .append(progressIndex) + .append(", 'mRender': parseHadoopProgress }\n]"); return sb.toString(); } 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/ColumnHeader.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/ColumnHeader.java new file mode 100644 index 00000000000..a251c98f6f3 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/ColumnHeader.java @@ -0,0 +1,48 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hadoop.yarn.server.resourcemanager.webapp; + +/** + * Header for a Web UI column. This used with TH. + */ +public class ColumnHeader { + private String selector; + private String cdata; + + public ColumnHeader(String pselector, String pcdata) { + this.selector = pselector; + this.cdata = pcdata; + } + + /** + * Get the selector field for the TH. + * @return Selector. + */ + public String getSelector() { + return this.selector; + } + + /** + * Get the cdata field for the TH. + * @return CData. + */ + public String getCData() { + return this.cdata; + } +} 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/RMAppsBlock.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMAppsBlock.java index 3d257b774f8..8868fa10935 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMAppsBlock.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMAppsBlock.java @@ -42,6 +42,8 @@ import org.apache.hadoop.yarn.webapp.View; import org.apache.hadoop.yarn.webapp.hamlet2.Hamlet; import org.apache.hadoop.yarn.webapp.hamlet2.Hamlet.TABLE; import org.apache.hadoop.yarn.webapp.hamlet2.Hamlet.TBODY; +import org.apache.hadoop.yarn.webapp.hamlet2.Hamlet.THEAD; +import org.apache.hadoop.yarn.webapp.hamlet2.Hamlet.TR; import com.google.inject.Inject; @@ -49,6 +51,32 @@ public class RMAppsBlock extends AppsBlock { private ResourceManager rm; + /** Columns for the Apps RM page. */ + static final ColumnHeader[] COLUMNS = { + new ColumnHeader(".id", "ID"), + new ColumnHeader(".user", "User"), + new ColumnHeader(".name", "Name"), + new ColumnHeader(".type", "Application Type"), + new ColumnHeader(".apptag", "Application Tags"), + new ColumnHeader(".queue", "Queue"), + new ColumnHeader(".priority", "Application Priority"), + new ColumnHeader(".starttime", "StartTime"), + new ColumnHeader(".IDlaunchtime", "LaunchTime"), + new ColumnHeader(".finishtime", "FinishTime"), + new ColumnHeader(".state", "State"), + new ColumnHeader(".finalstatus", "FinalStatus"), + new ColumnHeader(".runningcontainer", "Running Containers"), + new ColumnHeader(".allocatedCpu", "Allocated CPU VCores"), + new ColumnHeader(".allocatedMemory", "Allocated Memory MB"), + new ColumnHeader(".reservedCpu", "Reserved CPU VCores"), + new ColumnHeader(".reservedMemory", "Reserved Memory MB"), + new ColumnHeader(".queuePercentage", "% of Queue"), + new ColumnHeader(".clusterPercentage", "% of Cluster"), + new ColumnHeader(".progress", "Progress"), + new ColumnHeader(".ui", "Tracking UI"), + new ColumnHeader(".blacklisted", "Blacklisted Nodes"), + }; + @Inject RMAppsBlock(ResourceManager rm, View.ViewContext ctx) { super(null, ctx); @@ -57,26 +85,12 @@ public class RMAppsBlock extends AppsBlock { @Override protected void renderData(Block html) { - TBODY