juliuszsompolski commented on a change in pull request #25946: [SPARK-29263] 
availableSlots in resourceOffers can change before being checked by barrier 
TaskSet
URL: https://github.com/apache/spark/pull/25946#discussion_r328784723
 
 

 ##########
 File path: 
core/src/main/scala/org/apache/spark/scheduler/TaskSchedulerImpl.scala
 ##########
 @@ -444,6 +443,7 @@ private[spark] class TaskSchedulerImpl(
     // of locality levels so that it gets a chance to launch local tasks on 
all of them.
     // NOTE: the preferredLocality order: PROCESS_LOCAL, NODE_LOCAL, NO_PREF, 
RACK_LOCAL, ANY
     for (taskSet <- sortedTaskSets) {
+      val availableSlots = availableCpus.map(c => c / CPUS_PER_TASK).sum
 
 Review comment:
   note: in 
https://github.com/apache/spark/pull/25946/files#diff-d4000438827afe3a185ae75b24987a61R455
 the `else` could become an `else if (availableSlots > 0)` to avoid iterating 
over the remaining task sets when all available slots have been taken already, 
but that's a micro-optimization orthogonal to the fix.

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