Skip to content

Commit 034aa8d

Browse files
committed
Use .max() to find result stage for job.
1 parent eebdc2c commit 034aa8d

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ private[ui] class AllJobsPage(parent: JobsTab) extends WebUIPage("") {
4343
}
4444

4545
def makeRow(job: JobUIData): Seq[Node] = {
46-
val lastStageInfo = job.stageIds.lastOption.flatMap(listener.stageIdToInfo.get)
46+
val lastStageInfo = listener.stageIdToInfo.get(job.stageIds.max)
4747
val lastStageData = lastStageInfo.flatMap { s =>
4848
listener.stageIdToData.get((s.stageId, s.attemptId))
4949
}

core/src/test/scala/org/apache/spark/ui/UISeleniumSuite.scala

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,4 +238,24 @@ class UISeleniumSuite extends FunSuite with WebBrowser with Matchers {
238238
}
239239
}
240240
}
241+
242+
243+
test("jobs with stages thatare skipped should show correct link descriptions on jobs page") {
244+
withSpark(newSparkContext()) { sc =>
245+
// Create an RDD that involves multiple stages:
246+
val rdd =
247+
sc.parallelize(Seq(1, 2, 3)).map(identity).groupBy(identity).map(identity).groupBy(identity)
248+
// Run it twice; this will cause the second job to have two "phantom" stages that were
249+
// mentioned in its job start event but which were never actually executed:
250+
rdd.count()
251+
rdd.count()
252+
eventually(timeout(10 seconds), interval(50 milliseconds)) {
253+
go to (sc.ui.get.appUIAddress.stripSuffix("/") + "/jobs")
254+
findAll(cssSelector("tbody tr a")).foreach { link =>
255+
link.text.toLowerCase should include ("count")
256+
link.text.toLowerCase should not include "unknown"
257+
}
258+
}
259+
}
260+
}
241261
}

0 commit comments

Comments
 (0)