Repository navigation
Keep a notice observed while deferring a fleet takeover #1181
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
100175f
e8b042e
1b13ccf
34e02ac
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -980,8 +980,9 @@ class Outcome: | |
| worker took over the job's claim or a slot, and ``deferred`` when Athena | ||
| throttled the quiescing of an earlier attempt, so the job was released | ||
| without running. ``errors`` lists queries that could not be confirmed as | ||
| stopped. ``noticed`` tells whether an interruption notice was observed | ||
| after the run, while its queries were quiesced. | ||
| stopped. ``noticed`` tells whether the watch observed an interruption | ||
| notice after the attempt checked for one, for example while queries were | ||
| quiesced. | ||
| """ | ||
|
|
||
| state: str | ||
|
|
@@ -1103,10 +1104,12 @@ def settle_error(path: Path, exc: Exception) -> str: | |
| break | ||
| upload_attempt() | ||
|
|
||
| # Each outcome reads the watch's notice last: after a lost claim, the watch | ||
| # is joined for only 10 seconds, and a notice check may still finish. | ||
| if deferred: | ||
| # Nothing ran, so the next attempt resumes from the same earlier attempts. | ||
| queue.end_lease(claim, "released") | ||
| return Outcome("deferred") | ||
| return Outcome("deferred", noticed=watch.interrupted.is_set()) | ||
|
|
||
| def abandon() -> Outcome: | ||
| # A claim lost only by its local expiry, for example while a renewal that | ||
|
|
@@ -1213,7 +1216,8 @@ def work( | |
| records are uploaded and its claim is released as interrupted, or | ||
| once the attempt of a failed job ends, if the notice arrived while | ||
| its queries were quiesced or is found after they could not be | ||
| confirmed as stopped. | ||
| confirmed as stopped, or once a deferred takeover released its | ||
| claim. | ||
| RuntimeError: If an attempt stopped by a lost claim could not be quiesced; | ||
| the worker's host is then kept. | ||
| """ | ||
|
|
@@ -1287,7 +1291,7 @@ def settle(output: Path) -> list[str]: | |
| _logger.warning( | ||
| f"Deferred {job['id']}: Athena throttled quiescing its earlier attempts" | ||
| ) | ||
| if check_notice(notice): | ||
| if outcome.noticed or check_notice(notice): | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Self-review round two (claims, callers, operators). Base d47bd22, head 1b13ccf. CLEAN for this scope. Claims checked:
Callers and operators: Validation at 1b13ccf (local): |
||
| raise SpotInterruptionError(completed) | ||
| # A later pass, or another worker, retries the job; try the next one. | ||
| continue | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Independent review (relayed): Codex CLI 0.162.1, model gpt-6-astra,
codex exec -s read-only, session 01a13b00-f337-7962-a3e8-4929041c85d0. Static review of d47bd22..1b13ccf on an unchanged detached snapshot; no PR number, description, commit messages or prior findings were given. Result: FINDINGS (1).P2, introduced: "notice snapshot can become stale. When the renewal thread detects claim loss,
JobWatch.__exit__joins each thread for only 10 seconds. An in-flight notice callback can therefore remain running whennoticed=Falseis captured. If it subsequently reports an interruption whileabandon()performs its S3 lease release, the returnedlostoutcome still carriesFalse. ... Preserve the event reads at each outcome return, after lease release."Verified: the single read added in e8b042e (a
/simplifysuggestion) happens beforeabandon()releases the lease. The default notice check needs at most two 2 s metadata requests, which makes the window narrow, but a customnoticehas no such bound. Repaired in 34e02ac: each outcome readswatch.interruptedat its return again, after releasing the lease, as at 100175f, with a comment stating why. The reviewer also said the new test "deterministically holds notice completion until after the attempt's interruption check" and exercises the deferred regression; it does not cover the bounded-join case.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Independent follow-up (relayed): Codex gpt-6-astra,
codex exec -s read-only, session 01a13b05-afc5-79f1-bc02-5363eddb17cd. Static review of the repair 1b13ccf..34e02ac on an unchanged detached snapshot. Result: CLEAN. "The reported read-before-release race is fixed. ...abandon()now readswatch.interruptedafterend_lease()... Since the event is never cleared, these later reads preserve previously observed notices. Existingwork()error precedence remains unchanged." Limit stated by the reviewer: the tests do not deterministically exercise the timed-join and lease-release interleaving.Validation at 34e02ac (local):
just benchmark test248 passed, 1 skipped.