ron8hu commented on a change in pull request #31204:
URL: https://github.com/apache/spark/pull/31204#discussion_r571753603



##########
File path: core/src/main/scala/org/apache/spark/status/AppStatusStore.scala
##########
@@ -138,14 +211,67 @@ private[spark] class AppStatusStore(
     }
   }
 
-  def stageAttempt(stageId: Int, stageAttemptId: Int,
-      details: Boolean = false): (v1.StageData, Seq[Int]) = {
+  def stageAttempt(
+      stageId: Int,
+      stageAttemptId: Int,
+      details: Boolean = false,
+      taskStatus: JList[v1.TaskStatus]): (v1.StageData, Seq[Int]) = {
     val stageKey = Array(stageId, stageAttemptId)
     val stageDataWrapper = store.read(classOf[StageDataWrapper], stageKey)
-    val stage = if (details) stageWithDetails(stageDataWrapper.info) else 
stageDataWrapper.info
+    val stage = if (details) {
+      stageWithDetails(stageDataWrapper.info, taskStatus)
+    } else {
+      stageDataWrapper.info
+    }
     (stage, stageDataWrapper.jobIds.toSeq)
   }
 
+  def stageExecutorSummary(
+    stageId: Int,
+    stageAttemptId: Int,
+    unsortedQuantiles: Array[Double]): Option[v1.ExecutorMetricsDistributions] 
= {
+    val quantiles = unsortedQuantiles.sorted
+    val summary = executorSummary(stageId, stageAttemptId)
+    if (summary.isEmpty) {
+      None
+    } else {
+      val values = summary.values.toIndexedSeq
+
+      def getQuantilesValue(
+        values: IndexedSeq[Double],
+        quantiles: Array[Double]): IndexedSeq[Double] = {
+        val count = values.size
+        val indices = quantiles.map { q => math.min((q * count).toLong, count 
- 1) }

Review comment:
       @xkrogen suggested: This is duplicate code from 
ExecutorPeakMetricsDistributions, maybe it can be pulled into a utility 
function? 




----------------------------------------------------------------
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]

Reply via email to