Skip to content

Commit 2a6b1b7

Browse files
committed
SPARK-1417: Spark on Yarn - spark UI link from resourcemanager is broken
1 parent b5bae84 commit 2a6b1b7

File tree

3 files changed

+35
-2
lines changed

3 files changed

+35
-2
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, sc.ui.appUIAddress, sc.eventLoggingInfo)
52+
sparkHome, "http://" + 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: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,10 @@ private[spark] class SparkUI(
112112
logInfo("Stopped Spark Web UI at %s".format(appUIAddress))
113113
}
114114

115-
private[spark] def appUIAddress = "http://" + publicHost + ":" + boundPort
115+
/**
116+
* Return the application UI address. This does not include the scheme (http://).
117+
*/
118+
private[spark] def appUIAddress = publicHost + ":" + boundPort
116119

117120
}
118121

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
package org.apache.spark
19+
20+
import java.net.URI
21+
22+
import org.scalatest.FunSuite
23+
24+
class SparkUISuite extends FunSuite with SharedSparkContext {
25+
26+
test("verify appUIAddress doesn't contain scheme") {
27+
val appUIUri = new URI(sc.ui.appUIAddress)
28+
assert(appUIUri.isAbsolute() == false)
29+
}
30+
}

0 commit comments

Comments
 (0)