YARN-6367. YARN logs CLI needs alway check containerLogsInfo/containerLogInfo before parse the JSON object from NMWebService. Contributed by Xuan Gong.
(cherry picked from commit c01d15ab27
)
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
84e2c11f96
commit
dabe96a72e
|
@ -431,6 +431,9 @@ public class LogsCLI extends Configured implements Tool {
|
|||
JSONArray array = new JSONArray();
|
||||
JSONObject json =
|
||||
response.getEntity(JSONObject.class);
|
||||
if (!json.has("containerLogsInfo")) {
|
||||
return logFileInfos;
|
||||
}
|
||||
Object logsInfoObj = json.get("containerLogsInfo");
|
||||
if (logsInfoObj instanceof JSONObject) {
|
||||
array.put((JSONObject)logsInfoObj);
|
||||
|
@ -444,6 +447,9 @@ public class LogsCLI extends Configured implements Tool {
|
|||
JSONObject log = array.getJSONObject(i);
|
||||
String aggregateType = log.has("logAggregationType") ?
|
||||
log.getString("logAggregationType") : "N/A";
|
||||
if (!log.has("containerLogInfo")) {
|
||||
continue;
|
||||
}
|
||||
Object ob = log.get("containerLogInfo");
|
||||
if (ob instanceof JSONArray) {
|
||||
JSONArray obArray = (JSONArray)ob;
|
||||
|
|
Loading…
Reference in New Issue