-
Notifications
You must be signed in to change notification settings - Fork 29.3k
[SPARK-24851][UI] Map a Stage ID to it's Associated Job ID #21809
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
7be0520
3151a62
a50e8b1
d57e6dc
3a06b87
52b08b2
9eff537
3b73840
0be099a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -112,10 +112,13 @@ private[spark] class AppStatusStore( | |
| } | ||
| } | ||
|
|
||
| def stageAttempt(stageId: Int, stageAttemptId: Int, details: Boolean = false): v1.StageData = { | ||
| def stageAttempt(stageId: Int, stageAttemptId: Int, | ||
| details: Boolean = false): (v1.StageData, Seq[Int]) = { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. indent , you might make it look like taskSummary
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done, thanks! |
||
| val stageKey = Array(stageId, stageAttemptId) | ||
| val stage = store.read(classOf[StageDataWrapper], stageKey).info | ||
| if (details) stageWithDetails(stage) else stage | ||
| val stageDataWrapper: StageDataWrapper = store.read(classOf[StageDataWrapper], stageKey) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you don't really need the type here (: StageDataWrapper)
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done, thanks! |
||
| val stage = if (details) stageWithDetails(stageDataWrapper.info) else stageDataWrapper.info | ||
| val jobIds = stageDataWrapper.jobIds | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. instead of having separate val just put this in the return: (stage, stageDataWrapper.jobIds.toSeq)
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
| (stage, jobIds.toSeq) | ||
| } | ||
|
|
||
| def taskCount(stageId: Int, stageAttemptId: Int): Long = { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,7 +18,7 @@ | |
| package org.apache.spark.ui.jobs | ||
|
|
||
| import java.net.URLEncoder | ||
| import java.util.Date | ||
| import java.util.{Date, NoSuchElementException} | ||
| import java.util.concurrent.TimeUnit | ||
| import javax.servlet.http.HttpServletRequest | ||
|
|
||
|
|
@@ -105,15 +105,29 @@ private[ui] class StagePage(parent: StagesTab, store: AppStatusStore) extends We | |
| val stageAttemptId = parameterAttempt.toInt | ||
|
|
||
| val stageHeader = s"Details for Stage $stageId (Attempt $stageAttemptId)" | ||
| val stageData = parent.store | ||
| .asOption(parent.store.stageAttempt(stageId, stageAttemptId, details = false)) | ||
| .getOrElse { | ||
| var stageDataTuple: Tuple2[StageData, Seq[Int]] = null | ||
| try { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you could use options here instead of try and null checks to make this cleaner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done, thanks! |
||
| stageDataTuple = parent.store.stageAttempt(stageId, stageAttemptId, details = false) | ||
| } catch { | ||
| case e: NoSuchElementException => e.getMessage | ||
| } | ||
| var stageData: StageData = null | ||
| var stageJobIds: Seq[Int] = null | ||
| if (stageDataTuple == null) { | ||
| stageData = { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this code branch is unreachable.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is unreachable by the IDE but during runtime, the code does work, I have confirmed that. |
||
| val content = | ||
| <div id="no-info"> | ||
| <p>No information to display for Stage {stageId} (Attempt {stageAttemptId})</p> | ||
| <p>No information to display for Stage | ||
| {stageId} | ||
| (Attempt | ||
| {stageAttemptId})</p> | ||
| </div> | ||
| return UIUtils.headerSparkPage(request, stageHeader, content, parent) | ||
| } | ||
| } else { | ||
| stageData = stageDataTuple._1 | ||
| stageJobIds = stageDataTuple._2 | ||
| } | ||
|
|
||
| val localitySummary = store.localitySummary(stageData.stageId, stageData.attemptId) | ||
|
|
||
|
|
@@ -182,6 +196,15 @@ private[ui] class StagePage(parent: StagesTab, store: AppStatusStore) extends We | |
| {Utils.bytesToString(stageData.diskBytesSpilled)} | ||
| </li> | ||
| }} | ||
| {if (!stageJobIds.isEmpty) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This could throw an NPE if
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since, we are returning from the code if it is None, it should never reach there as far as I can tell. |
||
| <li> | ||
| <strong>Associated Job Ids: </strong> | ||
| {stageJobIds.map(jobId => {val detailUrl = "%s/jobs/job/?id=%s".format( | ||
| UIUtils.prependBaseUri(request, parent.basePath), jobId) | ||
| <a href={s"${detailUrl}"}>{s"${jobId}"} </a> | ||
| })} | ||
| </li> | ||
| }} | ||
| </ul> | ||
| </div> | ||
|
|
||
|
|
@@ -1047,7 +1070,7 @@ private[ui] object ApiHelper { | |
| } | ||
|
|
||
| def lastStageNameAndDescription(store: AppStatusStore, job: JobData): (String, String) = { | ||
| val stage = store.asOption(store.stageAttempt(job.stageIds.max, 0)) | ||
| val stage = store.asOption(store.stageAttempt(job.stageIds.max, 0)._1) | ||
| (stage.map(_.name).getOrElse(""), stage.flatMap(_.description).getOrElse(job.name)) | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing the return type to (StageData, jobIds) might be simpler.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done