Skip to content

Commit 9eff537

Browse files
author
pgandhi
committed
[SPARK-24851] : Addressing Reviews August 9
1 parent 52b08b2 commit 9eff537

File tree

2 files changed

+20
-19
lines changed

2 files changed

+20
-19
lines changed

core/src/main/scala/org/apache/spark/status/AppStatusStore.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,9 @@ private[spark] class AppStatusStore(
113113
}
114114

115115
def stageAttempt(stageId: Int, stageAttemptId: Int,
116-
details: Boolean = false): (v1.StageData, Seq[Int]) = {
116+
details: Boolean = false): (v1.StageData, Seq[Int]) = {
117117
val stageKey = Array(stageId, stageAttemptId)
118-
val stageDataWrapper: StageDataWrapper = store.read(classOf[StageDataWrapper], stageKey)
118+
val stageDataWrapper = store.read(classOf[StageDataWrapper], stageKey)
119119
val stage = if (details) stageWithDetails(stageDataWrapper.info) else stageDataWrapper.info
120120
val jobIds = stageDataWrapper.jobIds
121121
(stage, jobIds.toSeq)

core/src/main/scala/org/apache/spark/ui/jobs/StagePage.scala

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -105,28 +105,29 @@ private[ui] class StagePage(parent: StagesTab, store: AppStatusStore) extends We
105105
val stageAttemptId = parameterAttempt.toInt
106106

107107
val stageHeader = s"Details for Stage $stageId (Attempt $stageAttemptId)"
108-
var stageDataTuple: Tuple2[StageData, Seq[Int]] = null
109-
try {
110-
stageDataTuple = parent.store.stageAttempt(stageId, stageAttemptId, details = false)
108+
var stageDataTuple: Option[Tuple2[StageData, Seq[Int]]] = try {
109+
Some(parent.store.stageAttempt(stageId, stageAttemptId, details = false))
111110
} catch {
112111
case e: NoSuchElementException => e.getMessage
112+
None
113113
}
114114
var stageData: StageData = null
115115
var stageJobIds: Seq[Int] = null
116-
if (stageDataTuple == null) {
117-
stageData = {
118-
val content =
119-
<div id="no-info">
120-
<p>No information to display for Stage
121-
{stageId}
122-
(Attempt
123-
{stageAttemptId})</p>
124-
</div>
125-
return UIUtils.headerSparkPage(request, stageHeader, content, parent)
126-
}
127-
} else {
128-
stageData = stageDataTuple._1
129-
stageJobIds = stageDataTuple._2
116+
stageDataTuple match {
117+
case Some(stageTuple) =>
118+
stageData = stageTuple._1
119+
stageJobIds = stageTuple._2
120+
case None =>
121+
stageData = {
122+
val content =
123+
<div id="no-info">
124+
<p>No information to display for Stage
125+
{stageId}
126+
(Attempt
127+
{stageAttemptId})</p>
128+
</div>
129+
return UIUtils.headerSparkPage(request, stageHeader, content, parent)
130+
}
130131
}
131132

132133
val localitySummary = store.localitySummary(stageData.stageId, stageData.attemptId)

0 commit comments

Comments
 (0)