spark-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From markhamstra <...@git.apache.org>
Subject [GitHub] spark pull request: [Proposal] SPARK-1171: simplify the implementa...
Date Tue, 04 Mar 2014 06:41:55 GMT
Github user markhamstra commented on a diff in the pull request:

    https://github.com/apache/spark/pull/63#discussion_r10244446
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/cluster/CoarseGrainedSchedulerBackend.scala
---
    @@ -125,14 +126,17 @@ class CoarseGrainedSchedulerBackend(scheduler: TaskSchedulerImpl,
actorSystem: A
     
         // Make fake resource offers on all executors
         def makeOffers() {
    -      launchTasks(scheduler.resourceOffers(
    -        executorHost.toArray.map {case (id, host) => new WorkerOffer(id, host, freeCores(id))}))
    +      // reconstruct workerOffers
    +      workerOffers.foreach(o => workerOffers(o._1) =
    +        new WorkerOffer(o._1, o._2.host, freeCores(o._1)))
    --- End diff --
    
    Now that WorkerOffer is a case class, you can do this and the one in makeOffers with the
copy idiom:
    ```scala
    workerOffers.keys.foreach { executorId => 
      workerOffers(executorId) = workerOffers(executorId).copy(cores = freeCores(executorId))
    }
    ```



---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message