Skip to content

Commit 658a8ec

Browse files
committed
Add a appUIHostPort routine
1 parent 0614208 commit 658a8ec

File tree

5 files changed

+17
-8
lines changed

5 files changed

+17
-8
lines changed

core/src/main/scala/org/apache/spark/scheduler/cluster/SparkDeploySchedulerBackend.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ private[spark] class SparkDeploySchedulerBackend(
4949
"org.apache.spark.executor.CoarseGrainedExecutorBackend", args, sc.executorEnvs)
5050
val sparkHome = sc.getSparkHome()
5151
val appDesc = new ApplicationDescription(sc.appName, maxCores, sc.executorMemory, command,
52-
sparkHome, "http://" + sc.ui.appUIAddress, sc.eventLoggingInfo)
52+
sparkHome, sc.ui.appUIAddress, sc.eventLoggingInfo)
5353

5454
client = new AppClient(sc.env.actorSystem, masters, appDesc, this, conf)
5555
client.start()

core/src/main/scala/org/apache/spark/ui/SparkUI.scala

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,12 @@ private[spark] class SparkUI(
113113
}
114114

115115
/**
116-
* Return the application UI address. This does not include the scheme (http://).
116+
* Return the application UI host:port. This does not include the scheme (http://).
117117
*/
118-
private[spark] def appUIAddress = publicHost + ":" + boundPort
118+
private[spark] def appUIHostPort = publicHost + ":" + boundPort
119+
120+
private[spark] def appUIAddress = "http://" + publicHost + ":" + boundPort
121+
119122

120123
}
121124

core/src/test/scala/org/apache/spark/SparkUISuite.scala

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,14 @@ import org.scalatest.FunSuite
2323

2424
class SparkUISuite extends FunSuite with SharedSparkContext {
2525

26-
test("verify appUIAddress doesn't contain scheme") {
27-
val appUIUri = new URI(sc.ui.appUIAddress)
28-
assert(appUIUri.getScheme().startsWith("http") == false)
26+
test("verify appUIHostPort doesn't contain scheme") {
27+
val appUIUri = new URI(sc.ui.appUIHostPort)
28+
assert(appUIUri.getScheme().startsWith("http") == false)
2929
}
30+
31+
test("verify appUIAddress contains the scheme") {
32+
val appUIUri = new URI(sc.ui.appUIAddress)
33+
assert(appUIUri.getScheme().startsWith("http") == true)
34+
}
35+
3036
}

yarn/alpha/src/main/scala/org/apache/spark/deploy/yarn/ApplicationMaster.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ class ApplicationMaster(args: ApplicationMasterArguments, conf: Configuration,
234234
assert(sparkContext != null || count >= numTries)
235235

236236
if (null != sparkContext) {
237-
uiAddress = sparkContext.ui.appUIAddress
237+
uiAddress = sparkContext.ui.appUIHostPort
238238
this.yarnAllocator = YarnAllocationHandler.newAllocator(
239239
yarnConf,
240240
resourceManager,

yarn/stable/src/main/scala/org/apache/spark/deploy/yarn/ApplicationMaster.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ class ApplicationMaster(args: ApplicationMasterArguments, conf: Configuration,
221221
assert(sparkContext != null || numTries >= maxNumTries)
222222

223223
if (sparkContext != null) {
224-
uiAddress = sparkContext.ui.appUIAddress
224+
uiAddress = sparkContext.ui.appUIHostPort
225225
this.yarnAllocator = YarnAllocationHandler.newAllocator(
226226
yarnConf,
227227
amClient,

0 commit comments

Comments
 (0)