You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by va...@apache.org on 2015/09/17 19:25:29 UTC
spark git commit: [SPARK-10531] [CORE] AppId is set as AppName in
status rest api
Repository: spark
Updated Branches:
refs/heads/master 81b4db374 -> 36d8b278d
[SPARK-10531] [CORE] AppId is set as AppName in status rest api
Verify it manually.
Author: Jeff Zhang <zj...@apache.org>
Closes #8688 from zjffdu/SPARK-10531.
Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/36d8b278
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/36d8b278
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/36d8b278
Branch: refs/heads/master
Commit: 36d8b278d82e788bf583e8438fac524d0023311d
Parents: 81b4db3
Author: Jeff Zhang <zj...@apache.org>
Authored: Thu Sep 17 10:25:18 2015 -0700
Committer: Marcelo Vanzin <va...@cloudera.com>
Committed: Thu Sep 17 10:25:18 2015 -0700
----------------------------------------------------------------------
core/src/main/scala/org/apache/spark/SparkContext.scala | 1 +
.../apache/spark/deploy/history/FsHistoryProvider.scala | 9 ++++-----
.../scala/org/apache/spark/deploy/master/Master.scala | 2 +-
core/src/main/scala/org/apache/spark/ui/SparkUI.scala | 11 ++++++-----
.../test/scala/org/apache/spark/ui/UISeleniumSuite.scala | 2 +-
5 files changed, 13 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/spark/blob/36d8b278/core/src/main/scala/org/apache/spark/SparkContext.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/org/apache/spark/SparkContext.scala b/core/src/main/scala/org/apache/spark/SparkContext.scala
index a2f34ea..9c32187 100644
--- a/core/src/main/scala/org/apache/spark/SparkContext.scala
+++ b/core/src/main/scala/org/apache/spark/SparkContext.scala
@@ -521,6 +521,7 @@ class SparkContext(config: SparkConf) extends Logging with ExecutorAllocationCli
_applicationId = _taskScheduler.applicationId()
_applicationAttemptId = taskScheduler.applicationAttemptId()
_conf.set("spark.app.id", _applicationId)
+ _ui.foreach(_.setAppId(_applicationId))
_env.blockManager.initialize(_applicationId)
// The metrics system for Driver need to be set spark.app.id to app ID.
http://git-wip-us.apache.org/repos/asf/spark/blob/36d8b278/core/src/main/scala/org/apache/spark/deploy/history/FsHistoryProvider.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/org/apache/spark/deploy/history/FsHistoryProvider.scala b/core/src/main/scala/org/apache/spark/deploy/history/FsHistoryProvider.scala
index a5755ea..8eb2ba1 100644
--- a/core/src/main/scala/org/apache/spark/deploy/history/FsHistoryProvider.scala
+++ b/core/src/main/scala/org/apache/spark/deploy/history/FsHistoryProvider.scala
@@ -146,16 +146,15 @@ private[history] class FsHistoryProvider(conf: SparkConf, clock: Clock)
val ui = {
val conf = this.conf.clone()
val appSecManager = new SecurityManager(conf)
- SparkUI.createHistoryUI(conf, replayBus, appSecManager, appId,
+ SparkUI.createHistoryUI(conf, replayBus, appSecManager, appInfo.name,
HistoryServer.getAttemptURI(appId, attempt.attemptId), attempt.startTime)
// Do not call ui.bind() to avoid creating a new server for each application
}
val appListener = new ApplicationEventListener()
replayBus.addListener(appListener)
- val appInfo = replay(fs.getFileStatus(new Path(logDir, attempt.logPath)), replayBus)
- appInfo.map { info =>
- ui.setAppName(s"${info.name} ($appId)")
-
+ val appAttemptInfo = replay(fs.getFileStatus(new Path(logDir, attempt.logPath)),
+ replayBus)
+ appAttemptInfo.map { info =>
val uiAclsEnabled = conf.getBoolean("spark.history.ui.acls.enable", false)
ui.getSecurityManager.setAcls(uiAclsEnabled)
// make sure to set admin acls before view acls so they are properly picked up
http://git-wip-us.apache.org/repos/asf/spark/blob/36d8b278/core/src/main/scala/org/apache/spark/deploy/master/Master.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/org/apache/spark/deploy/master/Master.scala b/core/src/main/scala/org/apache/spark/deploy/master/Master.scala
index 26904d3..d518e92 100644
--- a/core/src/main/scala/org/apache/spark/deploy/master/Master.scala
+++ b/core/src/main/scala/org/apache/spark/deploy/master/Master.scala
@@ -944,7 +944,7 @@ private[deploy] class Master(
val logInput = EventLoggingListener.openEventLog(new Path(eventLogFile), fs)
val replayBus = new ReplayListenerBus()
val ui = SparkUI.createHistoryUI(new SparkConf, replayBus, new SecurityManager(conf),
- appName + status, HistoryServer.UI_PATH_PREFIX + s"/${app.id}", app.startTime)
+ appName, HistoryServer.UI_PATH_PREFIX + s"/${app.id}", app.startTime)
val maybeTruncated = eventLogFile.endsWith(EventLoggingListener.IN_PROGRESS)
try {
replayBus.replay(logInput, eventLogFile, maybeTruncated)
http://git-wip-us.apache.org/repos/asf/spark/blob/36d8b278/core/src/main/scala/org/apache/spark/ui/SparkUI.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/org/apache/spark/ui/SparkUI.scala b/core/src/main/scala/org/apache/spark/ui/SparkUI.scala
index d8b9056..99085ad 100644
--- a/core/src/main/scala/org/apache/spark/ui/SparkUI.scala
+++ b/core/src/main/scala/org/apache/spark/ui/SparkUI.scala
@@ -56,6 +56,8 @@ private[spark] class SparkUI private (
val stagesTab = new StagesTab(this)
+ var appId: String = _
+
/** Initialize all components of the server. */
def initialize() {
attachTab(new JobsTab(this))
@@ -75,9 +77,8 @@ private[spark] class SparkUI private (
def getAppName: String = appName
- /** Set the app name for this UI. */
- def setAppName(name: String) {
- appName = name
+ def setAppId(id: String): Unit = {
+ appId = id
}
/** Stop the server behind this web interface. Only valid after bind(). */
@@ -94,12 +95,12 @@ private[spark] class SparkUI private (
private[spark] def appUIAddress = s"http://$appUIHostPort"
def getSparkUI(appId: String): Option[SparkUI] = {
- if (appId == appName) Some(this) else None
+ if (appId == this.appId) Some(this) else None
}
def getApplicationInfoList: Iterator[ApplicationInfo] = {
Iterator(new ApplicationInfo(
- id = appName,
+ id = appId,
name = appName,
attempts = Seq(new ApplicationAttemptInfo(
attemptId = None,
http://git-wip-us.apache.org/repos/asf/spark/blob/36d8b278/core/src/test/scala/org/apache/spark/ui/UISeleniumSuite.scala
----------------------------------------------------------------------
diff --git a/core/src/test/scala/org/apache/spark/ui/UISeleniumSuite.scala b/core/src/test/scala/org/apache/spark/ui/UISeleniumSuite.scala
index 22e30ec..18eec7d 100644
--- a/core/src/test/scala/org/apache/spark/ui/UISeleniumSuite.scala
+++ b/core/src/test/scala/org/apache/spark/ui/UISeleniumSuite.scala
@@ -658,6 +658,6 @@ class UISeleniumSuite extends SparkFunSuite with WebBrowser with Matchers with B
}
def apiUrl(ui: SparkUI, path: String): URL = {
- new URL(ui.appUIAddress + "/api/v1/applications/test/" + path)
+ new URL(ui.appUIAddress + "/api/v1/applications/" + ui.sc.get.applicationId + "/" + path)
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org