diff options
author | Sean Owen <sowen@cloudera.com> | 2015-02-28 15:34:08 +0000 |
---|---|---|
committer | Sean Owen <sowen@cloudera.com> | 2015-02-28 15:34:08 +0000 |
commit | 86fcdaef62dbe624233e364ffe43fe3a1da893f0 (patch) | |
tree | aadf9150fec1d8fb5d4b3628c9aa2e058eed66e5 /core/src | |
parent | f91298e2c597e45af461931919372da5d33ae3da (diff) | |
download | spark-86fcdaef62dbe624233e364ffe43fe3a1da893f0.tar.gz spark-86fcdaef62dbe624233e364ffe43fe3a1da893f0.tar.bz2 spark-86fcdaef62dbe624233e364ffe43fe3a1da893f0.zip |
SPARK-1965 [WEBUI] Spark UI throws NPE on trying to load the app page for non-existent app
Don't throw NPE if appId is unknown. kayousterhout is this a decent enough band-aid for avoiding a full-blown NPE? it should just render empty content instead
Author: Sean Owen <sowen@cloudera.com>
Closes #4777 from srowen/SPARK-1965 and squashes the following commits:
7e16590 [Sean Owen] Update app not found message
cb878d6 [Sean Owen] Return basic "not found" page for unknown appId
d8270da [Sean Owen] Don't throw NPE if appId is unknown
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/main/scala/org/apache/spark/deploy/master/ui/ApplicationPage.scala | 11 |
1 files changed, 10 insertions, 1 deletions
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 3aae2b95d7..76fc40e17d 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 @@ -24,6 +24,7 @@ import scala.xml.Node import akka.pattern.ask import org.json4s.JValue +import org.json4s.JsonAST.JNothing import org.apache.spark.deploy.{ExecutorState, JsonProtocol} import org.apache.spark.deploy.DeployMessages.{MasterStateResponse, RequestMasterState} @@ -44,7 +45,11 @@ private[spark] class ApplicationPage(parent: MasterWebUI) extends WebUIPage("app val app = state.activeApps.find(_.id == appId).getOrElse({ state.completedApps.find(_.id == appId).getOrElse(null) }) - JsonProtocol.writeApplicationInfo(app) + if (app == null) { + JNothing + } else { + JsonProtocol.writeApplicationInfo(app) + } } /** Executor details for a particular application */ @@ -55,6 +60,10 @@ private[spark] class ApplicationPage(parent: MasterWebUI) extends WebUIPage("app val app = state.activeApps.find(_.id == appId).getOrElse({ state.completedApps.find(_.id == appId).getOrElse(null) }) + if (app == null) { + val msg = <div class="row-fluid">No running application with ID {appId}</div> + return UIUtils.basicSparkPage(msg, "Not Found") + } val executorHeaders = Seq("ExecutorID", "Worker", "Cores", "Memory", "State", "Logs") val allExecutors = (app.executors.values ++ app.removedExecutors).toSet.toSeq |