From 53f559dd797e1bf3bd144a5721615eafc055e005 Mon Sep 17 00:00:00 2001 From: Vinod Kumar Vavilapalli Date: Wed, 28 Aug 2013 05:46:09 +0000 Subject: [PATCH] YARN-1081. Made a trivial change to YARN node CLI header to avoid potential confusion. Contributed by Akira AJISAKA. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1518080 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-yarn-project/CHANGES.txt | 3 + .../hadoop/yarn/client/cli/NodeCLI.java | 4 +- .../hadoop/yarn/client/cli/TestYarnCLI.java | 92 +++++++++---------- 3 files changed, 51 insertions(+), 48 deletions(-) diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index 556d5163e0..2945b77817 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -57,6 +57,9 @@ Release 2.1.1-beta - UNRELEASED YARN-1083. Changed ResourceManager to fail when the expiry interval is less than the configured node-heartbeat interval. (Zhijie Shen via vinodkv) + YARN-1081. Made a trivial change to YARN node CLI header to avoid potential + confusion. (Akira AJISAKA via vinodkv) + OPTIMIZATIONS BUG FIXES diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/NodeCLI.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/NodeCLI.java index afe3287b5f..c62b4d4059 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/NodeCLI.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/NodeCLI.java @@ -43,7 +43,7 @@ @Private @Unstable public class NodeCLI extends YarnCLI { - private static final String NODES_PATTERN = "%16s\t%15s\t%17s\t%18s" + + private static final String NODES_PATTERN = "%16s\t%15s\t%17s\t%28s" + System.getProperty("line.separator"); private static final String NODE_STATE_CMD = "states"; @@ -133,7 +133,7 @@ private void listClusterNodes(Set nodeStates) nodeStates.toArray(new NodeState[0])); writer.println("Total Nodes:" + nodesReport.size()); writer.printf(NODES_PATTERN, "Node-Id", "Node-State", "Node-Http-Address", - "Running-Containers"); + "Number-of-Running-Containers"); for (NodeReport nodeReport : nodesReport) { writer.printf(NODES_PATTERN, nodeReport.getNodeId(), nodeReport .getNodeState(), nodeReport.getHttpAddress(), nodeReport diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/cli/TestYarnCLI.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/cli/TestYarnCLI.java index 6d53108f95..c6b49465e1 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/cli/TestYarnCLI.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/cli/TestYarnCLI.java @@ -543,9 +543,9 @@ public void testListClusterNodes() throws Exception { PrintWriter pw = new PrintWriter(baos); pw.println("Total Nodes:1"); pw.print(" Node-Id\t Node-State\tNode-Http-Address\t"); - pw.println("Running-Containers"); - pw.print(" host0:0\t NEW\t host1:8888"); - pw.println("\t 0"); + pw.println("Number-of-Running-Containers"); + pw.print(" host0:0\t NEW\t host1:8888\t"); + pw.println(" 0"); pw.close(); String nodesReportStr = baos.toString("UTF-8"); Assert.assertEquals(nodesReportStr, sysOutStream.toString()); @@ -564,11 +564,11 @@ public void testListClusterNodes() throws Exception { pw = new PrintWriter(baos); pw.println("Total Nodes:2"); pw.print(" Node-Id\t Node-State\tNode-Http-Address\t"); - pw.println("Running-Containers"); - pw.print(" host0:0\t RUNNING\t host1:8888"); - pw.println("\t 0"); - pw.print(" host1:0\t RUNNING\t host1:8888"); - pw.println("\t 0"); + pw.println("Number-of-Running-Containers"); + pw.print(" host0:0\t RUNNING\t host1:8888\t"); + pw.println(" 0"); + pw.print(" host1:0\t RUNNING\t host1:8888\t"); + pw.println(" 0"); pw.close(); nodesReportStr = baos.toString("UTF-8"); Assert.assertEquals(nodesReportStr, sysOutStream.toString()); @@ -593,9 +593,9 @@ public void testListClusterNodes() throws Exception { pw = new PrintWriter(baos); pw.println("Total Nodes:1"); pw.print(" Node-Id\t Node-State\tNode-Http-Address\t"); - pw.println("Running-Containers"); - pw.print(" host0:0\t UNHEALTHY\t host1:8888"); - pw.println("\t 0"); + pw.println("Number-of-Running-Containers"); + pw.print(" host0:0\t UNHEALTHY\t host1:8888\t"); + pw.println(" 0"); pw.close(); nodesReportStr = baos.toString("UTF-8"); Assert.assertEquals(nodesReportStr, sysOutStream.toString()); @@ -614,9 +614,9 @@ public void testListClusterNodes() throws Exception { pw = new PrintWriter(baos); pw.println("Total Nodes:1"); pw.print(" Node-Id\t Node-State\tNode-Http-Address\t"); - pw.println("Running-Containers"); - pw.print(" host0:0\t DECOMMISSIONED\t host1:8888"); - pw.println("\t 0"); + pw.println("Number-of-Running-Containers"); + pw.print(" host0:0\t DECOMMISSIONED\t host1:8888\t"); + pw.println(" 0"); pw.close(); nodesReportStr = baos.toString("UTF-8"); Assert.assertEquals(nodesReportStr, sysOutStream.toString()); @@ -635,9 +635,9 @@ public void testListClusterNodes() throws Exception { pw = new PrintWriter(baos); pw.println("Total Nodes:1"); pw.print(" Node-Id\t Node-State\tNode-Http-Address\t"); - pw.println("Running-Containers"); - pw.print(" host0:0\t REBOOTED\t host1:8888"); - pw.println("\t 0"); + pw.println("Number-of-Running-Containers"); + pw.print(" host0:0\t REBOOTED\t host1:8888\t"); + pw.println(" 0"); pw.close(); nodesReportStr = baos.toString("UTF-8"); Assert.assertEquals(nodesReportStr, sysOutStream.toString()); @@ -656,9 +656,9 @@ public void testListClusterNodes() throws Exception { pw = new PrintWriter(baos); pw.println("Total Nodes:1"); pw.print(" Node-Id\t Node-State\tNode-Http-Address\t"); - pw.println("Running-Containers"); - pw.print(" host0:0\t LOST\t host1:8888"); - pw.println("\t 0"); + pw.println("Number-of-Running-Containers"); + pw.print(" host0:0\t LOST\t host1:8888\t"); + pw.println(" 0"); pw.close(); nodesReportStr = baos.toString("UTF-8"); Assert.assertEquals(nodesReportStr, sysOutStream.toString()); @@ -681,17 +681,17 @@ public void testListClusterNodes() throws Exception { pw = new PrintWriter(baos); pw.println("Total Nodes:5"); pw.print(" Node-Id\t Node-State\tNode-Http-Address\t"); - pw.println("Running-Containers"); - pw.print(" host0:0\t NEW\t host1:8888"); - pw.println("\t 0"); - pw.print(" host0:0\t RUNNING\t host1:8888"); - pw.println("\t 0"); - pw.print(" host1:0\t RUNNING\t host1:8888"); - pw.println("\t 0"); - pw.print(" host0:0\t REBOOTED\t host1:8888"); - pw.println("\t 0"); - pw.print(" host0:0\t LOST\t host1:8888"); - pw.println("\t 0"); + pw.println("Number-of-Running-Containers"); + pw.print(" host0:0\t NEW\t host1:8888\t"); + pw.println(" 0"); + pw.print(" host0:0\t RUNNING\t host1:8888\t"); + pw.println(" 0"); + pw.print(" host1:0\t RUNNING\t host1:8888\t"); + pw.println(" 0"); + pw.print(" host0:0\t REBOOTED\t host1:8888\t"); + pw.println(" 0"); + pw.print(" host0:0\t LOST\t host1:8888\t"); + pw.println(" 0"); pw.close(); nodesReportStr = baos.toString("UTF-8"); Assert.assertEquals(nodesReportStr, sysOutStream.toString()); @@ -712,21 +712,21 @@ public void testListClusterNodes() throws Exception { pw = new PrintWriter(baos); pw.println("Total Nodes:7"); pw.print(" Node-Id\t Node-State\tNode-Http-Address\t"); - pw.println("Running-Containers"); - pw.print(" host0:0\t NEW\t host1:8888"); - pw.println("\t 0"); - pw.print(" host0:0\t RUNNING\t host1:8888"); - pw.println("\t 0"); - pw.print(" host1:0\t RUNNING\t host1:8888"); - pw.println("\t 0"); - pw.print(" host0:0\t UNHEALTHY\t host1:8888"); - pw.println("\t 0"); - pw.print(" host0:0\t DECOMMISSIONED\t host1:8888"); - pw.println("\t 0"); - pw.print(" host0:0\t REBOOTED\t host1:8888"); - pw.println("\t 0"); - pw.print(" host0:0\t LOST\t host1:8888"); - pw.println("\t 0"); + pw.println("Number-of-Running-Containers"); + pw.print(" host0:0\t NEW\t host1:8888\t"); + pw.println(" 0"); + pw.print(" host0:0\t RUNNING\t host1:8888\t"); + pw.println(" 0"); + pw.print(" host1:0\t RUNNING\t host1:8888\t"); + pw.println(" 0"); + pw.print(" host0:0\t UNHEALTHY\t host1:8888\t"); + pw.println(" 0"); + pw.print(" host0:0\t DECOMMISSIONED\t host1:8888\t"); + pw.println(" 0"); + pw.print(" host0:0\t REBOOTED\t host1:8888\t"); + pw.println(" 0"); + pw.print(" host0:0\t LOST\t host1:8888\t"); + pw.println(" 0"); pw.close(); nodesReportStr = baos.toString("UTF-8"); Assert.assertEquals(nodesReportStr, sysOutStream.toString());