Merge pull request #849 from mateiz/web-fixes

Small fixes to web UI
This commit is contained in:
Matei Zaharia 2013-08-19 19:23:50 -07:00
commit efeb142981
3 changed files with 10 additions and 9 deletions

View file

@ -30,7 +30,7 @@ import spark.ui.JettyUtils._
/** Top level user interface for Spark */
private[spark] class SparkUI(sc: SparkContext) extends Logging {
val host = Utils.localHostName()
val host = Option(System.getenv("SPARK_PUBLIC_DNS")).getOrElse(Utils.localHostName())
val port = Option(System.getProperty("spark.ui.port")).getOrElse(SparkUI.DEFAULT_PORT).toInt
var boundPort: Option[Int] = None
var server: Option[Server] = None
@ -58,9 +58,9 @@ private[spark] class SparkUI(sc: SparkContext) extends Logging {
server = Some(srv)
boundPort = Some(usedPort)
} catch {
case e: Exception =>
logError("Failed to create Spark JettyUtils", e)
System.exit(1)
case e: Exception =>
logError("Failed to create Spark JettyUtils", e)
System.exit(1)
}
}
@ -82,6 +82,6 @@ private[spark] class SparkUI(sc: SparkContext) extends Logging {
}
private[spark] object SparkUI {
val DEFAULT_PORT = "33000"
val DEFAULT_PORT = "3030"
val STATIC_RESOURCE_DIR = "spark/ui/static"
}

View file

@ -24,14 +24,15 @@ import org.eclipse.jetty.server.Server
class UISuite extends FunSuite {
test("jetty port increases under contention") {
val startPort = 33333
val startPort = 3030
val server = new Server(startPort)
server.start()
val (jettyServer1, boundPort1) = JettyUtils.startJettyServer("localhost", startPort, Seq())
val (jettyServer2, boundPort2) = JettyUtils.startJettyServer("localhost", startPort, Seq())
assert(boundPort1 === startPort + 1)
assert(boundPort2 === startPort + 2)
// Allow some wiggle room in case ports on the machine are under contention
assert(boundPort1 > startPort && boundPort1 < startPort + 10)
assert(boundPort2 > boundPort1 && boundPort2 < boundPort1 + 10)
}
test("jetty binds to port 0 correctly") {

View file

@ -178,7 +178,7 @@ def launch_cluster(conn, opts, cluster_name):
master_group.authorize('tcp', 50030, 50030, '0.0.0.0/0')
master_group.authorize('tcp', 50070, 50070, '0.0.0.0/0')
master_group.authorize('tcp', 60070, 60070, '0.0.0.0/0')
master_group.authorize('tcp', 33000, 33010, '0.0.0.0/0')
master_group.authorize('tcp', 3030, 3035, '0.0.0.0/0')
if opts.cluster_type == "mesos":
master_group.authorize('tcp', 38090, 38090, '0.0.0.0/0')
if opts.ganglia: