Skip to content

Commit caace6e

Browse files
committed
Tweak web UI so that people don't get confused about master URL format
1 parent f886b42 commit caace6e

File tree

5 files changed

+12
-9
lines changed

5 files changed

+12
-9
lines changed

core/src/main/scala/spark/deploy/DeployMessage.scala

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,18 @@ private[spark] case object RequestMasterState
7575
// Master to MasterWebUI
7676

7777
private[spark]
78-
case class MasterState(uri: String, workers: Array[WorkerInfo], activeJobs: Array[JobInfo],
79-
completedJobs: Array[JobInfo])
78+
case class MasterState(host: String, port: Int, workers: Array[WorkerInfo],
79+
activeJobs: Array[JobInfo], completedJobs: Array[JobInfo]) {
80+
81+
def uri = "spark://" + host + ":" + port
82+
}
8083

8184
// WorkerWebUI to Worker
8285
private[spark] case object RequestWorkerState
8386

8487
// Worker to WorkerWebUI
8588

8689
private[spark]
87-
case class WorkerState(uri: String, workerId: String, executors: List[ExecutorRunner],
90+
case class WorkerState(host: String, port: Int, workerId: String, executors: List[ExecutorRunner],
8891
finishedExecutors: List[ExecutorRunner], masterUrl: String, cores: Int, memory: Int,
8992
coresUsed: Int, memoryUsed: Int, masterWebUiUrl: String)

core/src/main/scala/spark/deploy/master/Master.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ private[spark] class Master(ip: String, port: Int, webUiPort: Int) extends Actor
145145
}
146146

147147
case RequestMasterState => {
148-
sender ! MasterState(ip + ":" + port, workers.toArray, jobs.toArray, completedJobs.toArray)
148+
sender ! MasterState(ip, port, workers.toArray, jobs.toArray, completedJobs.toArray)
149149
}
150150
}
151151

core/src/main/scala/spark/deploy/worker/Worker.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ private[spark] class Worker(
158158
masterDisconnected()
159159

160160
case RequestWorkerState => {
161-
sender ! WorkerState(ip + ":" + port, workerId, executors.values.toList,
161+
sender ! WorkerState(ip, port, workerId, executors.values.toList,
162162
finishedExecutors.values.toList, masterUrl, cores, memory,
163163
coresUsed, memoryUsed, masterWebUiUrl)
164164
}

core/src/main/twirl/spark/deploy/master/index.scala.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
@import spark.deploy.master._
33
@import spark.Utils
44

5-
@spark.deploy.common.html.layout(title = "Spark Master on " + state.uri) {
5+
@spark.deploy.common.html.layout(title = "Spark Master on " + state.host) {
66

77
<!-- Cluster Details -->
88
<div class="row">
99
<div class="span12">
1010
<ul class="unstyled">
11-
<li><strong>URL:</strong> spark://@(state.uri)</li>
11+
<li><strong>URL:</strong> @(state.uri)</li>
1212
<li><strong>Workers:</strong> @state.workers.size </li>
1313
<li><strong>Cores:</strong> @{state.workers.map(_.cores).sum} Total,
1414
@{state.workers.map(_.coresUsed).sum} Used</li>

core/src/main/twirl/spark/deploy/worker/index.scala.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
@import spark.Utils
44

5-
@spark.deploy.common.html.layout(title = "Spark Worker on " + worker.uri) {
5+
@spark.deploy.common.html.layout(title = "Spark Worker on " + worker.host) {
66

77
<!-- Worker Details -->
88
<div class="row">
@@ -11,12 +11,12 @@
1111
<li><strong>ID:</strong> @worker.workerId</li>
1212
<li><strong>
1313
Master URL:</strong> @worker.masterUrl
14-
(WebUI at <a href="@worker.masterWebUiUrl">@worker.masterWebUiUrl</a>)
1514
</li>
1615
<li><strong>Cores:</strong> @worker.cores (@worker.coresUsed Used)</li>
1716
<li><strong>Memory:</strong> @{Utils.memoryMegabytesToString(worker.memory)}
1817
(@{Utils.memoryMegabytesToString(worker.memoryUsed)} Used)</li>
1918
</ul>
19+
<p><a href="@worker.masterWebUiUrl">Back to Master</a></p>
2020
</div>
2121
</div>
2222

0 commit comments

Comments
 (0)