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 2021/12/02 19:57:56 UTC

[GitHub] [spark] sarutak commented on a change in pull request #34607: [SPARK-36038][CORE] Speculation metrics summary at stage level

sarutak commented on a change in pull request #34607:
URL: https://github.com/apache/spark/pull/34607#discussion_r761422285



##########
File path: core/src/main/scala/org/apache/spark/status/AppStatusListener.scala
##########
@@ -600,6 +600,17 @@ private[spark] class AppStatusListener(
     liveUpdate(task, now)
 
     Option(liveStages.get((event.stageId, event.stageAttemptId))).foreach { stage =>
+      if (event.taskInfo.speculative) {
+        stage.speculationStageSummary = Some(stage.speculationStageSummary
+          .getOrElse(new LiveSpeculationStageSummary(event.stageId, event.stageAttemptId)))
+        val speculationSummary = stage.speculationStageSummary.get
+        speculationSummary.numActiveTasks += 1
+        speculationSummary.numTasks += 1
+      }
+      if(stage.speculationStageSummary.isDefined) {
+        maybeUpdate(stage.speculationStageSummary.get, now)

Review comment:
       With the latest change, `stage.speculationStageSummary` never become `None` once it's substituted `Some`. So, unnecessary updates may happen line you were afraid.
   https://github.com/apache/spark/pull/34607#discussion_r753559069
   
   Let's change `maybeUpdate` to return whether it actually updates or not.
   Then, we can set `None` to `stage.speculationStageSummary` if the update actually happens.

##########
File path: core/src/main/scala/org/apache/spark/status/AppStatusListener.scala
##########
@@ -747,6 +758,24 @@ private[spark] class AppStatusListener(
         maybeUpdate(esummary, now)
       }
 
+      if (event.taskInfo.speculative) {
+        stage.speculationStageSummary = Some(stage.speculationStageSummary.getOrElse(
+            new LiveSpeculationStageSummary(event.stageId, event.stageAttemptId)))
+        val speculationStageSummary = stage.speculationStageSummary.get
+        speculationStageSummary.numActiveTasks -= 1
+        speculationStageSummary.numCompletedTasks += completedDelta
+        speculationStageSummary.numFailedTasks += failedDelta
+        speculationStageSummary.numKilledTasks += killedDelta
+      }
+
+      if(stage.speculationStageSummary.isDefined) {
+        if (isLastTask) {
+          update(stage.speculationStageSummary.get, now)
+        } else {
+          maybeUpdate(stage.speculationStageSummary.get, now)

Review comment:
       ditto.




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

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

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