From fe47402c83232f5db64ddfb496a542f3efe145ad Mon Sep 17 00:00:00 2001 From: Andrew Or Date: Mon, 16 Jun 2014 18:26:56 -0700 Subject: [PATCH] Show exited executors on the Master UI Previously executors disappear if the application exits cleanly (i.e. if sc.stop() is called). --- .../apache/spark/deploy/master/ApplicationInfo.scala | 11 ++++++++++- .../spark/deploy/master/ui/ApplicationPage.scala | 6 +++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/core/src/main/scala/org/apache/spark/deploy/master/ApplicationInfo.scala b/core/src/main/scala/org/apache/spark/deploy/master/ApplicationInfo.scala index 46b9f4dc7d3ba..d704c42fd8ace 100644 --- a/core/src/main/scala/org/apache/spark/deploy/master/ApplicationInfo.scala +++ b/core/src/main/scala/org/apache/spark/deploy/master/ApplicationInfo.scala @@ -20,10 +20,11 @@ package org.apache.spark.deploy.master import java.util.Date import scala.collection.mutable +import scala.collection.mutable.ArrayBuffer import akka.actor.ActorRef -import org.apache.spark.deploy.ApplicationDescription +import org.apache.spark.deploy.{ApplicationDescription, ExecutorState} private[spark] class ApplicationInfo( val startTime: Long, @@ -41,6 +42,7 @@ private[spark] class ApplicationInfo( @transient var appSource: ApplicationSource = _ @transient private var nextExecutorId: Int = _ + @transient private var exitedExecutors: ArrayBuffer[ExecutorInfo] = _ init() @@ -51,6 +53,7 @@ private[spark] class ApplicationInfo( endTime = -1L appSource = new ApplicationSource(this) nextExecutorId = 0 + exitedExecutors = new ArrayBuffer[ExecutorInfo] } private def newExecutorId(useID: Option[Int] = None): Int = { @@ -74,11 +77,17 @@ private[spark] class ApplicationInfo( def removeExecutor(exec: ExecutorInfo) { if (executors.contains(exec.id)) { + if (exec.state == ExecutorState.EXITED) { + exitedExecutors += executors(exec.id) + } executors -= exec.id coresGranted -= exec.cores } } + /** Return the information for all live and exited executors. */ + def executorInfo: Seq[ExecutorInfo] = (executors.values ++ exitedExecutors).toSet.toSeq + private val myMaxCores = desc.maxCores.getOrElse(defaultCores) def coresLeft: Int = myMaxCores - coresGranted diff --git a/core/src/main/scala/org/apache/spark/deploy/master/ui/ApplicationPage.scala b/core/src/main/scala/org/apache/spark/deploy/master/ui/ApplicationPage.scala index b5cd4d2ea963f..e35d3b4eb3f98 100644 --- a/core/src/main/scala/org/apache/spark/deploy/master/ui/ApplicationPage.scala +++ b/core/src/main/scala/org/apache/spark/deploy/master/ui/ApplicationPage.scala @@ -57,7 +57,7 @@ private[spark] class ApplicationPage(parent: MasterWebUI) extends WebUIPage("app }) val executorHeaders = Seq("ExecutorID", "Worker", "Cores", "Memory", "State", "Logs") - val executors = app.executors.values.toSeq + val executors = app.executorInfo val executorTable = UIUtils.listingTable(executorHeaders, executorRow, executors) val content = @@ -68,14 +68,14 @@ private[spark] class ApplicationPage(parent: MasterWebUI) extends WebUIPage("app
  • Name: {app.desc.name}
  • User: {app.desc.user}
  • Cores: - { + { if (app.desc.maxCores.isEmpty) { "Unlimited (%s granted)".format(app.coresGranted) } else { "%s (%s granted, %s left)".format( app.desc.maxCores.get, app.coresGranted, app.coresLeft) } - } + }
  • Executor Memory: