Github user mateiz commented on a diff in the pull request:

    https://github.com/apache/spark/pull/1313#discussion_r15508376
  
    --- Diff: 
core/src/main/scala/org/apache/spark/scheduler/TaskSetManager.scala ---
    @@ -341,20 +346,31 @@ private[spark] class TaskSetManager(
        *
        * @return An option containing (task index within the task set, 
locality, is speculative?)
        */
    -  private def findTask(execId: String, host: String, locality: 
TaskLocality.Value)
    -    : Option[(Int, TaskLocality.Value, Boolean)] =
    +  private def findTask(execId: String, host: String, maxLocality: 
TaskLocality.Value)
    +  : Option[(Int, TaskLocality.Value, Boolean)] =
       {
         for (index <- findTaskFromList(execId, 
getPendingTasksForExecutor(execId))) {
           return Some((index, TaskLocality.PROCESS_LOCAL, false))
         }
     
    -    if (TaskLocality.isAllowed(locality, TaskLocality.NODE_LOCAL)) {
    +    if (TaskLocality.isAllowed(maxLocality, TaskLocality.NODE_LOCAL)) {
           for (index <- findTaskFromList(execId, 
getPendingTasksForHost(host))) {
             return Some((index, TaskLocality.NODE_LOCAL, false))
           }
         }
     
    -    if (TaskLocality.isAllowed(locality, TaskLocality.RACK_LOCAL)) {
    +    if (TaskLocality.isAllowed(maxLocality, TaskLocality.NOPREF)) {
    +      // Look for noPref tasks after NODE_LOCAL for minimize cross-rack 
traffic
    +      for (index <- findTaskFromList(execId, pendingTasksWithNoPrefs)) {
    +        return Some((index, TaskLocality.PROCESS_LOCAL, false))
    +      }
    +      // find a speculative task if all noPref tasks have been scheduled
    --- End diff --
    
    BTW you may want to change findSpeculativeTask to check for no-prefs after 
process and node though. Right now it checks for them at the beginning.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to