Github user dragos commented on a diff in the pull request:
https://github.com/apache/spark/pull/8872#discussion_r40827416
--- Diff:
core/src/main/scala/org/apache/spark/scheduler/cluster/mesos/MesosClusterScheduler.scala
---
@@ -542,9 +549,7 @@ private[spark] class MesosClusterScheduler(
tasks.foreach { case (offerId, taskInfos) =>
driver.launchTasks(Collections.singleton(offerId), taskInfos.asJava)
}
- offers.asScala
- .filter(o => !tasks.keySet.contains(o.getId))
- .foreach(o => driver.declineOffer(o.getId))
+ currentOffers.asScala.filter(!_.used).foreach(o =>
driver.declineOffer(o.offerId))
--- End diff --
I think a for-comprehension would be slightly more efficient, though it's
not a big deal.
```
for { o <- currentOffers.asScala if !o.used } driver.declineOffer(o.offerId)
```
`filter` creates an intermediate collection, while inside a for this can be
fused into only one traversal.
---
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]