Github user lianhuiwang commented on a diff in the pull request: https://github.com/apache/spark/pull/636#discussion_r12268618 --- Diff: core/src/main/scala/org/apache/spark/deploy/master/Master.scala --- @@ -523,6 +504,81 @@ private[spark] class Master( } } + private def startMultiExecutorsPerWorker() { + val coreNumPerExecutor = conf.getInt("spark.executor.coreNumPerExecutor", 1) + // allow user to run multiple executors in the same worker + // (within the same worker JVM process) + if (spreadOutApps) { + for (app <- waitingApps if app.coresLeft > 0) { + val usableWorkers = workers.toArray.filter(_.state == WorkerState.ALIVE) + .filter(app.desc.memoryPerExecutor < _.memoryFree).sortBy(_.coresFree).reverse + var toAssign = math.min(app.coresLeft, usableWorkers.map(_.coresFree).sum) + val numUsable = usableWorkers.length + // Number of cores of each executor assigned to each worker + val assigned = new Array[ListBuffer[Int]](numUsable) + var pos = 0 + while (toAssign > 0) { + val assignedCore = math.min(coreNumPerExecutor, toAssign) + if (usableWorkers(pos).coresFree - assigned(pos).sum > 0) { --- End diff -- if (usableWorkers(pos).coresFree - assigned(pos).sum > 0) { that should update:if (usableWorkers(pos).coresFree - assigned(pos).sum >= assignedCore) {
--- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---