mridulm commented on code in PR #36162:
URL: https://github.com/apache/spark/pull/36162#discussion_r885279237


##########
core/src/main/scala/org/apache/spark/scheduler/TaskSetManager.scala:
##########
@@ -1217,6 +1289,61 @@ private[spark] class TaskSetManager(
   def executorAdded(): Unit = {
     recomputeLocality()
   }
+
+  /**
+   * A class for checking inefficient tasks to be speculated, the inefficient 
tasks come from
+   * the tasks which may be speculated by the previous strategy.
+   */
+  private[scheduler] class InefficientTaskCalculator {
+    var taskProgressThreshold = 0.0
+    var updateSealed = false
+    private var lastComputeMs = -1L
+
+    def maybeRecompute(nowMs: Long): Unit = {
+      if (!updateSealed && (lastComputeMs <= 0 ||
+        nowMs > lastComputeMs + speculationTaskStatsCacheInterval)) {
+        var successRecords = 0L
+        var successRunTime = 0L
+        var numSuccessTasks = 0L
+        taskInfos.values.filter(_.status == "SUCCESS").foreach { taskInfo =>
+          successRecords += taskInfo.successRecords
+          successRunTime += taskInfo.successRunTime
+          numSuccessTasks += 1
+        }

Review Comment:
   We do have cases where `successful` for a partition would change.
   Having said that, given the way we current maintain task duration in 
`successfulTaskDurations` as a `MedianHeap`, I think this should be fine as 
well.



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