Github user sryza commented on a diff in the pull request:
https://github.com/apache/spark/pull/1486#discussion_r17020666
--- Diff: core/src/main/scala/org/apache/spark/scheduler/DAGScheduler.scala
---
@@ -1296,7 +1298,25 @@ class DAGScheduler(
// If the RDD has some placement preferences (as is the case for input
RDDs), get those
val rddPrefs = rdd.preferredLocations(rdd.partitions(partition)).toList
if (!rddPrefs.isEmpty) {
- return rddPrefs.map(host => TaskLocation(host))
+ // Use the highest priority locations that we have.
+ var highestPriority = PartitionPriority.NORMAL
+ val taskLocations = rddPrefs.foldLeft(List[TaskLocation]()) {
+ (l, plocStr) =>
+ val ploc = PartitionLocation.fromString(plocStr)
+ if (ploc.priority > highestPriority) {
+ highestPriority = ploc.priority
+ (TaskLocation(ploc.host)) :: Nil
+ } else if (ploc.priority < highestPriority) {
+ l
+ } else {
+ (TaskLocation(ploc.host)) :: l
+ }
+ }
+ if (highestPriority > PartitionPriority.NORMAL) {
+ logTrace("Using prioritized location(s): " +
taskLocations.map(_.host).mkString(",") +
+ " which have priority " + highestPriority)
--- End diff --
Should be indented two spaces past logTrace.
---
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]