Optimize task ordering through LPT scheduling#117
Optimize task ordering through LPT scheduling#117clkao wants to merge 3 commits intodbt-labs:mainfrom
Conversation
Sort tasks by descending estimated runtime before submitting to the thread pool, so the slowest tasks start first and reduce tail latency. Hints are loaded from a reference experiment's results.json. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Do you have a profiler run you can share? |
|
I like the idea of this working magically, but dislike the idea of having to specify a directory every time. What about a well known directory like |
|
@joellabes we can also default to the latest run in experiments, but this gets annoying if the latest one is a subset and you're running the full suite. another reason for a specific one is with different plugin sets, tasks might have different duration. |
yeah that well-known file path wouldn’t be just the most recent run, it'd be populated by every invocation. I figured it'd overwrite just the ones that were evaluated with their most recent timing, so it might look like
I guess? if so, you'd only have a single suboptimal run before it got overwritten with up to date stats, assuming you're iterating on a single plugin type at once. That json file could be changed to be keyed by many different dimensions (plugin set, agent, database, project type, prompt hash...) if you want, but more cardinality reduces the number of hits you get 🤷♂️ ⚖️ |
Shave sage run from 7m57s to 7m13s.
Summary
--duration-hintsCLI option pointing to a reference experiment directoryruntime_msfrom that experiment'sresults.jsonand sort tasks by descending duration before submitting to the thread poolTest plan
ade run all --db duckdb --project-type dbt --agent sage --duration-hints experiments/claude-haiku-4-5-20251001-latest— confirmLPT task order:log line shows descending runtimesade run all --db duckdb --project-type dbt --agent sage— confirm no LPT log, behavior unchanged--duration-hints experiments/nonexistent— confirm warning logged, falls back to default orderuv run python -m pytest tests/test_duration_hints.py -v— 6 unit tests pass🤖 Generated with Claude Code