Skip to content

Commit 71c5969

Browse files
committed
Fix the Spark log fetch issue for running job on Spark 2.2
Signed-off-by: Wei Zhang <[email protected]>
1 parent cc15595 commit 71c5969

File tree

1 file changed

+7
-5
lines changed
  • Utils/hdinsight-node-common/src/com/microsoft/azure/hdinsight/spark/jobs

1 file changed

+7
-5
lines changed

Utils/hdinsight-node-common/src/com/microsoft/azure/hdinsight/spark/jobs/JobUtils.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ public static String getInformationFromYarnLogDom(final CredentialsProvider cred
260260

261261
HashMap<String, String> logTypeMap = new HashMap<>();
262262
final AtomicReference<String> logType = new AtomicReference<>();
263+
String logs = "";
263264

264265
while (iterator.hasNext()) {
265266
DomElement node = iterator.next();
@@ -277,19 +278,20 @@ public static String getInformationFromYarnLogDom(final CredentialsProvider cred
277278
.ifPresent(logType::set);
278279
} else if (node instanceof HtmlPreformattedText) {
279280
// In running, no log type paragraph in page
281+
logs = Optional.ofNullable(node.getFirstChild())
282+
.map(DomNode::getTextContent)
283+
.orElse("");
280284

281285
if (logType.get() != null) {
282286
// Only get the first <pre>...</pre>
283-
logTypeMap.put(logType.get(), Optional.ofNullable(node.getFirstChild())
284-
.map(DomNode::getTextContent)
285-
.orElse(""));
287+
logTypeMap.put(logType.get(), logs);
286288

287289
logType.set(null);
288290
}
289291
}
290292
}
291293

292-
return logTypeMap.getOrDefault(type, "");
294+
return logTypeMap.getOrDefault(type, logs);
293295
} catch (FailingHttpStatusCodeException httpError) {
294296
// If the URL is wrong, will get 200 response with content:
295297
// Unable to locate 'xxx' log for container
@@ -306,7 +308,7 @@ public static String getInformationFromYarnLogDom(final CredentialsProvider cred
306308
} catch (URISyntaxException e) {
307309
LOGGER.error("baseUrl has syntax error: " + baseUrl);
308310
} catch (Exception e) {
309-
LOGGER.error("get Spark job log Error", e);
311+
LOGGER.warn("get Spark job log Error", e);
310312
}
311313
return "";
312314
}

0 commit comments

Comments
 (0)