Skip to content

Commit

Permalink
Add a appUIHostPort routine
Browse files Browse the repository at this point in the history
  • Loading branch information
tgravescs committed Apr 7, 2014
1 parent 0614208 commit 658a8ec
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ private[spark] class SparkDeploySchedulerBackend(
"org.apache.spark.executor.CoarseGrainedExecutorBackend", args, sc.executorEnvs)
val sparkHome = sc.getSparkHome()
val appDesc = new ApplicationDescription(sc.appName, maxCores, sc.executorMemory, command,
sparkHome, "http://" + sc.ui.appUIAddress, sc.eventLoggingInfo)
sparkHome, sc.ui.appUIAddress, sc.eventLoggingInfo)

client = new AppClient(sc.env.actorSystem, masters, appDesc, this, conf)
client.start()
Expand Down
7 changes: 5 additions & 2 deletions core/src/main/scala/org/apache/spark/ui/SparkUI.scala
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,12 @@ private[spark] class SparkUI(
}

/**
* Return the application UI address. This does not include the scheme (http://).
* Return the application UI host:port. This does not include the scheme (http://).
*/
private[spark] def appUIAddress = publicHost + ":" + boundPort
private[spark] def appUIHostPort = publicHost + ":" + boundPort

private[spark] def appUIAddress = "http://" + publicHost + ":" + boundPort


}

Expand Down
12 changes: 9 additions & 3 deletions core/src/test/scala/org/apache/spark/SparkUISuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,14 @@ import org.scalatest.FunSuite

class SparkUISuite extends FunSuite with SharedSparkContext {

test("verify appUIAddress doesn't contain scheme") {
val appUIUri = new URI(sc.ui.appUIAddress)
assert(appUIUri.getScheme().startsWith("http") == false)
test("verify appUIHostPort doesn't contain scheme") {
val appUIUri = new URI(sc.ui.appUIHostPort)
assert(appUIUri.getScheme().startsWith("http") == false)
}

test("verify appUIAddress contains the scheme") {
val appUIUri = new URI(sc.ui.appUIAddress)
assert(appUIUri.getScheme().startsWith("http") == true)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ class ApplicationMaster(args: ApplicationMasterArguments, conf: Configuration,
assert(sparkContext != null || count >= numTries)

if (null != sparkContext) {
uiAddress = sparkContext.ui.appUIAddress
uiAddress = sparkContext.ui.appUIHostPort
this.yarnAllocator = YarnAllocationHandler.newAllocator(
yarnConf,
resourceManager,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ class ApplicationMaster(args: ApplicationMasterArguments, conf: Configuration,
assert(sparkContext != null || numTries >= maxNumTries)

if (sparkContext != null) {
uiAddress = sparkContext.ui.appUIAddress
uiAddress = sparkContext.ui.appUIHostPort
this.yarnAllocator = YarnAllocationHandler.newAllocator(
yarnConf,
amClient,
Expand Down

0 comments on commit 658a8ec

Please sign in to comment.