YARN-6481. Yarn top shows negative container number in FS

(Contributed by Tao Jie via Daniel Templeton)
This commit is contained in:
Daniel Templeton 2017-05-02 13:04:40 -07:00
parent b062b323b7
commit 9f0aea0ee2
2 changed files with 18 additions and 0 deletions

View File

@ -253,6 +253,9 @@ public QueueStatistics getQueueStatistics() {
stats.setAllocatedVCores(getMetrics().getAllocatedVirtualCores());
stats.setPendingVCores(getMetrics().getPendingVirtualCores());
stats.setReservedVCores(getMetrics().getReservedVirtualCores());
stats.setAllocatedContainers(getMetrics().getAllocatedContainers());
stats.setPendingContainers(getMetrics().getPendingContainers());
stats.setReservedContainers(getMetrics().getReservedContainers());
return stats;
}

View File

@ -874,6 +874,11 @@ public void testQueueInfo() throws IOException {
QueueInfo queueInfo = scheduler.getQueueInfo("queueA", false, false);
Assert.assertEquals(0.25f, queueInfo.getCapacity(), 0.0f);
Assert.assertEquals(0.0f, queueInfo.getCurrentCapacity(), 0.0f);
// test queueMetrics
Assert.assertEquals(0, queueInfo.getQueueStatistics()
.getAllocatedContainers());
Assert.assertEquals(0, queueInfo.getQueueStatistics()
.getAllocatedMemoryMB());
queueInfo = scheduler.getQueueInfo("queueB", false, false);
Assert.assertEquals(0.75f, queueInfo.getCapacity(), 0.0f);
Assert.assertEquals(0.0f, queueInfo.getCurrentCapacity(), 0.0f);
@ -889,9 +894,19 @@ public void testQueueInfo() throws IOException {
queueInfo = scheduler.getQueueInfo("queueA", false, false);
Assert.assertEquals(0.25f, queueInfo.getCapacity(), 0.0f);
Assert.assertEquals(0.5f, queueInfo.getCurrentCapacity(), 0.0f);
// test queueMetrics
Assert.assertEquals(1, queueInfo.getQueueStatistics()
.getAllocatedContainers());
Assert.assertEquals(1024, queueInfo.getQueueStatistics()
.getAllocatedMemoryMB());
queueInfo = scheduler.getQueueInfo("queueB", false, false);
Assert.assertEquals(0.75f, queueInfo.getCapacity(), 0.0f);
Assert.assertEquals(1.0f, queueInfo.getCurrentCapacity(), 0.0f);
// test queueMetrics
Assert.assertEquals(1, queueInfo.getQueueStatistics()
.getAllocatedContainers());
Assert.assertEquals(6144, queueInfo.getQueueStatistics()
.getAllocatedMemoryMB());
}
@Test