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



##########
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:
       Ah, OK, `stage.speculationStageSummary` hold just a delta.
   So how about:
   
   * Revert he declaration of `stage.speculationStageSummary` (`val 
speculationStageSummary: LiveSpeculationStageSummary = ...`)
   * Declare a variable flag like `needUpdateSpeculationSummary` to indicate 
whether we need to call `maybeUpdate` or not.
   * Set `true` to the flag when the summary is updated.
   * Change `maybeUpdate` to return whether it has actually updated or not.
   * set `false` to the flag when the `maybeUpdate` returns `true`.




-- 
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: [email protected]

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