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



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

Reply via email to