Github user srowen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18322#discussion_r122562253
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/master/Master.scala 
---
    @@ -658,19 +658,22 @@ private[deploy] class Master(
       private def startExecutorsOnWorkers(): Unit = {
         // Right now this is a very simple FIFO scheduler. We keep trying to 
fit in the first app
         // in the queue, then the second app, etc.
    -    for (app <- waitingApps if app.coresLeft > 0) {
    +    for (app <- waitingApps) {
           val coresPerExecutor: Option[Int] = app.desc.coresPerExecutor
    -      // Filter out workers that don't have enough resources to launch an 
executor
    -      val usableWorkers = workers.toArray.filter(_.state == 
WorkerState.ALIVE)
    -        .filter(worker => worker.memoryFree >= 
app.desc.memoryPerExecutorMB &&
    -          worker.coresFree >= coresPerExecutor.getOrElse(1))
    -        .sortBy(_.coresFree).reverse
    -      val assignedCores = scheduleExecutorsOnWorkers(app, usableWorkers, 
spreadOutApps)
    -
    -      // Now that we've decided how many cores to allocate on each worker, 
let's allocate them
    -      for (pos <- 0 until usableWorkers.length if assignedCores(pos) > 0) {
    -        allocateWorkerResourceToExecutors(
    -          app, assignedCores(pos), coresPerExecutor, usableWorkers(pos))
    +      // If the cores left is less than the coresPerExecutor,the cores 
left will not be allocated
    +      if (app.coresLeft >= coresPerExecutor.getOrElse(1)) {
    --- End diff --
    
    Might avoid duplicating `coresPerExecutor.getOrElse(1)` by referring to it 
as `requestedCoresPerExecutor` or something


---
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]

Reply via email to