Github user JoshRosen commented on a diff in the pull request:
https://github.com/apache/spark/pull/6652#discussion_r31761687
--- Diff: core/src/main/scala/org/apache/spark/scheduler/DAGScheduler.scala
---
@@ -1395,6 +1404,23 @@ class DAGScheduler(
return locs
}
}
+ case s: ShuffleDependency[_, _, _] =>
+ if (rdd.partitions.size < SHUFFLE_PREF_REDUCE_THRESHOLD &&
+ s.rdd.partitions.size < SHUFFLE_PREF_MAP_THRESHOLD) {
+ // Assign preferred locations for reducers by looking at map
output location and sizes
+ val mapStatuses =
mapOutputTracker.getStatusByReducer(s.shuffleId, rdd.partitions.size)
+ mapStatuses.map { status =>
+ // Get the map output locations for this reducer
+ if (status.contains(partition)) {
+ // Select first few locations as preferred locations for the
reducer
+ val topLocs = CollectionUtils.takeOrdered(
+ status(partition).iterator, NUM_REDUCER_PREF_LOCS)(
+ Ordering.by[(BlockManagerId, Long),
Long](_._2).reverse).toSeq
+ return topLocs.map(_._1).map(loc => TaskLocation(loc.host,
loc.executorId))
--- End diff --
It looks like you're `return`ing from a `map` here? Maybe we can replace
this map with a `while` loop instead.
---
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]