Skip to content

[SPARK-7624] Revert "[SPARK-4939] revive offers periodically in LocalBackend" in 1.3 branch #6337

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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ package org.apache.spark.scheduler.local

import java.nio.ByteBuffer

import scala.concurrent.duration._

import akka.actor.{Actor, ActorRef, Props}

import org.apache.spark.{Logging, SparkContext, SparkEnv, TaskState}
Expand Down Expand Up @@ -48,8 +46,6 @@ private[spark] class LocalActor(
private val totalCores: Int)
extends Actor with ActorLogReceive with Logging {

import context.dispatcher // to use Akka's scheduler.scheduleOnce()

private var freeCores = totalCores

private val localExecutorId = SparkContext.DRIVER_IDENTIFIER
Expand Down Expand Up @@ -78,16 +74,11 @@ private[spark] class LocalActor(

def reviveOffers() {
val offers = Seq(new WorkerOffer(localExecutorId, localExecutorHostname, freeCores))
val tasks = scheduler.resourceOffers(offers).flatten
for (task <- tasks) {
for (task <- scheduler.resourceOffers(offers).flatten) {
freeCores -= scheduler.CPUS_PER_TASK
executor.launchTask(executorBackend, taskId = task.taskId, attemptNumber = task.attemptNumber,
task.name, task.serializedTask)
}
if (tasks.isEmpty && scheduler.activeTaskSets.nonEmpty) {
// Try to reviveOffer after 1 second, because scheduler may wait for locality timeout
context.system.scheduler.scheduleOnce(1000 millis, self, ReviveOffers)
}
}
}

Expand Down