Skip to content

Commit

Permalink
[SPARK-23051][CORE] Fix for broken job description in Spark UI
Browse files Browse the repository at this point in the history
## What changes were proposed in this pull request?

In 2.2, Spark UI displayed the stage description if the job description was not set. This functionality was broken, the GUI has shown no description in this case. In addition, the code uses jobName and
jobDescription instead of stageName and stageDescription when JobTableRowData is created.

In this PR the logic producing values for the job rows was modified to find the latest stage attempt for the job and use that as a fallback if job description was missing.
StageName and stageDescription are also set using values from stage and jobName/description is used only as a fallback.

## How was this patch tested?
Manual testing of the UI, using the code in the bug report.

Author: Sandor Murakozi <[email protected]>

Closes #20251 from smurakozi/SPARK-23051.

(cherry picked from commit 60eeecd)
Signed-off-by: Sean Owen <[email protected]>
  • Loading branch information
smurakozi authored and srowen committed Jan 14, 2018
1 parent 5fbbd94 commit 9051e1a
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions core/src/main/scala/org/apache/spark/ui/jobs/AllJobsPage.scala
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,10 @@ private[ui] class AllJobsPage(parent: JobsTab, store: AppStatusStore) extends We
}.map { job =>
val jobId = job.jobId
val status = job.status
val displayJobDescription =
if (job.description.isEmpty) {
job.name
} else {
UIUtils.makeDescription(job.description.get, "", plainText = true).text
}
val jobDescription = store.lastStageAttempt(job.stageIds.max).description
val displayJobDescription = jobDescription
.map(UIUtils.makeDescription(_, "", plainText = true).text)
.getOrElse("")
val submissionTime = job.submissionTime.get.getTime()
val completionTime = job.completionTime.map(_.getTime()).getOrElse(System.currentTimeMillis())
val classNameByStatus = status match {
Expand Down Expand Up @@ -429,20 +427,23 @@ private[ui] class JobDataSource(
val formattedDuration = duration.map(d => UIUtils.formatDuration(d)).getOrElse("Unknown")
val submissionTime = jobData.submissionTime
val formattedSubmissionTime = submissionTime.map(UIUtils.formatDate).getOrElse("Unknown")
val jobDescription = UIUtils.makeDescription(jobData.description.getOrElse(""),
basePath, plainText = false)
val lastStageAttempt = store.lastStageAttempt(jobData.stageIds.max)
val lastStageDescription = lastStageAttempt.description.getOrElse("")

val formattedJobDescription =
UIUtils.makeDescription(lastStageDescription, basePath, plainText = false)

val detailUrl = "%s/jobs/job?id=%s".format(basePath, jobData.jobId)

new JobTableRowData(
jobData,
jobData.name,
jobData.description.getOrElse(jobData.name),
lastStageAttempt.name,
lastStageDescription,
duration.getOrElse(-1),
formattedDuration,
submissionTime.map(_.getTime()).getOrElse(-1L),
formattedSubmissionTime,
jobDescription,
formattedJobDescription,
detailUrl
)
}
Expand Down

0 comments on commit 9051e1a

Please sign in to comment.