From 992f65dd8b53ee31b6b7347e2cfe59a78d031268 Mon Sep 17 00:00:00 2001 From: Xuan Date: Mon, 14 Dec 2015 15:41:28 -0800 Subject: [PATCH] YARN-4439. Clarify NMContainerStatus#toString method. Contributed by Jian He (cherry picked from commit d8a45425eba372cdebef3be50436b6ddf1c4e192) --- hadoop-yarn-project/CHANGES.txt | 2 ++ .../impl/pb/NMContainerStatusPBImpl.java | 14 +++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index 7d98f3529f5..2d3d86160b0 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -1129,6 +1129,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) + Release 2.7.2 - UNRELEASED INCOMPATIBLE CHANGES 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 624b89bffb5..921c9d90d7c 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 @@ -35,8 +35,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 @@ -82,7 +80,17 @@ 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("NodeLabelExpression: ").append(getNodeLabelExpression()) + .append("Priority: ").append(getPriority()) + .append("]"); + return sb.toString(); } @Override