YARN-6126. Obtaining app logs for Running application fails with json parse error. Contributed by Xuan Gong.
(cherry picked from commit 1a16431bd0
)
Conflicts:
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/LogsCLI.java
This commit is contained in:
parent
6b602c6e34
commit
660f4d8631
|
@ -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");
|
||||
|
|
Loading…
Reference in New Issue