You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/11/17 22:03:24 UTC

[GitHub] [spark] janekdb commented on a change in pull request #29082: [SPARK-32288][UI] Add exception summary for failed tasks in stage page

janekdb commented on a change in pull request #29082:
URL: https://github.com/apache/spark/pull/29082#discussion_r525554422



##########
File path: core/src/main/scala/org/apache/spark/status/AppStatusStore.scala
##########
@@ -429,6 +429,37 @@ private[spark] class AppStatusStore(
     constructTaskDataList(taskDataWrapperIter)
   }
 
+  def failureSummary(stageId: Int, attemptId: Int): Seq[v1.FailureSummary] = {
+    val (stageData, _) = stageAttempt(stageId, attemptId)
+    val key = Array(stageId, attemptId)
+    asOption(store.read(classOf[CachedFailureSummary], key))
+      .find(p => p.failedTaskCount == stageData.numFailedTasks)
+      .map(_.failureSummary)
+      .getOrElse {
+        val failureSummary = computeFailureSummary(stageId, attemptId)
+        val cachedFailureSummary = new CachedFailureSummary(
+          stageId,
+          attemptId,
+          stageData.numFailedTasks,
+          failureSummary
+        )
+
+        store.write(cachedFailureSummary)
+        failureSummary
+      }
+  }
+
+  def computeFailureSummary(stageId: Int, attemptId: Int): Seq[v1.FailureSummary] = {
+    val tasks = taskList(stageId, attemptId, Int.MaxValue)
+    tasks.filter(t => t.status.equalsIgnoreCase("failed"))
+      .flatMap(t => t.failureReason)
+      .groupBy(e => (e.failureType, e.message))

Review comment:
       Drop use of tuple component accessors by using `values` on the grouped items?
   
   ```
   .groupBy(e => (e.failureType, e.message))
   .values
   .map(t => new v1.FailureSummary(t.head, t.length))
   ```




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org