sarutak commented on a change in pull request #29082:
URL: https://github.com/apache/spark/pull/29082#discussion_r460684109
##########
File path: core/src/main/scala/org/apache/spark/status/AppStatusStore.scala
##########
@@ -421,6 +420,26 @@ private[spark] class AppStatusStore(
constructTaskDataList(taskDataWrapperIter)
}
+ def exceptionSummary(stageId: Int, attemptId: Int): Seq[v1.ExceptionSummary]
= {
+ val tasks = taskList(stageId, attemptId, Int.MaxValue)
+ tasks.filter(t => t.status.equalsIgnoreCase("failed"))
+ .flatMap(t => t.errorMessage)
+ .flatMap(parseErrorMessage)
+ .groupBy(e => (e.exceptionType, e.message))
+ .map(t => new v1.ExceptionSummary(t._2.head, t._2.length))
+ .toSeq
+ .sortBy(s => (s.count, s.exceptionFailure.exceptionType))(Ordering[(Int,
String)].reverse)
+ }
+
+ def parseErrorMessage(errorMessage: String): Option[v1.ExceptionFailure] = {
+ errorMessage.split("\\r?\\n")
+ .find(s => !s.startsWith("\t") && s.contains("Exception:"))
Review comment:
O.K, I confirmed that stacktrace printed by `printStackTrace` starts
with `\t` and each call site is split by `\r\n` on Windows.
But according to the Javadoc, the format, except for the initial line,
depends on the implementation.
https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#printStackTrace--
What you want here is the class name and error message, so, can we make this
code simpler?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]