cxzl25 commented on a change in pull request #24497: [SPARK-27630][CORE]Stage
retry causes totalRunningTasks calculation to be negative
URL: https://github.com/apache/spark/pull/24497#discussion_r285392012
##########
File path: core/src/main/scala/org/apache/spark/ExecutorAllocationManager.scala
##########
@@ -646,10 +646,9 @@ 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]]
+ private val liveTaskIds = new mutable.HashSet[Long]
Review comment:
To simplify the calculation of totalRunningTasks (```add remove size```),
instead of using the previous commit, use ```taskIdToNumLiveTasks = new
mutable.HashMap[Long, Int] (add i++ i-- remove), values.sum```.
And in the case of many tasks can improve the sum calculation speed.
The final purpose is to prevent the totalRunningTasks from becoming
negative, resulting in the job stuck, and can further improve the efficiency of
applying for resources.
----------------------------------------------------------------
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]