Skip to content

Commit

Permalink
Remove executorInfo from ExecutorRemoved event
Browse files Browse the repository at this point in the history
  • Loading branch information
Kostas Sakellis committed Jan 8, 2015
1 parent 1727b38 commit b1d054a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ case class SparkListenerExecutorAdded(executorId: String, executorInfo: Executor
extends SparkListenerEvent

@DeveloperApi
case class SparkListenerExecutorRemoved(executorId: String, executorInfo: ExecutorInfo)
case class SparkListenerExecutorRemoved(executorId: String)
extends SparkListenerEvent

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ class CoarseGrainedSchedulerBackend(scheduler: TaskSchedulerImpl, val actorSyste
totalCoreCount.addAndGet(-executorInfo.totalCores)
totalRegisteredExecutors.addAndGet(-1)
scheduler.executorLost(executorId, SlaveLost(reason))
listenerBus.post(SparkListenerExecutorRemoved(executorId, executorInfo))
listenerBus.post(SparkListenerExecutorRemoved(executorId))
case None => logError(s"Asked to remove non-existent executor $executorId")
}
}
Expand Down
6 changes: 2 additions & 4 deletions core/src/main/scala/org/apache/spark/util/JsonProtocol.scala
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,7 @@ private[spark] object JsonProtocol {

def executorRemovedToJson(executorRemoved: SparkListenerExecutorRemoved): JValue = {
("Event" -> Utils.getFormattedClassName(executorRemoved)) ~
("Executor ID" -> executorRemoved.executorId) ~
("Executor Info" -> executorInfoToJson(executorRemoved.executorInfo))
("Executor ID" -> executorRemoved.executorId)
}

/** ------------------------------------------------------------------- *
Expand Down Expand Up @@ -555,8 +554,7 @@ private[spark] object JsonProtocol {

def executorRemovedFromJson(json: JValue): SparkListenerExecutorRemoved = {
val executorId = (json \ "Executor ID").extract[String]
val executorInfo = executorInfoFromJson(json \ "Executor Info")
SparkListenerExecutorRemoved(executorId, executorInfo)
SparkListenerExecutorRemoved(executorId)
}

/** --------------------------------------------------------------------- *
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ class JsonProtocolSuite extends FunSuite {
val applicationEnd = SparkListenerApplicationEnd(42L)
val executorAdded = SparkListenerExecutorAdded("exec1",
new ExecutorInfo("Hostee.awesome.com", 11))
val executorRemoved = SparkListenerExecutorRemoved("exec2",
new ExecutorInfo("Hoster.awesome.com", 42))
val executorRemoved = SparkListenerExecutorRemoved("exec2")

testEvent(stageSubmitted, stageSubmittedJsonString)
testEvent(stageCompleted, stageCompletedJsonString)
Expand Down Expand Up @@ -352,7 +351,6 @@ class JsonProtocolSuite extends FunSuite {
assertEquals(e1.executorInfo, e2.executorInfo)
case (e1: SparkListenerExecutorRemoved, e2: SparkListenerExecutorRemoved) =>
assert(e1.executorId == e1.executorId)
assertEquals(e1.executorInfo, e2.executorInfo)
case (e1, e2) =>
assert(e1 === e2)
case _ => fail("Events don't match in types!")
Expand Down Expand Up @@ -1447,11 +1445,7 @@ class JsonProtocolSuite extends FunSuite {
"""
|{
| "Event": "SparkListenerExecutorRemoved",
| "Executor ID": "exec2",
| "Executor Info": {
| "Host": "Hoster.awesome.com",
| "Total Cores": 42
| }
| "Executor ID": "exec2"
|}
"""
}

0 comments on commit b1d054a

Please sign in to comment.