Skip to content
This repository was archived by the owner on May 9, 2024. It is now read-only.

Commit 49f9f04

Browse files
committed
[SPARK-6980] Minor cleanup and scala style fix
1 parent 5b59a44 commit 49f9f04

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

core/src/main/scala/org/apache/spark/deploy/worker/ui/WorkerPage.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,15 @@ private[ui] class WorkerPage(parent: WorkerWebUI) extends WebUIPage("") {
3535
private val timeout = parent.timeout
3636

3737
override def renderJson(request: HttpServletRequest): JValue = {
38-
val stateFuture = (workerActor ? RequestWorkerState)(timeout.duration).mapTo[WorkerStateResponse]
38+
val stateFuture = (workerActor ? RequestWorkerState)(timeout.duration).
39+
mapTo[WorkerStateResponse]
3940
val workerState = timeout.awaitResult(stateFuture)
4041
JsonProtocol.writeWorkerState(workerState)
4142
}
4243

4344
def render(request: HttpServletRequest): Seq[Node] = {
44-
val stateFuture = (workerActor ? RequestWorkerState)(timeout.duration).mapTo[WorkerStateResponse]
45+
val stateFuture = (workerActor ? RequestWorkerState)(timeout.duration).
46+
mapTo[WorkerStateResponse]
4547
val workerState = timeout.awaitResult(stateFuture)
4648

4749
val executorHeaders = Seq("ExecutorID", "Cores", "State", "Memory", "Job Details", "Logs")

core/src/main/scala/org/apache/spark/rpc/RpcEnv.scala

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,8 @@ private[spark] object RpcAddress {
188188

189189

190190
/**
191-
* Associates a timeout with a configuration property so that a TimeoutException can be
192-
* traced back to the controlling property.
191+
* Associates a timeout with a description so that a when a TimeoutException occurs, additional
192+
* context about the timeout can be amended to the exception message.
193193
* @param timeout timeout duration in seconds
194194
* @param description description to be displayed in a timeout exception
195195
*/
@@ -212,14 +212,16 @@ private[spark] class RpcTimeout(timeout: FiniteDuration, description: String) {
212212
Await.result(future, duration)
213213
}
214214
catch {
215-
case te: TimeoutException =>
216-
throw amend(te)
215+
case te: TimeoutException => throw amend(te)
217216
}
218217
}
219-
220-
// TODO(bryanc) wrap Await.ready also
221218
}
222219

220+
221+
/**
222+
* Create an RpcTimeout using a configuration property that controls the timeout duration so when
223+
* a TimeoutException is thrown, the property key will be indicated in the message.
224+
*/
223225
object RpcTimeout {
224226

225227
private[this] val messagePrefix = "This timeout is controlled by "
@@ -248,5 +250,4 @@ object RpcTimeout {
248250
val timeout = { conf.getTimeAsSeconds(timeoutProp, defaultValue) seconds }
249251
new RpcTimeout(timeout, messagePrefix + timeoutProp)
250252
}
251-
252253
}

0 commit comments

Comments
 (0)