Github user rxin commented on a diff in the pull request:
https://github.com/apache/spark/pull/5043#discussion_r26552862
--- Diff: core/src/main/scala/org/apache/spark/scheduler/DAGScheduler.scala
---
@@ -188,14 +188,13 @@ class DAGScheduler(
eventProcessLoop.post(TaskSetFailed(taskSet, reason))
}
- private def getCacheLocs(rdd: RDD[_]): Array[Seq[TaskLocation]] =
cacheLocs.synchronized {
+ private def getCacheLocs(rdd: RDD[_]): Seq[Seq[TaskLocation]] =
cacheLocs.synchronized {
// Note: this doesn't use `getOrElse()` because this method is called
O(num tasks) times
if (!cacheLocs.contains(rdd.id)) {
val blockIds = rdd.partitions.indices.map(index =>
RDDBlockId(rdd.id, index)).toArray[BlockId]
- val locs = BlockManager.blockIdsToBlockManagers(blockIds, env,
blockManagerMaster)
- cacheLocs(rdd.id) = blockIds.map { id =>
- locs.getOrElse(id, Nil).map(bm => TaskLocation(bm.host,
bm.executorId))
- }
+ val locs = blockManagerMaster.getLocations(blockIds)
--- End diff --
ok thanks for checking. I think the style can be rewritten to something
slightly more clear, e.g.
```scala
val locs: /*Add explicit type here */ =
blockManagerMaster.getLocations(blockIds).map { blockLocs =>
blockLocs.map(bm => TaskLocation(bm.host, bm.executorId))
}
cacheLocs(rdd.id) = locs
```
---
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]