Skip to content

Commit

Permalink
SPARK-1417: Spark on Yarn - spark UI link from resourcemanager is broken
Browse files Browse the repository at this point in the history
Author: Thomas Graves <[email protected]>

Closes apache#344 from tgravescs/SPARK-1417 and squashes the following commits:

c450b5f [Thomas Graves] fix test
e1c1d7e [Thomas Graves] add missing $ to appUIAddress
e982ddb [Thomas Graves] use appUIHostPort in appUIAddress
0803ec2 [Thomas Graves] Review comment updates - remove extra newline, simplify assert in test
658a8ec [Thomas Graves] Add a appUIHostPort routine
0614208 [Thomas Graves] Fix test
2a6b1b7 [Thomas Graves] SPARK-1417: Spark on Yarn - spark UI link from resourcemanager is broken
  • Loading branch information
tgravescs authored and pdeyhim committed Jun 25, 2014
1 parent 6dd19a8 commit 60f9c6a
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 3 deletions.
7 changes: 6 additions & 1 deletion core/src/main/scala/org/apache/spark/ui/SparkUI.scala
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,12 @@ private[spark] class SparkUI(
logInfo("Stopped Spark Web UI at %s".format(appUIAddress))
}

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

private[spark] def appUIAddress = s"http://$appUIHostPort"

}

Expand Down
35 changes: 35 additions & 0 deletions core/src/test/scala/org/apache/spark/SparkUISuite.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.spark

import java.net.URI

import org.scalatest.FunSuite

class SparkUISuite extends FunSuite with SharedSparkContext {

test("verify appUIAddress contains the scheme") {
val uiAddress = sc.ui.appUIAddress
assert(uiAddress.equals("http://" + sc.ui.appUIHostPort))
}

test("verify appUIAddress contains the port") {
val splitUIAddress = sc.ui.appUIAddress.split(':')
assert(splitUIAddress(2).toInt == sc.ui.boundPort)
}
}
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 @@ -220,7 +220,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 60f9c6a

Please sign in to comment.