-
Notifications
You must be signed in to change notification settings - Fork 37
fix: hold the session to its wall-clock budget #1171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 64 commits
Commits
Show all changes
65 commits
Select commit
Hold shift + click to select a range
ae9636d
fix(loop): refuse an action the session budget cannot fit
zoroyihan7 5d7ac11
fix(executors): stop one sentinel returncode from naming two causes
zoroyihan7 63ff1ab
fix(executors): hold every unit of work to the session clock
zoroyihan7 bf80774
fix(loop): cancel the in-flight actions the session cannot wait for
zoroyihan7 ea95a73
fix(loop): let the wall-clock defences reach an inline action too
zoroyihan7 180ad5c
fix(loop): declare the time-budget helpers in the module interface
zoroyihan7 ec558e4
fix(close): give the sequencer a report task it can still run
zoroyihan7 8291c0c
fix(prelude): stop preparation spending the optimization phases' budget
zoroyihan7 7b4cb28
fix(executors): carry the session clock into the Ray worker
zoroyihan7 4d7ecd8
fix(dispatcher): stop the pump cancelling work it does not own
zoroyihan7 5b784b2
fix(close): wait for a report already running instead of re-running it
zoroyihan7 7051ebf
fix(state): reserve the closing grace window, not a fixed two minutes
zoroyihan7 117d74c
fix(loop): read the action cost the catalogue actually carries
zoroyihan7 402a777
test: stop two doubles asserting the behaviour these fixes removed
zoroyihan7 3989569
fix(loop): stop the work, not just the coroutine awaiting it
zoroyihan7 5122e35
baseline/profile: the session budget reaches the arm that motivated it
zoroyihan7 cd2273f
admission: price an action on this session's baseline, not the catalogue
zoroyihan7 bd841b8
explore: a variant the run reaped is not a variant that failed
zoroyihan7 d0cbf87
baseline: a round the run stopped is not a baseline that failed
zoroyihan7 6cf0967
ray: the cancel reaches the round, not just the coroutine awaiting it
zoroyihan7 a46eeb4
docs(executors): say what crossing the process boundary actually costs
zoroyihan7 0d9a8d7
fix(close): bound the wait on a running step by the work, not the budget
zoroyihan7 2b84b1c
test(budget): record why a warm replay is priced like a baseline round
zoroyihan7 97943df
fix(policy): the model cannot rewrite the budget its closing reserve …
zoroyihan7 9bf3afc
integrate: a cancelled gate takes its patch back out of the tree
zoroyihan7 5748868
framework: the candidate agent has the same blind spot on a cancel
zoroyihan7 933659d
grid/baseline: every round carries the stop that ended it, not just t…
zoroyihan7 168eefc
writeback: a revalidation the run reaped is not an enablement that st…
zoroyihan7 5f9c69d
explore: rolling back a reaped rebench must not delete a prior round'…
zoroyihan7 a2326c4
cancel: derive the three cooperative-stop windows from what stopping …
zoroyihan7 2408383
dispatcher/integrate_patch: split the three functions this branch pus…
zoroyihan7 c744315
cancel: reaping a round's server and dropping its lease are a sequence
zoroyihan7 8ab077f
executors: a cancel at the post-verdict KB write owes the stash back
zoroyihan7 ab0f783
enablement: a revalidation window the run stopped stays usable, and free
zoroyihan7 de7e321
enablement: a build whose launch probe the run stopped is still unprobed
zoroyihan7 4a9b65a
tests: every pass of a round is asserted to carry the session deadline
zoroyihan7 5241794
baseline: the multi-node warmup holds the measured round's budget back
zoroyihan7 4177de8
stop_attribution: say where the returncode side of the distinction lives
zoroyihan7 8111ba6
tests: one multi-node setup for both benching arms' suites
zoroyihan7 073e008
tests: the Ray lease is a launch site of its own
zoroyihan7 9c03b67
baseline: the warmup holds back the measured round's expected runtime…
zoroyihan7 a81d52b
cancel: a cancelled action's unwind does not stop to observe itself
zoroyihan7 4c495f8
baseline: a warmup may claim half of what the round has, and a budget…
zoroyihan7 db8e484
grid_runner: the budget is re-checked after the uncapped server resta…
zoroyihan7 0b62de6
baseline: no pass of a round is shortened to pay for the next one
zoroyihan7 603ebca
machine_state: preparation answers to the session clock, not a ledger…
zoroyihan7 92951f0
baseline: a round the session cannot finish does not boot a server to…
zoroyihan7 85a08cf
baseline: say what the round's price really is, an over-prediction wi…
zoroyihan7 e5edb4e
baseline: name the one thing that keeps a warmup's figure as a marked…
zoroyihan7 7adef31
executors: a round reports what it spent booting apart from what it s…
zoroyihan7 d4f1062
state: a session carries what its baseline cost in two parts, and whe…
zoroyihan7 0e8d572
phases, executors: price work by what it spends, and stop when nothin…
zoroyihan7 60a700c
phases: a session that stopped in CLOSE reopens where a fresh clock c…
zoroyihan7 5b3c723
executors, phases: measure a round's price rather than rebuild it, an…
zoroyihan7 225e307
executors, policy: measure the boot on one clock, and let a cold anch…
zoroyihan7 8c26553
Require the boot duration when stamping server-ready
zoroyihan7 66a00ae
Record the multi-node successor as a known gap in the PRELUDE gate
zoroyihan7 0670593
Stop the usable-budget lock test from racing the clock
zoroyihan7 c86cd69
Stop recover from running after the session budget is spent.
zoroyihan7 07e23b9
Ignore the EXPLORE hours leave-behind when it covers the whole session.
zoroyihan7 b2a43f0
Cancel a tick step that outlives the session bound so the run can sti…
zoroyihan7 c218d3f
Drop the unused await path that CodeQL flagged, and stop requiring a …
zoroyihan7 6f23e0a
Fix a rebase merge that concatenated two BaselineExecutor methods.
zoroyihan7 57c7b66
Close SWEEP honestly when conc_sweep cannot fit the session budget.
zoroyihan7 f2c241c
Remove the leftover rebase duplicate of enable_multi_node and an unus…
zoroyihan7 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,124 @@ | ||
| """Throwaway self-review: sweep the real pricing functions for disagreements.""" | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| from types import SimpleNamespace | ||
|
|
||
| from hyperloom.orchestrator.phases import machine_state as ms | ||
|
|
||
| BOOT, COLD_BENCH, HOT = 350.0, 550.0, 400.0 | ||
| COLD_ROUND = BOOT + COLD_BENCH | ||
|
|
||
|
|
||
| def state(usable, *, phase="PRELUDE", warm=HOT, post_ready=COLD_BENCH, marked=False, double=True): | ||
| return SimpleNamespace( | ||
| phase=phase, | ||
| max_minutes=180, | ||
| baseline_tput=1000.0, | ||
| baseline_runtime_sec=COLD_ROUND, | ||
| baseline_post_ready_runtime_sec=post_ready, | ||
| baseline_warm_runtime_sec=warm, | ||
| baseline_measure_round_dropped=marked, | ||
| baseline_double_run=double, | ||
| session_budget_usable_sec=lambda: usable, | ||
| ) | ||
|
|
||
|
|
||
| def gate1_need(s): | ||
| """What the pre-ignition gate demands, mirroring _round_affordable.""" | ||
| cold = ms.measured_seconds(s, "baseline_runtime_sec") | ||
| rnd = ms.baseline_round_cost_sec(s, double_run=bool(s.baseline_double_run)) | ||
| if cold is None or rnd is None: | ||
| return None | ||
| use = (ms.one_more_measurement_sec(s) or cold) if s.phase == "PRELUDE" else 0.0 | ||
| return rnd + use | ||
|
|
||
|
|
||
| def gate2_need(s, *, warmup_sec, warmup_post_ready): | ||
| """What the post-warmup gate demands, mirroring _measure_round_affordable.""" | ||
| bench = ms.measured_seconds(s, "baseline_warm_runtime_sec") | ||
| if bench is None: | ||
| bench = warmup_post_ready | ||
| if bench is None or warmup_sec is None: | ||
| return None | ||
| use = (ms.one_more_measurement_sec(s) or warmup_sec) if s.phase == "PRELUDE" else 0.0 | ||
| return bench + use | ||
|
|
||
|
|
||
| def main() -> int: | ||
| bad = 0 | ||
|
|
||
| # 1. The band: is there a budget gate 1 admits and gate 2 then certainly refuses? | ||
| # Gate 2 is asked after the warmup has spent a cold pass. | ||
| band = [] | ||
| for usable in range(0, 6001, 10): | ||
| s = state(float(usable)) | ||
| need1 = gate1_need(s) | ||
| admitted = need1 is not None and usable >= need1 | ||
| if not admitted: | ||
| continue | ||
| after = state(float(usable) - COLD_ROUND) | ||
| need2 = gate2_need(after, warmup_sec=COLD_ROUND, warmup_post_ready=COLD_BENCH) | ||
| if need2 is not None and (usable - COLD_ROUND) < need2: | ||
| band.append(usable) | ||
| if band: | ||
| bad += 1 | ||
| print(f"BAND gate 1 admits and gate 2 refuses for usable in {band[0]}..{band[-1]}") | ||
| else: | ||
| print("ok no budget is admitted before ignition only to be refused after the cold pass") | ||
|
|
||
| # 2. Livelock: with the mark set, does every budget either close or admit a retry? | ||
| stuck = [] | ||
| for usable in range(0, 8001, 10): | ||
| s = state(float(usable), marked=True) | ||
| closes = ms.exit_cold_anchor_prelude(s) is not None | ||
| need1 = gate1_need(s) | ||
| admits = need1 is not None and usable >= need1 | ||
| if not closes and not admits: | ||
| stuck.append(usable) | ||
| if stuck: | ||
| bad += 1 | ||
| print(f"LIVELOCK neither closes nor admits for usable in {stuck[0]}..{stuck[-1]}") | ||
| else: | ||
| print("ok a marked session always either closes or may retry") | ||
|
|
||
| # 3. A session with no split measured (multi-node / scriptable shape). | ||
| s = state(3000.0, warm=0.0, post_ready=0.0) | ||
| need = gate1_need(s) | ||
| if need is None: | ||
| bad += 1 | ||
| print("UNGATED a round with no boot boundary is waved through") | ||
| else: | ||
| print(f"ok a round with no split is priced at {need:.0f}s (whole cold rounds)") | ||
|
|
||
| # 4. A first baseline must never be judged. | ||
| first = SimpleNamespace( | ||
| phase="PRELUDE", | ||
| max_minutes=180, | ||
| baseline_tput=0.0, | ||
| baseline_runtime_sec=0.0, | ||
| baseline_post_ready_runtime_sec=0.0, | ||
| baseline_warm_runtime_sec=0.0, | ||
| baseline_measure_round_dropped=False, | ||
| baseline_double_run=True, | ||
| session_budget_usable_sec=lambda: 60.0, | ||
| ) | ||
| if gate1_need(first) is not None: | ||
| bad += 1 | ||
| print("PREDICTED a first baseline was priced from measurements it cannot have") | ||
| else: | ||
| print("ok a first baseline is not judged") | ||
|
|
||
| # 5. Later phases ask only whether the round fits. | ||
| later = state(2000.0, phase="EXPLORE") | ||
| if gate1_need(later) != ms.baseline_round_cost_sec(later, double_run=True): | ||
| bad += 1 | ||
| print("SCOPED a re-baseline outside PRELUDE was charged for a successor") | ||
| else: | ||
| print("ok a re-baseline outside PRELUDE pays only for itself") | ||
|
|
||
| return bad | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| raise SystemExit(main()) |
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.