File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed
main/scala/org/apache/spark/ui/jobs
test/scala/org/apache/spark/ui Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff 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 >
Original file line number Diff line number Diff 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}
You can’t perform that action at this time.
0 commit comments