Github user wulei-bj-cn commented on the pull request:

    https://github.com/apache/spark/pull/8533#issuecomment-136648219
  
    Basically, yes. Indeed this locality level being "ANY" is directly caused 
from org.apache.spark.scheduler.TaskSetManager:
    
    // Check for node-local tasks
    if (TaskLocality.isAllowed(locality, TaskLocality.NODE_LOCAL)) {
    for (index <- speculatableTasks if canRunOnHost(index)) {
    val locations = tasks(index).preferredLocations.map(_.host)
    if (locations.contains(host))
    { speculatableTasks -= index return Some((index, TaskLocality.NODE_LOCAL)) }
    }
    }
    
    As pointed out earlier, since variable "locations" contains 
java.lang.String values like "hostname1", "hostname2", etc and variable "host" 
is containing java.lang.String values like "1.2.3.4", "10.20.30.40", etc. So 
they will NEVER match, and that's why the task scheduler figures: "Ah ha, there 
is no task with preferred locality as NODE_LOCAL, and I'll just have to give it 
an ANY". 
    
    Therefore, as far as I figured, we either change the "host" variable to 
contain values like hostnames or change the "locations" variable to contain IP 
addresses. The overall target is just to make them match when they're compared 
to each other. Am I correct ? 
    
    I'd really hope you could help guide me in the right direction if I'm wrong 
:) Thanks so much !


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

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

Reply via email to