YARN-6367. YARN logs CLI needs alway check containerLogsInfo/containerLogInfo before parse the JSON object from NMWebService. Contributed by Xuan Gong.
This commit is contained in:
parent
74af0bdf68
commit
c01d15ab27
@ -430,6 +430,9 @@ private List<Pair<PerContainerLogFileInfo, String>> getContainerLogFiles(
|
||||
try {
|
||||
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);
|
||||
@ -443,6 +446,9 @@ private List<Pair<PerContainerLogFileInfo, String>> getContainerLogFiles(
|
||||
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
Block a user