Repository navigation
feat(dump): JSON dump of all taskguard knows about a job - #29
Merged
Merged
Conversation
`taskguard dump PATTERN | --cmd "COMMAND" | --run ID` prints one JSON document per job: how it matches, the rules in force and who set them, what the next run reserves and why (step by step), each recent run with its wait spans, adjustments and role in the need, pruned runs, and live queue entries. The need math moves from runner.rs into need.rs, so the runner and dump use the same code. Each run now stores its need steps in a new nullable column, runs.need_why (also in pruned_runs and RUN_COLUMNS), so old runs can be explained after the fact. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
Why
Roderik reported jobs that kept reserving a one-time 17 GB peak. To find the cause we had to read the SQLite history by hand. This adds one command that prints everything taskguard knows about a job, so the next case (and tuning the rules) takes one paste.
What
taskguard dump PATTERN | --cmd "COMMAND" | --run ID [--runs N]prints JSON. For each job it shows:match: pool, label, minimums, and which rule set what.config: settings files, which file changed which setting, and the learn rules (keep,boost_runs,outlier_*,new_job_mem, caps).learned: what the history says, with outliers and ignored failed runs.next_need: what the next run reserves. Each step has a reason (history,boost,first_guess,cpu_cap,min_cpu,min_mem,mem_cap).runs: each stored run (every column), itswait_spansandadjustments, and arole: whether it is in the window, an outlier, failed and ignored, or a boost trigger.prunedandlive(the queue entry with its blocker).How
runner.rsintosrc/need.rs(need::derive). The runner anddumpnow call the same code, so the dump cannot drift from what really runs. Behaviour is unchanged.runs.need_why(JSON). The column is also added topruned_runsandRUN_COLUMNS. It is added inDb::openlikenested_jobs, so mixed versions keep working. Older versions leave it empty, and an older version's prune drops it. It is debug data only.Verified
cargo fmt --check,cargo clippy --all-targets -D warnings, andcargo test(173 unit + 29 CLI) pass.need::tests(each step and its reason, caps, minimums, first guess, ignored failed runs) anddump_shows_what_a_job_reserves_and_why(CLI: by key,--run,--cmd, and storedneed_why).taskguard dump 'root:tsc_-p_tsconfig.json'shows the 14.5 GB failed run as "failed, and its peak is ignored", with a next need of 193 MB.No release: this goes in the next version.
🤖 Generated with Claude Code