From 8ab642989c47497dc7ddada0d7888795b9974816 Mon Sep 17 00:00:00 2001 From: Jason Lowe Date: Tue, 15 Dec 2015 18:06:13 +0000 Subject: [PATCH] YARN-4439. Clarify NMContainerStatus#toString method. Contributed by Jian He --- hadoop-yarn-project/CHANGES.txt | 2 ++ .../impl/pb/NMContainerStatusPBImpl.java | 13 ++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index 8063080fd20..2f935f38526 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -46,6 +46,8 @@ Release 2.7.3 - UNRELEASED YARN-4422. Generic AHS sometimes doesn't show started, node, or logs on App page (Eric Payne via jeagles) + YARN-4439. Clarify NMContainerStatus#toString method. (Jian He via xgong) + MAPREDUCE-6436. JobHistory cache issue. (Kai Sasaki via zxu) Release 2.7.2 - UNRELEASED diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/NMContainerStatusPBImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/NMContainerStatusPBImpl.java index 86e1d971aa4..32ad6669b84 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/NMContainerStatusPBImpl.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/NMContainerStatusPBImpl.java @@ -34,8 +34,6 @@ import org.apache.hadoop.yarn.proto.YarnServerCommonServiceProtos.NMContainerSta import org.apache.hadoop.yarn.proto.YarnServerCommonServiceProtos.NMContainerStatusProtoOrBuilder; import org.apache.hadoop.yarn.server.api.protocolrecords.NMContainerStatus; -import com.google.protobuf.TextFormat; - public class NMContainerStatusPBImpl extends NMContainerStatus { NMContainerStatusProto proto = NMContainerStatusProto @@ -81,7 +79,16 @@ public class NMContainerStatusPBImpl extends NMContainerStatus { @Override public String toString() { - return TextFormat.shortDebugString(getProto()); + StringBuilder sb = new StringBuilder(); + sb.append("[").append(getContainerId()).append(", ") + .append("CreateTime: ").append(getCreationTime()).append(", ") + .append("State: ").append(getContainerState()).append(", ") + .append("Capability: ").append(getAllocatedResource()).append(", ") + .append("Diagnostics: ").append(getDiagnostics()).append(", ") + .append("ExitStatus: ").append(getContainerExitStatus()).append(", ") + .append("Priority: ").append(getPriority()) + .append("]"); + return sb.toString(); } @Override