Skip to content
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
mesos executor ids now consist of the slave id and a counter to fix d…
…uplicate id problems
  • Loading branch information
drexin committed Jul 10, 2014
commit dde05f38bdab590bec23c2b4a5b8062e62991036
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ private[spark] class MesosSchedulerBackend(

var classLoader: ClassLoader = null

var _nextExecutorId = 0

override def start() {
synchronized {
classLoader = Thread.currentThread.getContextClassLoader
Expand Down Expand Up @@ -250,7 +252,7 @@ private[spark] class MesosSchedulerBackend(
MesosTaskInfo.newBuilder()
.setTaskId(taskId)
.setSlaveId(SlaveID.newBuilder().setValue(slaveId).build())
.setExecutor(createExecutorInfo(slaveId))
.setExecutor(createExecutorInfo(nextExecutorId(slaveId)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't this change keep launching a new executor for each task? We want to reuse our Mesos executors

.setName(task.name)
.addResources(cpuResource)
.setData(ByteString.copyFrom(task.serializedTask))
Expand Down Expand Up @@ -333,4 +335,10 @@ private[spark] class MesosSchedulerBackend(

// TODO: query Mesos for number of cores
override def defaultParallelism() = sc.conf.getInt("spark.default.parallelism", 8)

def nextExecutorId(slaveId: String): String = {
val id = s"$slaveId-${_nextExecutorId}"
_nextExecutorId += 1
id
}
}