YARN-11653. Add Totoal_Memory and Total_Vcores columns in Nodes page (#6501) Contributed by Jiandan Yang.

Signed-off-by: Shilun Fan <slfan1989@apache.org>
This commit is contained in:
Yang Jiandan 2024-01-31 07:07:54 +08:00 committed by GitHub
parent 8261229daa
commit 98259fb4da
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 1 deletions

View File

@ -88,18 +88,22 @@ protected void render(Block html) {
.th(".allocationTags", "Allocation Tags") .th(".allocationTags", "Allocation Tags")
.th(".mem", "Mem Used") .th(".mem", "Mem Used")
.th(".mem", "Mem Avail") .th(".mem", "Mem Avail")
.th(".mem", "Mem Total")
.th(".mem", "Phys Mem Used %") .th(".mem", "Phys Mem Used %")
.th(".vcores", "VCores Used") .th(".vcores", "VCores Used")
.th(".vcores", "VCores Avail") .th(".vcores", "VCores Avail")
.th(".vcores", "VCores Total")
.th(".vcores", "Phys VCores Used %"); .th(".vcores", "Phys VCores Used %");
} else { } else {
trbody.th(".containers", "Running Containers (G)") trbody.th(".containers", "Running Containers (G)")
.th(".allocationTags", "Allocation Tags") .th(".allocationTags", "Allocation Tags")
.th(".mem", "Mem Used (G)") .th(".mem", "Mem Used (G)")
.th(".mem", "Mem Avail (G)") .th(".mem", "Mem Avail (G)")
.th(".mem", "Mem Total")
.th(".mem", "Phys Mem Used %") .th(".mem", "Phys Mem Used %")
.th(".vcores", "VCores Used (G)") .th(".vcores", "VCores Used (G)")
.th(".vcores", "VCores Avail (G)") .th(".vcores", "VCores Avail (G)")
.th(".vcores", "VCores Total")
.th(".vcores", "Phys VCores Used %") .th(".vcores", "Phys VCores Used %")
.th(".containers", "Running Containers (O)") .th(".containers", "Running Containers (O)")
.th(".mem", "Mem Used (O)") .th(".mem", "Mem Used (O)")
@ -175,6 +179,8 @@ protected void render(Block html) {
NodeInfo info = new NodeInfo(ni, sched); NodeInfo info = new NodeInfo(ni, sched);
int usedMemory = (int) info.getUsedMemory(); int usedMemory = (int) info.getUsedMemory();
int availableMemory = (int) info.getAvailableMemory(); int availableMemory = (int) info.getAvailableMemory();
long totalMemory = info.getTotalResource().getMemorySize();
int totalVcore = info.getTotalResource().getvCores();
nodeTableData.append("[\"") nodeTableData.append("[\"")
.append(StringUtils.join(",", info.getNodeLabels())).append("\",\"") .append(StringUtils.join(",", info.getNodeLabels())).append("\",\"")
.append(info.getRack()).append("\",\"").append(info.getState()) .append(info.getRack()).append("\",\"").append(info.getState())
@ -198,6 +204,8 @@ protected void render(Block html) {
.append("\",\"").append("<br title='") .append("\",\"").append("<br title='")
.append(String.valueOf(availableMemory)).append("'>") .append(String.valueOf(availableMemory)).append("'>")
.append(StringUtils.byteDesc(availableMemory * BYTES_IN_MB)) .append(StringUtils.byteDesc(availableMemory * BYTES_IN_MB))
.append("\",\"").append("<br title='").append(String.valueOf(totalMemory))
.append("'>").append(StringUtils.byteDesc(totalMemory * BYTES_IN_MB))
.append("\",\"") .append("\",\"")
.append(String.valueOf((int) info.getMemUtilization())) .append(String.valueOf((int) info.getMemUtilization()))
.append("\",\"") .append("\",\"")
@ -205,6 +213,8 @@ protected void render(Block html) {
.append("\",\"") .append("\",\"")
.append(String.valueOf(info.getAvailableVirtualCores())) .append(String.valueOf(info.getAvailableVirtualCores()))
.append("\",\"") .append("\",\"")
.append(String.valueOf(totalVcore))
.append("\",\"")
.append(String.valueOf((int) info.getVcoreUtilization())) .append(String.valueOf((int) info.getVcoreUtilization()))
.append("\",\""); .append("\",\"");

View File

@ -52,7 +52,7 @@ public class TestNodesPage {
// Number of Actual Table Headers for NodesPage.NodesBlock might change in // Number of Actual Table Headers for NodesPage.NodesBlock might change in
// future. In that case this value should be adjusted to the new value. // future. In that case this value should be adjusted to the new value.
private final int numberOfThInMetricsTable = 25; private final int numberOfThInMetricsTable = 25;
private final int numberOfActualTableHeaders = 16; private final int numberOfActualTableHeaders = 18;
private final int numberOfThForOpportunisticContainers = 4; private final int numberOfThForOpportunisticContainers = 4;
private Injector injector; private Injector injector;