Skip to content

Commit

Permalink
more explicit about total numbers of jobs & stages vs. number retained
Browse files Browse the repository at this point in the history
  • Loading branch information
squito committed Apr 1, 2015
1 parent 9922be0 commit 674f8dc
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 11 deletions.
13 changes: 10 additions & 3 deletions core/src/main/scala/org/apache/spark/ui/jobs/AllJobsPage.scala
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,13 @@ private[ui] class AllJobsPage(parent: JobsTab) extends WebUIPage("") {
val shouldShowCompletedJobs = completedJobs.nonEmpty
val shouldShowFailedJobs = failedJobs.nonEmpty

val completedJobNumStr = if (completedJobs.size == listener.numCompletedJobs) {
s"${completedJobs.size}"
} else {
s"${listener.numCompletedJobs}, only showing ${completedJobs.size}"
}


val summary: NodeSeq =
<div>
<ul class="unstyled">
Expand All @@ -136,9 +143,9 @@ private[ui] class AllJobsPage(parent: JobsTab) extends WebUIPage("") {
}
{
if (shouldShowCompletedJobs) {
<li>
<li id="completed-summary">
<a href="#completed"><strong>Completed Jobs:</strong></a>
{listener.numCompletedJobs}
{completedJobNumStr}
</li>
}
}
Expand All @@ -159,7 +166,7 @@ private[ui] class AllJobsPage(parent: JobsTab) extends WebUIPage("") {
activeJobsTable
}
if (shouldShowCompletedJobs) {
content ++= <h4 id="completed">Completed Jobs ({completedJobs.size})</h4> ++
content ++= <h4 id="completed">Completed Jobs ({completedJobNumStr})</h4> ++
completedJobsTable
}
if (shouldShowFailedJobs) {
Expand Down
12 changes: 9 additions & 3 deletions core/src/main/scala/org/apache/spark/ui/jobs/AllStagesPage.scala
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ private[ui] class AllStagesPage(parent: StagesTab) extends WebUIPage("") {
val shouldShowCompletedStages = completedStages.nonEmpty
val shouldShowFailedStages = failedStages.nonEmpty

val completedStageNumStr = if (numCompletedStages == completedStages.size) {
s"$numCompletedStages"
} else {
s"$numCompletedStages, only showing ${completedStages.size}"
}

val summary: NodeSeq =
<div>
<ul class="unstyled">
Expand Down Expand Up @@ -98,9 +104,9 @@ private[ui] class AllStagesPage(parent: StagesTab) extends WebUIPage("") {
}
{
if (shouldShowCompletedStages) {
<li>
<li id="completed-summary">
<a href="#completed"><strong>Completed Stages:</strong></a>
{numCompletedStages}
{completedStageNumStr}
</li>
}
}
Expand Down Expand Up @@ -132,7 +138,7 @@ private[ui] class AllStagesPage(parent: StagesTab) extends WebUIPage("") {
pendingStagesTable.toNodeSeq
}
if (shouldShowCompletedStages) {
content ++= <h4 id="completed">Completed Stages ({numCompletedStages})</h4> ++
content ++= <h4 id="completed">Completed Stages ({completedStageNumStr})</h4> ++
completedStagesTable.toNodeSeq
}
if (shouldShowFailedStages) {
Expand Down
9 changes: 4 additions & 5 deletions core/src/test/scala/org/apache/spark/ui/UISeleniumSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,6 @@ class UISeleniumSuite extends FunSuite with WebBrowser with Matchers with Before
sc.parallelize(idx to (idx + 3)).collect()
}


val expJobInfo = Seq(
("9", "collect"),
("8", "count")
Expand All @@ -450,7 +449,8 @@ class UISeleniumSuite extends FunSuite with WebBrowser with Matchers with Before
eventually(timeout(1 second), interval(50 milliseconds)) {
goToUi(sc, "/jobs")
// The completed jobs table should have two rows. The first row will be the most recent job:
find("completed").get.text should be ("Completed Jobs (2)")
find("completed-summary").get.text should be ("Completed Jobs: 10, only showing 2")
find("completed").get.text should be ("Completed Jobs (10, only showing 2)")
val rows = findAll(cssSelector("tbody tr")).toIndexedSeq.map{_.underlying}
rows.size should be (expJobInfo.size)
for {
Expand Down Expand Up @@ -481,8 +481,6 @@ class UISeleniumSuite extends FunSuite with WebBrowser with Matchers with Before
goToUi(sc, "/jobs/job/?id=7")
find("no-info").get.text should be ("No information to display for job 7")

//TODO json for one job

val expStageInfo = Seq(
("19", "collect"),
("18", "count"),
Expand All @@ -491,7 +489,8 @@ class UISeleniumSuite extends FunSuite with WebBrowser with Matchers with Before

eventually(timeout(1 second), interval(50 milliseconds)) {
goToUi(sc, "/stages")
find("completed").get.text should be ("Completed Stages (20)")
find("completed-summary").get.text should be ("Completed Stages: 20, only showing 3")
find("completed").get.text should be ("Completed Stages (20, only showing 3)")
val rows = findAll(cssSelector("tbody tr")).toIndexedSeq.map{_.underlying}
rows.size should be (3)
for {
Expand Down

0 comments on commit 674f8dc

Please sign in to comment.