YARN-3432. Cluster metrics have wrong Total Memory when there is reserved memory on CS. (Brahma Reddy Battula via curino)
This commit is contained in:
parent
79ae78dcbe
commit
892a8348fc
@ -25,6 +25,7 @@
|
|||||||
import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager;
|
import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.QueueMetrics;
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.QueueMetrics;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.ResourceScheduler;
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.ResourceScheduler;
|
||||||
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacityScheduler;
|
||||||
|
|
||||||
@XmlRootElement(name = "clusterMetrics")
|
@XmlRootElement(name = "clusterMetrics")
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
@ -87,8 +88,14 @@ public ClusterMetricsInfo(final ResourceManager rm) {
|
|||||||
this.containersPending = metrics.getPendingContainers();
|
this.containersPending = metrics.getPendingContainers();
|
||||||
this.containersReserved = metrics.getReservedContainers();
|
this.containersReserved = metrics.getReservedContainers();
|
||||||
|
|
||||||
|
if (rs instanceof CapacityScheduler) {
|
||||||
|
this.totalMB = availableMB + allocatedMB + reservedMB;
|
||||||
|
this.totalVirtualCores = availableVirtualCores + allocatedVirtualCores
|
||||||
|
+ containersReserved;
|
||||||
|
} else {
|
||||||
this.totalMB = availableMB + allocatedMB;
|
this.totalMB = availableMB + allocatedMB;
|
||||||
this.totalVirtualCores = availableVirtualCores + allocatedVirtualCores;
|
this.totalVirtualCores = availableVirtualCores + allocatedVirtualCores;
|
||||||
|
}
|
||||||
this.activeNodes = clusterMetrics.getNumActiveNMs();
|
this.activeNodes = clusterMetrics.getNumActiveNMs();
|
||||||
this.lostNodes = clusterMetrics.getNumLostNMs();
|
this.lostNodes = clusterMetrics.getNumLostNMs();
|
||||||
this.unhealthyNodes = clusterMetrics.getUnhealthyNMs();
|
this.unhealthyNodes = clusterMetrics.getUnhealthyNMs();
|
||||||
|
Loading…
Reference in New Issue
Block a user