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

    https://github.com/apache/spark/pull/1313#discussion_r15518594
  
    --- Diff: 
core/src/main/scala/org/apache/spark/scheduler/TaskSchedulerImpl.scala ---
    @@ -246,28 +246,36 @@ private[spark] class TaskSchedulerImpl(
     
         // Take each TaskSet in our scheduling order, and then offer it each 
node in increasing order
         // 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, 
NOPREF, RACK_local, ANY
         var launchedTask = false
    -    for (taskSet <- sortedTaskSets; maxLocality <- 
taskSet.myLocalityLevels) {
    -      do {
    -        launchedTask = false
    -        for (i <- 0 until shuffledOffers.size) {
    -          val execId = shuffledOffers(i).executorId
    -          val host = shuffledOffers(i).host
    -          if (availableCpus(i) >= CPUS_PER_TASK) {
    -            for (task <- taskSet.resourceOffer(execId, host, maxLocality)) 
{
    -              tasks(i) += task
    -              val tid = task.taskId
    -              taskIdToTaskSetId(tid) = taskSet.taskSet.id
    -              taskIdToExecutorId(tid) = execId
    -              activeExecutorIds += execId
    -              executorsByHost(host) += execId
    -              availableCpus(i) -= CPUS_PER_TASK
    -              assert (availableCpus(i) >= 0)
    -              launchedTask = true
    +    for (taskSet <- sortedTaskSets; preferredLocality <- 
taskSet.myLocalityLevels) {
    +      def launchTaskOnLocalityLevel(locality: TaskLocality.Value) {
    +        do {
    +          launchedTask = false
    +          for (i <- 0 until shuffledOffers.size) {
    +            val execId = shuffledOffers(i).executorId
    +            val host = shuffledOffers(i).host
    +            if (availableCpus(i) >= CPUS_PER_TASK) {
    +              for (task <- taskSet.resourceOffer(execId, host, locality)) {
    +                tasks(i) += task
    +                val tid = task.taskId
    +                taskIdToTaskSetId(tid) = taskSet.taskSet.id
    +                taskIdToExecutorId(tid) = execId
    +                activeExecutorIds += execId
    +                executorsByHost(host) += execId
    +                availableCpus(i) -= CPUS_PER_TASK
    +                assert(availableCpus(i) >= 0)
    +                launchedTask = true
    +              }
                 }
               }
    -        }
    -      } while (launchedTask)
    +        } while (launchedTask)
    +      }
    +      launchTaskOnLocalityLevel(preferredLocality)
    +      // search noPref task after we have launched all node_local and 
nearer tasks
    +      if (preferredLocality == TaskLocality.NODE_LOCAL) {
    +        launchTaskOnLocalityLevel(TaskLocality.NOPREF)
    +      }
    --- End diff --
    
    yeah, I just updated it by assigning NO_PREF a 0 LOCALITY_WAIT, 


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to