Skip to content
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

Jobs Index Page: Live Updates + Pagination #20452

Merged
merged 47 commits into from
May 6, 2024

Conversation

philrenaud
Copy link
Contributor

@philrenaud philrenaud commented Apr 18, 2024

A new way of handling some long-needed upgrades to the Jobs Index page in the web UI:

  • Live updates to jobs in your cluster (new jobs, GC'd jobs)
  • Current (rather than historic) status of those jobs (Show allocation status for only those expected to be running, rather than a long history from state)
  • Real pagination, filtering, and searching against the server, rather than loading every job into the browser

This has also included some side-effect features that we think will be a big improvement to web UI quality of life:

  • Updated Job Status concepts, to surface job conditions like Degraded and Recovering instead of Running | Dead | Pending.
  • A dedicated User Settings section in the profile nav where you can view and set localStorage settings for a few new features
  • Parent jobs (parameterized, periodic) no longer eagerly loading child jobs at the /jobs index level, freeing up quite a lot of bandwidth for common use-cases

image
image
image


General methodology:

  • The /jobs/index route's model kicks off a GET /statuses query aimed at getting all jobs indexes with your current params, like namespace, etc. Not blocking, just initializing.
  • Once returned, we take the jobIDs and nextToken from that and set them on the /jobs/index controller, then kick off the controller's watchJobs and watchJobIDs methods
  • controller:
    • watchJobIDs:
      • runs a blocking GET /statuses query with an ?index first set by the route's model method
      • Upon receiving a response:
        • Updates query index (property on controller)
        • Updates this.nextToken (to allow pagination)
        • If the user allows jostling (default true; localStorage liveUpdatesEnabled):
          • Updates this.jobIDs
          • Kicks off this.watchJobs
        • Otherwise:
          • Updates this.pendingJobIDs/pendingJobs and gives the user a button to press to kick off this.watchJobs
    • watchJobs:
      • runs a blocking POST /statuses with an ?index set from the most recent watchJobIDs GET
      • Upon receiving a response:
        • Refreshes what the user sees in the jobs table
    • Watches for changes to filters (namespace, node pool, etc.) and aborts/re-runs watchJobIDs when they change
  • watch-list service:
    • Stores AbortControllers for jobsIndexIDsController and jobsIndexDetailsController, so that we may cancel them and re-set them as needed when something changes remotely (a job gets GC'd, say)
      • These get aborted via the route's willTransition method (so that we're not keeping blocking queries open when you're off-page), and aborted/re-set when a new watchJobIDs or watchJobs happens (on unblock because of new data)
  • Job Adapter:
    • Splits query requests (from watchJobIDs and watchJobs) to be either GET or POST respectively
    • On POST, generates a unique hash based on requestBody and uses that as a key in the watch-list service for future index lookups[b][c][d][e]
  • Job Serializer:
    • Normalizes the response from watchJobs to account for "jobs you requested but we don't have any info about", to show the user an unclickable 'Probably garbage collected/purged" row in the table
    • Take the Allocs data for each job and shape them like other Allocations[f][g] in the app. In this way, we can make determinations about a job's health, version, etc. from the index page.

(Re-do of #19778 before I borked the rebase)

Copy link

github-actions bot commented Apr 18, 2024

Ember Test Audit comparison

main ec5be26 change
passes 1550 1559 +9
failures 0 0 0
flaky 0 0 0
duration 10m 41s 926ms 11m 30s 226ms +48s 300ms

@philrenaud philrenaud changed the title Bff job summary fe redux (attempting to untangle) Jobs Index Page: Live Updates + Pagination Apr 18, 2024
@philrenaud philrenaud force-pushed the bff-job-summary-fe-redux-untangle branch from cf94d52 to 7532eb7 Compare April 30, 2024 20:13
@philrenaud philrenaud force-pushed the bff-job-summary-fe-redux-untangle branch from baa42fe to 3350ebc Compare May 2, 2024 17:58
@gulducat gulducat force-pushed the bff-accurate-jobs-summaries branch from 7d819dd to cb8a211 Compare May 3, 2024 15:46
Base automatically changed from bff-accurate-jobs-summaries to main May 3, 2024 20:01
@philrenaud philrenaud requested a review from gulducat May 6, 2024 14:07
philrenaud and others added 9 commits May 6, 2024 11:23
* modifyIndex-based pagination

* modifyIndex gets its own column and pagination compacted with icons

* A generic withPagination handler for mirage

* Some live-PR changes

* Pagination and button disabled tests

* Job update handling tests for jobs index

* assertion timeout in case of long setTimeouts

* assert.timeouts down to 500ms

* de-to-do

* Clarifying comment and test descriptions
* Beginnings of a search box for filter expressions

* jobSearchBox integration test

* jobs list updateFilter initial test

* Basic jobs list filtering tests

* First attempt at side-by-side facets and search with a computed filter

* Weirdly close to an iterative approach but checked isnt tracked properly

* Big rework to make filter composition and decomposition work nicely with the url

* Namespace facet dropdown added

* NodePool facet dropdown added

* hdsFacet for future testing and basic namespace filtering test

* Namespace filter existence test

* Status filtering

* Node pool/dynamic facet test

* Test patchups

* Attempt at optimize test fix

* Allocation re-load on optimize page explainer

* The Big Un-Skip

* Post-PR-review cleanup
…0493)

* First pass at a non-watchQuery version

* Parameterized jobs get child fetching and jobs index status style for parent jobs

* Completed allocs vs Running allocs in a child-job context, and fix an issue where moving from parent to parent would not reset index

* Testfix and better handling empty-child-statuses-list

* Parent/child test case

* Dont show empty allocation-status bars for parent jobs with no children
Copy link
Member

@gulducat gulducat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bring on those live updates! 👏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants