Repository navigation
perf(web): keep the launches and each workspace's counts until their jobs or runs change - #232
Merged
harenome merged 1 commit intoNov 19, 2026
Conversation
…jobs or runs change Both the Workspaces and the Launches pages re-read every run record's jobs (find_job_dirs and parse_job over each) through runs._every on every load, and Workspaces walked and grouped every workspace's jobs again for its run and check counts. workspace.heads stats each root and the head of each folder in it (the folder, its result.json and config.json): what find_job_dirs and an ended job's own records change by. runs._every keeps its result, and the Workspaces page each closed workspace's counts, while that, the run records' ids and states (and the workspace's roots) are unchanged and every job it read had ended. Anything else is recomputed as before.
harenome
force-pushed
the
perf/workspace-launch-counts
branch
from
November 19, 2026 13:33
527598d to
333e852
Compare
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.
Closes #230
What
workspace.heads(roots)is a cheap change key. For each root and each folder in it, it takes_head, the keyload_jobalready uses: the stat of the folder, of itsresult.jsonand of itsconfig.json. These are whatfind_job_dirsand a finished job's own records change by. It costs about three stats per folder, with no listing per job, no realpath and no JSON.runs._every()keeps its last result in_EVERY. The key is each record's id, state and jobs folder, plus theheadsof those folders. It keeps the result only when every job it read isfinished.workspaces._counts(ws, recs)keeps each closed workspace's counts in_COUNTS. The key is the workspace'sroots, itsjob_roots, theheadsof its job roots andrecs, the records' ids and states, built once per request. It keeps them only when all its jobs arefinished. The open workspace is computed on each load.Both memos live in memory, so the first load after a start costs what it does today. Nothing is written to disk.
Touches
backend (
nullius/workspace.py) · routes (web/runs.py,web/workspaces.py) · testsVerified
A synthetic profile in a rootless Podman container: 100 workspaces, 2000 Harbor jobs, 200 run records. Warm is the median of requests 2 to 5; two runs each, a fresh process per page.
/workspaces,/launchesand/launches?ws=ws000were saved from main and from the branch, each loaded twice so the second comes from the memo. After normalising the CSRF tokens, the asset digests and the interface digest, all six files are identical.python3 app/tests/parallel.py: 3061 tests in 155 modules, OK.pip install -r app/requirements.txt, thenpython3 app/tests/parallel.py app/ui_tests: 664 tests in 55 modules, OK.test_workspace.py:headsmoves when a job is added, removed or has its records rewritten, and not for a change inside a trial.test_run_routes.py, Workspaces: the memo is used, then the counts follow a job added, a job removed, a job's config rewritten in place, a launch added to the workspace and a run record removed.test_run_routes.py, Launches: the list follows a run that ends, a job added, a job removed and a job rewritten in place.headsstubbed to return(), both route tests fail.Not checked: a profile with runs in progress, which takes the full path as today.
Risk
shortcut:comment onheadssays when to key on each job's signature instead. The counts read no trial.n_running_trialsabove 0 by a crash is never kept, so that page costs what it does today.