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/04/23 05:17:11 UTC

[GitHub] [spark] weixiuli commented on a change in pull request #32306: [SPARK-35200][CORE] Avoid to recompute the pending speculative tasks in the ExecutorAllocationManager and remove some unnecessary code.

weixiuli commented on a change in pull request #32306:
URL: https://github.com/apache/spark/pull/32306#discussion_r618942209



##########
File path: core/src/main/scala/org/apache/spark/ExecutorAllocationManager.scala
##########
@@ -290,11 +290,11 @@ private[spark] class ExecutorAllocationManager(
    * under the current load to satisfy all running and pending tasks, rounded up.
    */
   private[spark] def maxNumExecutorsNeededPerResourceProfile(rpId: Int): Int = {
-    val pending = listener.totalPendingTasksPerResourceProfile(rpId)
+    val pendingTask = listener.pendingTasksPerResourceProfile(rpId)
     val pendingSpeculative = listener.pendingSpeculativeTasksPerResourceProfile(rpId)
     val unschedulableTaskSets = listener.pendingUnschedulableTaskSetsPerResourceProfile(rpId)
     val running = listener.totalRunningTasksPerResourceProfile(rpId)
-    val numRunningOrPendingTasks = pending + running
+    val numRunningOrPendingTasks = pendingTask + pendingSpeculative + running

Review comment:
       previously  the `pendingSpeculativeTasksPerResourceProfile(rp)` will be called not only  by `totalPendingTasksPerResourceProfile(rpId)` but also  by  ` val pendingSpeculative = listener.pendingSpeculativeTasksPerResourceProfile(rpId)`, this PR  we only call the `pendingSpeculativeTasksPerResourceProfile(rp) ` once  to get the  pendingSpeculativeTasks , and  use  it for   `numRunningOrPendingTasks` and  `pendingSpeculative`.




-- 
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org