Would look better as
```
val loc = parents.count(
    p => rdd.context.getPreferredLocs(rdd, p.index).contains(preferredLocation))
```