Skip to content

Commit 4846ce4

Browse files
committed
Hide "(Job Group") if no jobs were submitted in job groups.
1 parent 4d58e55 commit 4846ce4

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@ private[ui] class AllJobsPage(parent: JobsTab) extends WebUIPage("") {
3939
}
4040

4141
private def jobsTable(jobs: Seq[JobUIData]): Seq[Node] = {
42+
val someJobHasJobGroup = jobs.exists(_.jobGroup.isDefined)
43+
4244
val columns: Seq[Node] = {
43-
<th>Job Id (Job Group)</th>
45+
<th>{if (someJobHasJobGroup) "Job Id (Job Group)" else "Job Id"}</th>
4446
<th>Description</th>
4547
<th>Submitted</th>
4648
<th>Duration</th>

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,4 +142,25 @@ class UISeleniumSuite extends FunSuite with WebBrowser with Matchers {
142142
}
143143
}
144144
}
145+
146+
test("jobs page should not display job group name unless some job was submitted in a job group") {
147+
withSpark(newSparkContext()) { sc =>
148+
val ui = sc.ui.get
149+
// If no job has been run in a job group, then "(Job Group)" should not appear in the header
150+
sc.parallelize(Seq(1, 2, 3)).count()
151+
eventually(timeout(5 seconds), interval(50 milliseconds)) {
152+
go to (sc.ui.get.appUIAddress.stripSuffix("/") + "/jobs")
153+
val tableHeaders = findAll(cssSelector("th")).map(_.text).toSeq
154+
tableHeaders should not contain "Job Id (Job Group)"
155+
}
156+
// Once at least one job has been run in a job group, then we should display the group name:
157+
sc.setJobGroup("my-job-group", "my-job-group-description")
158+
sc.parallelize(Seq(1, 2, 3)).count()
159+
eventually(timeout(5 seconds), interval(50 milliseconds)) {
160+
go to (sc.ui.get.appUIAddress.stripSuffix("/") + "/jobs")
161+
val tableHeaders = findAll(cssSelector("th")).map(_.text).toSeq
162+
tableHeaders should contain ("Job Id (Job Group)")
163+
}
164+
}
165+
}
145166
}

0 commit comments

Comments
 (0)