hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From junping...@apache.org
Subject hadoop git commit: YARN-6126. Obtaining app logs for Running application fails with json parse error. Contributed by Xuan Gong. (cherry picked from commit 1a16431bd0df52d2df32c594f8b9b506c2101ad8)
Date Fri, 27 Jan 2017 14:48:35 GMT
Repository: hadoop
Updated Branches:
  refs/heads/branch-2 6b602c6e3 -> 660f4d863


YARN-6126. Obtaining app logs for Running application fails with json parse error. Contributed
by Xuan Gong.
(cherry picked from commit 1a16431bd0df52d2df32c594f8b9b506c2101ad8)

Conflicts:

	hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/LogsCLI.java


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/660f4d86
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/660f4d86
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/660f4d86

Branch: refs/heads/branch-2
Commit: 660f4d86316dd12e875aefc38b07f3e99fdc5124
Parents: 6b602c6
Author: Junping Du <junping_du@apache.org>
Authored: Fri Jan 27 06:31:10 2017 -0800
Committer: Junping Du <junping_du@apache.org>
Committed: Fri Jan 27 06:33:44 2017 -0800

----------------------------------------------------------------------
 .../java/org/apache/hadoop/yarn/client/cli/LogsCLI.java  | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/660f4d86/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/LogsCLI.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/LogsCLI.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/LogsCLI.java
index 74d553c..7747116 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/LogsCLI.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/LogsCLI.java
@@ -426,9 +426,18 @@ public class LogsCLI extends Configured implements Tool {
       if (response.getClientResponseStatus().equals(
           ClientResponse.Status.OK)) {
         try {
+          JSONArray array = new JSONArray();
           JSONObject json =
               response.getEntity(JSONObject.class);
-          JSONArray array = json.getJSONArray("containerLogsInfo");
+          Object logsInfoObj = json.get("containerLogsInfo");
+          if (logsInfoObj instanceof JSONObject) {
+            array.put((JSONObject)logsInfoObj);
+          } else if (logsInfoObj instanceof JSONArray) {
+            JSONArray logsArray = (JSONArray)logsInfoObj;
+            for (int i=0; i < logsArray.length(); i++) {
+              array.put(logsArray.getJSONObject(i));
+            }
+          }
           for (int i = 0; i < array.length(); i++) {
             JSONObject log = array.getJSONObject(i);
             Object ob = log.get("containerLogInfo");


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message