Repository navigation
local-efficiency 0.13.0: host-run lends idle CPU permits and keeps long runs off the CI Mac - #41
Merged
Merged
Conversation
When every CPU permit is held, a shared or heavy run that has waited 20 seconds may borrow permits from a second pool of the same size, while the cores it would use plus 20% of all cores are idle and at least 25% of memory is free. It keeps its place in the ordinary queue until a loan admits it. Exclusive runs never borrow, and a run that takes every CPU permit takes every borrowed permit before it starts. On an 18-core workstation, four overnight soak runs held 4 of 6 permits for hours while using about 1.1 cores between them. The CPU was 61% idle, and runs on that host had waited 1,556 minutes in the previous 24 hours. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A forwarded run holds the remote's CI machine lock for its whole run. A heavy run with --max-hold over an hour (or none) now stays on this Mac with one line saying why; --remote refuses it with exit 69. Before this, a forwarded soak held the lock for hours, so CI steps that need the Mac alone timed out on their lock wait while the Mac sat mostly idle. The background-priority test now compares against the priority the suite inherits, so the check passes when it runs at background priority, as it does under host-run while the owner is typing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- A heavy run forwarded without --max-hold now gets an hour on the remote, so no forwarded run holds the remote's CI machine lock for longer. - A run that takes every CPU permit records that it is waiting, and no new loan starts meanwhile, so later runs cannot overtake it by borrowing. - When the borrowed-permit pool cannot be used, such a run runs on its own permits with a warning instead of failing. - Tests no longer assume six permits: on 2-permit hosts a heavy run takes every permit and so also takes every borrowed one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
|
Independent review: two findings fixed in ea98aeb (a forwarded run with no hold now gets an hour there; a run that takes every permit records that it waits, so no new loan overtakes it, and it runs on its own permits when the borrowed pool cannot be used). Accepted as low: two runs sampling in the same 15 s window can both borrow (the pool size still caps borrowing at one extra pool); after a rollback to 0.12.0 its throughput report rejects events carrying |
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.
What changes
Idle permits are lent. When every CPU permit is held, a
sharedorheavyrun that has waited 20 seconds may borrow permits from a second pool of the same size. host-run measures the host every 15 seconds and lends only while the cores the run would use, plus 20% of all cores, were idle, and at least 25% of memory is free. A loan admitted in the last 90 seconds counts at its full share until a measurement includes it. Long, mostly idle holders (soaks, emulators, dev loops) no longer keep every other run queued while most cores sit idle.exclusiverun never borrows. A run that takes every CPU permit also takes every borrowed permit before it starts, so it still runs alone.--statusshowsborrowed=Nand marks borrowing holderspool=overflow; telemetry recordspool: "overflow".LOCAL_EFFICIENCY_LENDING=offturns lending off for a run.Long runs stay on this Mac. A forwarded run holds the remote's CI machine lock for its whole run. A heavy run whose
--max-holdis over an hour (ornone) now runs here with one line saying why, and--remoterefuses it with exit 69. Before this, a forwarded soak could hold the lock for hours, and CI steps that need that Mac to themselves timed out waiting for it.One test fix. The background-priority test compared against normal priority, so the check failed whenever the whole suite ran at background priority, as it does under host-run while the owner is typing. It now compares against the priority the suite inherits.
Checks
bun test lending.test.ts(14 tests: the lending decision and its thresholds, the status and telemetry fields, and end-to-end runs that borrow, wait, fall back and drain)bun test compute-forward.test.ts(the hold limit,--remoterefused before any ssh, a 9 h run kept here)bun run checkunderhost-run --mode=heavy --local: 302 pass, 0 fail🤖 Generated with Claude Code