Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPARK-1171: when executor is removed, we should minus totalCores instead of just freeCores on that executor #63

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -21,4 +21,4 @@ package org.apache.spark.scheduler
* Represents free resources available on an executor. * Represents free resources available on an executor.
*/ */
private[spark] private[spark]
class WorkerOffer(val executorId: String, val host: String, val cores: Int) case class WorkerOffer(executorId: String, host: String, cores: Int)
Expand Up @@ -54,6 +54,7 @@ class CoarseGrainedSchedulerBackend(scheduler: TaskSchedulerImpl, actorSystem: A
private val executorAddress = new HashMap[String, Address] private val executorAddress = new HashMap[String, Address]
private val executorHost = new HashMap[String, String] private val executorHost = new HashMap[String, String]
private val freeCores = new HashMap[String, Int] private val freeCores = new HashMap[String, Int]
private val totalCores = new HashMap[String, Int]
private val addressToExecutorId = new HashMap[Address, String] private val addressToExecutorId = new HashMap[Address, String]


override def preStart() { override def preStart() {
Expand All @@ -76,6 +77,7 @@ class CoarseGrainedSchedulerBackend(scheduler: TaskSchedulerImpl, actorSystem: A
sender ! RegisteredExecutor(sparkProperties) sender ! RegisteredExecutor(sparkProperties)
executorActor(executorId) = sender executorActor(executorId) = sender
executorHost(executorId) = Utils.parseHostPort(hostPort)._1 executorHost(executorId) = Utils.parseHostPort(hostPort)._1
totalCores(executorId) = cores
freeCores(executorId) = cores freeCores(executorId) = cores
executorAddress(executorId) = sender.path.address executorAddress(executorId) = sender.path.address
addressToExecutorId(sender.path.address) = executorId addressToExecutorId(sender.path.address) = executorId
Expand Down Expand Up @@ -147,10 +149,12 @@ class CoarseGrainedSchedulerBackend(scheduler: TaskSchedulerImpl, actorSystem: A
def removeExecutor(executorId: String, reason: String) { def removeExecutor(executorId: String, reason: String) {
if (executorActor.contains(executorId)) { if (executorActor.contains(executorId)) {
logInfo("Executor " + executorId + " disconnected, so removing it") logInfo("Executor " + executorId + " disconnected, so removing it")
val numCores = freeCores(executorId) val numCores = totalCores(executorId)
addressToExecutorId -= executorAddress(executorId)
executorActor -= executorId executorActor -= executorId
executorHost -= executorId executorHost -= executorId
addressToExecutorId -= executorAddress(executorId)
executorAddress -= executorId
totalCores -= executorId
freeCores -= executorId freeCores -= executorId
totalCoreCount.addAndGet(-numCores) totalCoreCount.addAndGet(-numCores)
scheduler.executorLost(executorId, SlaveLost(reason)) scheduler.executorLost(executorId, SlaveLost(reason))
Expand Down