Skip to content
Closed
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ private[history] class HistoryPage(parent: HistoryServer) extends WebUIPage("")
<script type="module" src={UIUtils.prependBaseUri(
request, "/static/utils.js")}></script> ++
summary ++ appList ++ pageLink
UIUtils.basicSparkPage(request, content, "History Server", true)
UIUtils.basicSparkPage(request, content, parent.title, true)
}

def shouldDisplayApplications(requestedIncomplete: Boolean): Boolean = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ class HistoryServer(
poolSize = 1000)
with Logging with UIRoot with ApplicationCacheOperations {

val title = conf.get(History.HISTORY_SERVER_UI_TITLE)

// How many applications to retain
private val retainedApplications = conf.get(History.RETAINED_APPLICATIONS)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@ private[spark] object History {
.bytesConf(ByteUnit.BYTE)
.createWithDefaultString("10g")

val HISTORY_SERVER_UI_TITLE = ConfigBuilder("spark.history.ui.title")
.version("4.0.0")
.doc("Specifies the title of the History Server UI page.")
.stringConf
.createWithDefault("History Server")

val HISTORY_SERVER_UI_PORT = ConfigBuilder("spark.history.ui.port")
.doc("Web UI port to bind Spark History Server")
.version("1.0.0")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,13 @@ class HistoryServerPageSuite extends SparkFunSuite with BeforeAndAfter {
private val localhost: String = Utils.localHostNameForURI()
private var port: Int = -1

private def startHistoryServer(logDir: String): Unit = {
private def startHistoryServer(logDir: String, title: Option[String] = None): Unit = {
assert(server.isEmpty)
val conf = new SparkConf()
.set(HISTORY_LOG_DIR, logDir)
.set(UPDATE_INTERVAL_S.key, "0")
.set(IS_TESTING, true)
title.foreach(conf.set(HISTORY_SERVER_UI_TITLE.key, _))
val provider = new FsHistoryProvider(conf)
provider.checkForLogs()
val securityManager = HistoryServer.createSecurityManager(conf)
Expand Down Expand Up @@ -100,4 +101,19 @@ class HistoryServerPageSuite extends SparkFunSuite with BeforeAndAfter {
stopHistoryServer()
}
}

test("SPARK-49128: Support custom History Server UI title") {
Seq(None, Some("Custom History Server Title")).foreach { title =>
startHistoryServer(logDirs.head, title)
val page = new HistoryPage(server.get)
val (code, htmlOpt, errOpt) = HistoryServerSuite.getContentAndCode(
new URL(s"http://$localhost:$port/")
)
assert(code == HttpServletResponse.SC_OK)
val expected = title.getOrElse("History Server")
assert(htmlOpt.isDefined && htmlOpt.get.contains(s"<title>$expected</title>"))
assert(errOpt.isEmpty)
stopHistoryServer()
}
}
}