YARN-380. Fix yarn node -status output to be better readable. Contributed by Omkar Vinit Joshi.

svn merge --ignore-ancestry -c 1451711. ../../trunk/


git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1451712 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Vinod Kumar Vavilapalli 2013-03-01 20:39:59 +00:00
parent 2b7d8ed210
commit ef48c24a74
3 changed files with 13 additions and 4 deletions

View File

@ -11,6 +11,9 @@ Release 2.0.4-beta - UNRELEASED
YARN-365. Change NM heartbeat handling to not generate a scheduler event
on each heartbeat. (Xuan Gong via sseth)
YARN-380. Fix yarn node -status output to be better readable. (Omkar Vinit
Joshi via vinodkv)
OPTIMIZATIONS
BUG FIXES

View File

@ -20,12 +20,14 @@ package org.apache.hadoop.yarn.client.cli;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Date;
import java.util.List;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.GnuParser;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Options;
import org.apache.commons.lang.time.DateFormatUtils;
import org.apache.hadoop.util.ToolRunner;
import org.apache.hadoop.yarn.api.records.NodeId;
import org.apache.hadoop.yarn.api.records.NodeReport;
@ -129,9 +131,10 @@ public class NodeCLI extends YarnCLI {
nodeReportStr.print("\tHealth-Status(isNodeHealthy) : ");
nodeReportStr.println(nodeReport.getNodeHealthStatus()
.getIsNodeHealthy());
nodeReportStr.print("\tLast-Last-Health-Update : ");
nodeReportStr.println(nodeReport.getNodeHealthStatus()
.getLastHealthReportTime());
nodeReportStr.print("\tLast-Health-Update : ");
nodeReportStr.println(DateFormatUtils.format(
new Date(nodeReport.getNodeHealthStatus().
getLastHealthReportTime()),"E dd/MMM/yy hh:mm:ss:SSzz"));
nodeReportStr.print("\tHealth-Report : ");
nodeReportStr
.println(nodeReport.getNodeHealthStatus().getHealthReport());

View File

@ -31,10 +31,12 @@ import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import junit.framework.Assert;
import org.apache.commons.lang.time.DateFormatUtils;
import org.apache.hadoop.yarn.api.records.ApplicationId;
import org.apache.hadoop.yarn.api.records.ApplicationReport;
import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
@ -185,7 +187,8 @@ public class TestYarnCLI {
pw.println("\tNode-State : RUNNING");
pw.println("\tNode-Http-Address : host1:8888");
pw.println("\tHealth-Status(isNodeHealthy) : false");
pw.println("\tLast-Last-Health-Update : 0");
pw.println("\tLast-Health-Update : "
+ DateFormatUtils.format(new Date(0), "E dd/MMM/yy hh:mm:ss:SSzz"));
pw.println("\tHealth-Report : null");
pw.println("\tContainers : 0");
pw.println("\tMemory-Used : 0M");