Ngone51 commented on pull request #28656:
URL: https://github.com/apache/spark/pull/28656#issuecomment-634776960


   @tgravescs 
   The problem is caused by the race condition between `resourcesOffer` and 
`submitTasks`. If `submitTasks` happens before `resourcesOffer`, especially 
when there are no executors added to TaskScheduler at all, the TaskSetManager 
's `myLocalityLevels`  will have ANY locality level, see: 
   
   
https://github.com/apache/spark/blob/8b4862953a879a9b3ba6f57e669efc383df68b7c/core/src/main/scala/org/apache/spark/scheduler/TaskSetManager.scala#L218
   
   
   And then, `resourcesOffer` is called with new executors added to 
TaskScheduler. Then, `recomputeLocality` will be called because of 
`executorAdded`. During `recomputeLocality`, the TaskSetManager's 
`myLocalityLevels` may have PROCESS_LOCAL, NODE_LOCAL, ANY. But it will stick 
to the previous locality level, which is ANY, see:
   
   
https://github.com/apache/spark/blob/8b4862953a879a9b3ba6f57e669efc383df68b7c/core/src/main/scala/org/apache/spark/scheduler/TaskSetManager.scala#L1107-L1114
   
   
   As a result, the TaskSetManager can only schedule tasks at ANY level.
   
   
   (I'll update the PR description with more detail explanation later)


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