-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-31971][WEBUI] Add pagination support for all jobs timeline #28803
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
Closed
sarutak
wants to merge
3
commits into
apache:master
from
sarutak:add-pagination-support-for-all-jobs-timeline
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -162,7 +162,11 @@ private[ui] class AllJobsPage(parent: JobsTab, store: AppStatusStore) extends We | |
| private def makeTimeline( | ||
| jobs: Seq[v1.JobData], | ||
| executors: Seq[v1.ExecutorSummary], | ||
| startTime: Long): Seq[Node] = { | ||
| startTime: Long, | ||
| page: Int, | ||
| pageSize: Int, | ||
| totalPages: Int, | ||
| totalJobs: Int): Seq[Node] = { | ||
|
|
||
| val jobEventJsonAsStrSeq = makeJobEvent(jobs) | ||
| val executorEventJsonAsStrSeq = makeExecutorEvent(executors) | ||
|
|
@@ -184,20 +188,52 @@ private[ui] class AllJobsPage(parent: JobsTab, store: AppStatusStore) extends We | |
| val eventArrayAsStr = | ||
| (jobEventJsonAsStrSeq ++ executorEventJsonAsStrSeq).mkString("[", ",", "]") | ||
|
|
||
| <span class="expand-application-timeline"> | ||
| <span class="expand-application-timeline-arrow arrow-closed"></span> | ||
| <a data-toggle="tooltip" title={ToolTips.JOB_TIMELINE} data-placement="top"> | ||
| Event Timeline | ||
| </a> | ||
| </span> ++ | ||
| <div id="application-timeline" class="collapsed"> | ||
| <div class="control-panel"> | ||
| <div id="application-timeline-zoom-lock"> | ||
| <input type="checkbox"></input> | ||
| <span>Enable zooming</span> | ||
| if (totalPages > 0) { | ||
| <span class="expand-application-timeline"> | ||
| <span class="expand-application-timeline-arrow arrow-closed"></span> | ||
| <a data-toggle="tooltip" title={ToolTips.JOB_TIMELINE} data-placement="top"> | ||
| Event Timeline | ||
| </a> | ||
| </span> ++ | ||
| <div id="application-timeline" class="collapsed"> | ||
| <div class="control-panel"> | ||
| <div id="application-timeline-zoom-lock"> | ||
| <input type="checkbox"></input> | ||
| <span>Enable zooming</span> | ||
| </div> | ||
| <div> | ||
| <form id={s"form-event-timeline-page"} | ||
| method="get" | ||
| action="" | ||
| class="form-inline justify-content-end" | ||
| style="width: 50%; margin-left: auto; margin-bottom: 0px;"> | ||
| <label>Jobs: | ||
| {totalJobs} | ||
| . | ||
| {totalPages} | ||
| Pages. Jump to</label> | ||
| <input type="text" | ||
| name="jobs.eventTimelinePageNumber" | ||
| id={s"form-event-timeline-page-no"} | ||
|
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. Nit: I find similar code in StagePage.scala. But why do we need
Member
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. Exactly. I'll remove |
||
| value={page.toString} | ||
| class="col-1 form-control"/> | ||
| <label>. Show</label> | ||
| <input type="text" | ||
| id={s"form-event-timeline-page-size"} | ||
| name="jobs.eventTimelinePageSize" | ||
| value={pageSize.toString} | ||
| class="col-1 form-control"/> | ||
| <label>items in a page.</label> | ||
| <button type="submit" id="form-event-timeline-page-button" class="btn btn-spark"> | ||
| Go | ||
| </button> | ||
| </form> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </div> ++ | ||
| } else { | ||
| Seq.empty | ||
| } ++ | ||
| <script type="text/javascript"> | ||
| {Unparsed(s"drawApplicationTimeline(${groupJsonArrayAsStr}," + | ||
| s"${eventArrayAsStr}, ${startTime}, ${UIUtils.getTimeZoneOffset()});")} | ||
|
|
@@ -258,6 +294,25 @@ private[ui] class AllJobsPage(parent: JobsTab, store: AppStatusStore) extends We | |
| } | ||
| } | ||
|
|
||
| val eventTimelineParameterJobsPage = request.getParameter("jobs.eventTimelinePageNumber") | ||
| val eventTimelineParameterJobsPageSize = request.getParameter("jobs.eventTimelinePageSize") | ||
| var eventTimelineJobsPage = Option(eventTimelineParameterJobsPage).map(_.toInt).getOrElse(1) | ||
| var eventTimelineJobsPageSize = | ||
| Option(eventTimelineParameterJobsPageSize).map(_.toInt).getOrElse(100) | ||
|
|
||
| val totalJobs = completedJobs.size + failedJobs.size + activeJobs.size | ||
| if (eventTimelineJobsPageSize < 1 || eventTimelineJobsPageSize > totalJobs) { | ||
| eventTimelineJobsPageSize = totalJobs | ||
| } | ||
| val eventTimelineTotalPages = if (eventTimelineJobsPageSize > 0) { | ||
| (totalJobs + eventTimelineJobsPageSize - 1) / eventTimelineJobsPageSize | ||
| } else { | ||
| 0 | ||
| } | ||
| if (eventTimelineJobsPage < 1 || eventTimelineJobsPage > eventTimelineTotalPages) { | ||
| eventTimelineJobsPage = 1 | ||
| } | ||
|
|
||
| val activeJobsTable = | ||
| jobsTable(request, "active", "activeJob", activeJobs, killEnabled = parent.killEnabled) | ||
| val completedJobsTable = | ||
|
|
@@ -329,9 +384,16 @@ private[ui] class AllJobsPage(parent: JobsTab, store: AppStatusStore) extends We | |
| </ul> | ||
| </div> | ||
|
|
||
| val from = (eventTimelineJobsPage - 1) * eventTimelineJobsPageSize | ||
| val to = from + eventTimelineJobsPageSize | ||
| var content = summary | ||
| content ++= makeTimeline(activeJobs ++ completedJobs ++ failedJobs, | ||
| store.executorList(false), startTime) | ||
| content ++= makeTimeline( | ||
| (activeJobs ++ completedJobs ++ failedJobs).sortBy(_.submissionTime).slice(from, to), | ||
| store.executorList(false), | ||
| startTime, eventTimelineJobsPage, | ||
| eventTimelineJobsPageSize, | ||
| eventTimelineTotalPages, | ||
| totalJobs) | ||
|
|
||
| if (shouldShowActiveJobs) { | ||
| content ++= | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
nit: shall we move the style to webui.css?
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.
Thanks. I'll consider it.