add a Jobs view: pending runs and recorded jobs in one table (#2360, phase 4) - #2538
Open
ebuzerdrmz44 wants to merge 1 commit into
Open
add a Jobs view: pending runs and recorded jobs in one table (#2360, phase 4)#2538ebuzerdrmz44 wants to merge 1 commit into
ebuzerdrmz44 wants to merge 1 commit into
Conversation
…bs it already recorded
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Adds the Jobs view from #2360 goal 3. One table showing what the scheduler is holding a time for, and what it has already recorded.
Depends on nothing in flight. Branches off master, and does not touch
log_page.py.Screenshot
Where it lives
A
Jobspage in the Schedule tab's toolbox, following the Related Files map in the issue (views/schedule_tab.py - Add Jobs page), which also leaves the existing Log page alone.The table is global, not scoped to the selected profile, so it has a Profile column and lists every profile's jobs. Flagging it because it was one of the issue's open questions and was never settled in words.
Where the rows come from
Recorded rows come from
JobModel. Pending rows come from the scheduler's in-memory timers through a newVortaScheduler.pending_jobs(). So nothing writesStatus.SCHEDULEDto the table and the view has to merge the two halves itself.pending_jobs()returns aPendingJobper profile whose timer isSCHEDULEDorTOO_FAR_AHEAD, soonest first. It exists so the page never readsself.timersdirectly, which keeps the split in phase 2 an internal change.Why the refresh is split in two
reload_recordsre-readsJobModeland is wired tobackup_finished_event.reload_pendingonly walks the timers and is wired toschedule_changed.They are separate because
schedule_changedis a hot signal:reload_all_timersemits once per profile every 15 minutes, and three of the four emit sites fire whileVortaScheduler.lockis held. A single refresh doingJobModel.select()would put a full table read inside the scheduler's critical section on every schedule change. The record query is also capped at 200 rows, since the 6 month purge is the only other bound on that table.One residual worth naming:
pending_jobs()still does a primary key profile lookup per armed timer inside that lock. That is a handful of rows rather than the whole history, so I left it rather than caching profile names in the scheduler.What is deliberately not here
completedorrunningrows. Nothing writes those statuses yet, so the table renders pending plus skipped and failed. The lifecycle transitions and theevent_loglink belong to the Execution phase, and the view picks them up for free once they land.Notes
No schema change, no migration.
The Time column means
created_atfor a recorded job and the scheduled time for a pending one. That reads fine today because records only exist for skips, but once jobs carry real execution timestamps it is worth deciding whether the column is "when recorded" or "when due".Tests cover the accessor (scheduled, too far ahead for a QTimer, profile deleted under its timer, never-run profile), the row rendering for both sources, and the page itself through a real
schedule_changedemission.Merging this allows me to go on Phase D.