cxzl25 commented on a change in pull request #24497: [SPARK-27630][CORE] 
Properly handle task end events from completed stages
URL: https://github.com/apache/spark/pull/24497#discussion_r294695545
 
 

 ##########
 File path: core/src/main/scala/org/apache/spark/ExecutorAllocationManager.scala
 ##########
 @@ -499,29 +503,29 @@ private[spark] class ExecutorAllocationManager(
    */
   private[spark] class ExecutorAllocationListener extends SparkListener {
 
-    private val stageIdToNumTasks = new mutable.HashMap[Int, Int]
-    // Number of running tasks per stage including speculative tasks.
-    // Should be 0 when no stages are active.
-    private val stageIdToNumRunningTask = new mutable.HashMap[Int, Int]
-    private val stageIdToTaskIndices = new mutable.HashMap[Int, 
mutable.HashSet[Int]]
-    // Number of speculative tasks to be scheduled in each stage
-    private val stageIdToNumSpeculativeTasks = new mutable.HashMap[Int, Int]
-    // The speculative tasks started in each stage
-    private val stageIdToSpeculativeTaskIndices = new mutable.HashMap[Int, 
mutable.HashSet[Int]]
-
-    // stageId to tuple (the number of task with locality preferences, a map 
where each pair is a
-    // node and the number of tasks that would like to be scheduled on that 
node) map,
-    // maintain the executor placement hints for each stage Id used by 
resource framework to better
-    // place the executors.
-    private val stageIdToExecutorPlacementHints = new mutable.HashMap[Int, 
(Int, Map[String, Int])]
-
+    private val stageAttemptToNumTasks = new mutable.HashMap[StageAttempt, Int]
+    private val stageAttemptToTaskIndices = new mutable.HashMap[StageAttempt, 
mutable.HashSet[Int]]
+    // Number of speculative tasks to be scheduled in each stageAttempt
+    private val stageAttemptToNumSpeculativeTasks = new 
mutable.HashMap[StageAttempt, Int]
+    // The speculative tasks started in each stageAttempt
+    private val stageAttemptToSpeculativeTaskIndices =
+      new mutable.HashMap[StageAttempt, mutable.HashSet[Int]]
+    private val liveTaskIds = new mutable.HashSet[Long]
 
 Review comment:
   The previous commit version used 
```executorIdToTaskIds.values.map(_.size).sum```, but in 
[SPARK-20286](https://issues.apache.org/jira/browse/SPARK-20286), 
```executorIdToTaskIds``` was removed.
   
   It seems that recording taskid is not important.
   Now I changed ```stageIdToNumRunningTask``` to 
```stageAttemptToNumRunningTask```.

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


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to