YARN-2503. Added node lablels in web UI. Contributed by Wangda Tan
(cherry picked from commitd5e0a09721
) (cherry picked from commit720de7eb4c
)
This commit is contained in:
parent
c0b17bf104
commit
e181498a67
|
@ -343,6 +343,8 @@ Release 2.6.0 - UNRELEASED
|
|||
|
||||
YARN-2760. Remove 'experimental' from FairScheduler docs. (Harsh J via kasha)
|
||||
|
||||
YARN-2503. Added node lablels in web UI. (Wangda Tan via jianhe)
|
||||
|
||||
OPTIMIZATIONS
|
||||
|
||||
BUG FIXES
|
||||
|
|
|
@ -120,7 +120,8 @@ class CapacitySchedulerPage extends RmView {
|
|||
_("Configured Max Capacity:", percent(lqinfo.getMaxCapacity() / 100)).
|
||||
_("Configured Minimum User Limit Percent:", Integer.toString(lqinfo.getUserLimit()) + "%").
|
||||
_("Configured User Limit Factor:", String.format("%.1f", lqinfo.getUserLimitFactor())).
|
||||
_r("Active users: ", activeUserList.toString());
|
||||
_("Active Users: ", activeUserList.toString()).
|
||||
_r("Accessible Node Labels:", StringUtils.join(",", lqinfo.getNodeLabels()));
|
||||
|
||||
html._(InfoBlock.class);
|
||||
|
||||
|
|
|
@ -66,6 +66,7 @@ class NodesPage extends RmView {
|
|||
TBODY<TABLE<Hamlet>> tbody = html.table("#nodes").
|
||||
thead().
|
||||
tr().
|
||||
th(".nodelabels", "Node Labels").
|
||||
th(".rack", "Rack").
|
||||
th(".state", "Node State").
|
||||
th(".nodeaddress", "Node Address").
|
||||
|
@ -113,6 +114,7 @@ class NodesPage extends RmView {
|
|||
int usedMemory = (int)info.getUsedMemory();
|
||||
int availableMemory = (int)info.getAvailableMemory();
|
||||
TR<TBODY<TABLE<Hamlet>>> row = tbody.tr().
|
||||
td(StringUtils.join(",", info.getNodeLabels())).
|
||||
td(info.getRack()).
|
||||
td(info.getState()).
|
||||
td(info.getNodeId());
|
||||
|
|
|
@ -17,6 +17,10 @@
|
|||
*/
|
||||
package org.apache.hadoop.yarn.server.resourcemanager.webapp.dao;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
@ -50,6 +54,7 @@ public class CapacitySchedulerQueueInfo {
|
|||
protected CapacitySchedulerQueueInfoList queues;
|
||||
protected ResourceInfo resourcesUsed;
|
||||
private boolean hideReservationQueues = false;
|
||||
protected ArrayList<String> nodeLabels = new ArrayList<String>();
|
||||
|
||||
CapacitySchedulerQueueInfo() {
|
||||
};
|
||||
|
@ -75,6 +80,13 @@ public class CapacitySchedulerQueueInfo {
|
|||
!((PlanQueue)q).showReservationsAsQueues()) {
|
||||
hideReservationQueues = true;
|
||||
}
|
||||
|
||||
// add labels
|
||||
Set<String> labelSet = q.getAccessibleNodeLabels();
|
||||
if (labelSet != null) {
|
||||
nodeLabels.addAll(labelSet);
|
||||
Collections.sort(nodeLabels);
|
||||
}
|
||||
}
|
||||
|
||||
public float getCapacity() {
|
||||
|
@ -138,4 +150,8 @@ public class CapacitySchedulerQueueInfo {
|
|||
static float cap(float val, float low, float hi) {
|
||||
return Math.min(Math.max(val, low), hi);
|
||||
}
|
||||
|
||||
public ArrayList<String> getNodeLabels() {
|
||||
return this.nodeLabels;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,10 @@
|
|||
|
||||
package org.apache.hadoop.yarn.server.resourcemanager.webapp.dao;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
@ -45,6 +49,7 @@ public class NodeInfo {
|
|||
protected long availMemoryMB;
|
||||
protected long usedVirtualCores;
|
||||
protected long availableVirtualCores;
|
||||
protected ArrayList<String> nodeLabels = new ArrayList<String>();
|
||||
|
||||
public NodeInfo() {
|
||||
} // JAXB needs this
|
||||
|
@ -70,6 +75,13 @@ public class NodeInfo {
|
|||
this.lastHealthUpdate = ni.getLastHealthReportTime();
|
||||
this.healthReport = String.valueOf(ni.getHealthReport());
|
||||
this.version = ni.getNodeManagerVersion();
|
||||
|
||||
// add labels
|
||||
Set<String> labelSet = ni.getNodeLabels();
|
||||
if (labelSet != null) {
|
||||
nodeLabels.addAll(labelSet);
|
||||
Collections.sort(nodeLabels);
|
||||
}
|
||||
}
|
||||
|
||||
public String getRack() {
|
||||
|
@ -124,4 +136,7 @@ public class NodeInfo {
|
|||
return this.availableVirtualCores;
|
||||
}
|
||||
|
||||
public ArrayList<String> getNodeLabels() {
|
||||
return this.nodeLabels;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ public class TestNodesPage {
|
|||
// Number of Actual Table Headers for NodesPage.NodesBlock might change in
|
||||
// future. In that case this value should be adjusted to the new value.
|
||||
final int numberOfThInMetricsTable = 16;
|
||||
final int numberOfActualTableHeaders = 12;
|
||||
final int numberOfActualTableHeaders = 13;
|
||||
|
||||
private Injector injector;
|
||||
|
||||
|
|
|
@ -357,10 +357,10 @@ public class TestRMWebServicesCapacitySched extends JerseyTest {
|
|||
private void verifySubQueue(JSONObject info, String q,
|
||||
float parentAbsCapacity, float parentAbsMaxCapacity)
|
||||
throws JSONException, Exception {
|
||||
int numExpectedElements = 12;
|
||||
int numExpectedElements = 13;
|
||||
boolean isParentQueue = true;
|
||||
if (!info.has("queues")) {
|
||||
numExpectedElements = 22;
|
||||
numExpectedElements = 23;
|
||||
isParentQueue = false;
|
||||
}
|
||||
assertEquals("incorrect number of elements", numExpectedElements, info.length());
|
||||
|
|
Loading…
Reference in New Issue