Repository navigation
ssh islands: replace a lost node of a resident trainer island with a spare (own-cluster 4.1-4.4) - #885
Merged
Conversation
michaellchung
force-pushed
the
own/island-spares
branch
2 times, most recently
from
November 26, 2026 11:59
32a9338 to
f77a5a6
Compare
michaellchung
force-pushed
the
own/island-spares
branch
2 times, most recently
from
November 26, 2026 15:32
b7b2593 to
e11a24e
Compare
This was referenced Nov 26, 2026
michaellchung
force-pushed
the
own/island-spares
branch
2 times, most recently
from
November 26, 2026 18:12
38dae0f to
d2f566c
Compare
…iner island A resident ssh trainer island whose inventory lists trainer-spare nodes replaces a lost node (stream ended plus failed ssh checks, or node health bad twice in a row) with a healthy spare of the same fabric group, in the same layout, and resumes from its learner's newest checkpoint. The lost node is quarantined in the run store and, with a lease_store, for every run; its lease is kept until yeto cluster release-node. Without a spare the island waits with a backoff; fleet.waiting_absent_after_s and --spare-max-wait-s bound the wait; at most 3 replacements per 24 h. - pick_placement with required=<nodes that stay> and excluded reasons - the island's own NodeLeases; release-node probes a live lease before force=True; the trainer pick leaves quarantined nodes out and says why - yeto cluster release-node; docs/OWN_CLUSTERS.md Spare nodes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…luster release-node - the spare pick calls fabric_groups.pick_placement (#892) directly with required=<nodes that stay> and excluded={name: reason}: quarantined, held by another island, leased by another run, unhealthy, checked before; the local placement stub is gone - a PlacementError becomes the island's wait reason; any other error, TypeError included, is raised - yeto cluster release-node is a subcommand of yeto cluster; the hint no longer says it is unavailable Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…uarantines) - a confirmed stop is kept per (node, incarnation) and dropped when the node is picked again; a later loss owes its stop again - after a replacement the run's lease record names the current nodes; the recorded lookup knows trainer-spare nodes; a reattach holds the current nodes' leases and gives back a stale old node's lease - release-node away from the run's ledger says where the owed row is; the launcher closes owed rows of a node it picks again (released elsewhere) - an unreadable shared quarantine counts as one in both picks; a listing failure reads each record; a store error loses no running node - down() skips lost nodes; health readings are stamped with the rank's node and replacement count; the spare check reads the job's ports - no checker: spares do not apply (WARN); the wait reason names another run's quarantine; release-node --dry-run lists the lease and records; a broken record needs --force; backoff checks retry owed stops Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
michaellchung
force-pushed
the
own/island-spares
branch
from
November 26, 2026 18:32
d2f566c to
4618b55
Compare
…osed after their stop - A confirmed owed stop never rewrites the quarantine record: it is kept as a marker of its own (fleet/nodes/<n>/settled/, exclusive create), and release-node first writes a timestamped released.json tombstone in both stores, so a settle racing a release writes nothing back. Owed stops re-read the record before each kill; the ledger row closes in a finally even when the marker cannot be written. - A confirmed owed stop removes the incarnation's pid file and leaves a stopped marker; kill_script exits 0 on that marker, so a later stop never signals a reused pid and never fails on the missing pid file. - The run's lease record is written before the start on a spare and put back if that start fails; the trainer lease pick follows the island's spares journal; every start (launch, start without a quarantined node, reattach) gives back stale leases, except another island's pick or claim. - A node picked again without a quarantine record runs the stops of its open owed rows first and closes only the rows whose stop succeeded. - down() and close() join the owed-stop retries briefly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
michaellchung
force-pushed
the
own/island-spares
branch
from
November 26, 2026 19:12
4618b55 to
8eefd6f
Compare
michaellchung
added a commit
that referenced
this pull request
Nov 26, 2026
…are and is replaced Over #885's spare nodes: the poll that finds the loss clears the report (recovering), the island is not counted while it waits for a spare, and on the spare it is a new launch with its catch-up grace; past its recover timeout it is reported N cycles later. The dashboard keeps the card's mark and state with the spare events in between. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
michaellchung
added a commit
that referenced
this pull request
Nov 26, 2026
…are and is replaced Over #885's spare nodes: the poll that finds the loss clears the report (recovering), the island is not counted while it waits for a spare, and on the spare it is a new launch with its catch-up grace; past its recover timeout it is reported N cycles later. The dashboard keeps the card's mark and state with the spare events in between. Co-Authored-By: Claude Opus 5.5 <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.
Summary
A resident
ssh:trainer island replaces a lost node with a spare node of its inventory (own-cluster-fleet-stability tasks 4.1-4.4).Rebased onto main with #882/#883/#884/#889/#892/#896/#897/#898 in: it uses the real
node_health.checker_for(aNullCheckerfamily gets no spare),HealthWatch/hcas_of, the_node_health_losthook of the resident health tick, and the realNodeLeases(acquire,held,keep_all(nodes=),force_release(holder=, force=),ssh_probe,pick_nodes(excluded=)). A spare is picked only after a node health check has run and passed; when an inventory declarestrainer-sparenodes but its device family has no checker, the spares do not apply at all:spares_from_argsreturns None and a WARN (also in the dry run) says the island is relaunched on its own nodes, as on main.Placement uses the real
fabric_groups.pick_placement(candidates, need, *, excluded=, required=, inventory=)(#892). ItsPlacementErrorbecomes the island's wait reason (...; placement: <its text>); any other error, aTypeErrorincluded, is raised.yeto cluster release-nodeis a subcommand ofyeto cluster(yeto/cluster_release_node.py, hooked intoyeto/cluster_cli.py).roles: [trainer-spare]is a spare.island_nodes(..., "trainer")does not match it, so the island's node count check, its dry run and every customer path are unchanged. An inventory without spares (the 6 x 8 B300 K3.1 layout takes every node) loses a node exactly as on main.unreachable_pollsSSH checks in a row, or (b) its health turned bad twice in a row (SshIslandOps._node_health_lost(rec, rank, reasons, reading); a reading that names another node than the rank's current one is ignored). A node whose stop is not confirmed when the island fails keeps its stream. The usual power-loss order is that rank 0 exits first and the dead node's stream ends minutes later. Such a node is checked withssh trueat each relaunch poll. It is lost afterunreachable_pollschecks in a row without an answer once its stream has ended, or after 2 xunreachable_pollswhile its stream is still open. The higher bar keeps a node whose sshd refuses new sessions while the old connection lives from being quarantined. An SSH hiccup with the stream still flowing, followed by an answer, is no loss.island_node_lostis written, and the island is stopped on its other nodes; the lost node is not waited for. The node is quarantined:fleet/nodes/<name>/quarantine.jsonin the run store records the stop it still owes. With alease_store, the record is also written tonodes/<name>/quarantine.jsonthere, next to the lease and event objects, so every run's pick skips the node. A lost node that still answers is stopped in the background, outside the ops lock; once that stop is confirmed it owes nothing. Ledger: the incarnation's row closes, and a node that still owes its stop gets its own row (its rank and price only) soyeto cleanupstill stops it.pick_placement(survivors + spares, len(survivors) + 1, excluded={name: reason}, required=survivors, inventory=pool). The nodes that stay arerequired: they never move, and a placement that drops one is no placement; the reserved groupunavailablenever joins a multi-node island.excludednames every node that is out with its reason: quarantined (the lost node too), held by another island, leased by another run, unhealthy (the health check's text), checked before. Nodes that are quarantined, held by another island of the run, or leased by another run are filtered out first. The health checks run before the pick, outside the ops lock. A check must have run and passed; an SSH answer alone is not enough, and a family without a checker gets no spare. The pick then claims the node (an exclusive create offleet/nodes/<name>/claim.json) and takes its lease, reading the records again. A node whose claim or lease fails is excluded and the pick runs again. A store without an atomic create (for example the OSS relay) is refused for claims.island-cuts/island<learner id>/LATEST(the learner id fromsample_roles.island_learner, e.g.--rl-fleet-learner-idof a per-island launch, not the island index), or its release intrainer<k>/policy-releases/when its samplers follow it.island_node_replacednames the old node, the new one and the resume step. A journal next to the jobs journal keeps each incarnation's nodes, so a restarted launcher reattaches on the spare.waiting_spare, checked again after 60 s, doubling up to 900 s, with an hourlyisland_waiting_sparethat carrieselapsed_s. The fleet controller does not give it up on--recover-timeout, and says its retry line every 15 min instead of every poll. A waiting island still counts towardfleet.min_islandsforfleet.waiting_absent_after_s(run config, default 3600 s) after its wait began, then as absent; the island record carriesspares.waiting_since. This decides whether the fleet goes on.--spare-max-wait-sdecides when the island itself is given up. Past--spare-max-wait-s(default 24 h, a fixed roster too; the wait's start is kept in the journal) the relaunch is refused and the island is given up. At 3 replacements within 24 h the next loss also refuses the relaunch, andisland_replacement_limitlists every replaced node. A launcher restarted while its island waits now starts: the quarantined node is lost again, and the waiting goes on.spec.leases(fromtrainer_leases) is the spares'NodeLeases, and its store holds the shared quarantine. A start takes the leases of the island's current nodes (a restarted launcher on a spare; another run's lease refuses the start) and keeps the leases of this run's quarantined nodes out of the renewals (keep_all(nodes=...)). A lost node's lease is kept at once, and its quarantine records the lease holder.lease_trainer_nodespassesshared_quarantined_names(leases.objects)inpick_nodes(excluded=...), so no run picks a node quarantined in the lease store (a leaf modulenode_quarantinekeeps the launch imports acyclic). The pick names each such node with the run and island that quarantined it, the reason and how to release it: once before the pick, on every waiting line and in the final error, not just "no free node". The health watches are rebuilt for the new node set after a replacement.island_spares.release_node_mainis the body ofyeto cluster release-node <name> --inventory --store [--dry-run] [--force] [--kill-grace-s]. It requires a health check that ran and passed;--forceskips the check and prints a WARN. It runs the owed stops and closes their ledger rows. Then the lease of the recorded holder:force_release(node, holder=...)ends a kept or run-out lease; a live one ends only afterssh_probefound nothing of that run on the node, thenforce_release(..., force=True); a lease another run holds is not touched. Any failure keeps the quarantine (exit 1, no traceback); only then is the record removed. Nothing lifts a quarantine on its own.docs/OWN_CLUSTERS.mdgets a "Spare nodes" section (declaring spares, when a node is lost, the pick, waiting and the two times, the limit, release-node, known limits), and the Node leases section points to it.Review fixes (REV-885c)
trainer-sparenodes; a reattach holds the current nodes' leases (_hold_leases) and gives back a lease of a node the record still named but the island no longer runs on (unless quarantined or another island's).release-nodeon a machine without the run's ledger says where the owed row is; the launcher closes its own owed rows of a node it picks again with no quarantine record (reason: released elsewhere), so the node is billed once.quarantine record unreadable: ...); a listing failure reads each node's record instead; a running island's node is not taken as lost on a store read error.down()does not wait for a lost node.nodefield (the realnode_health.Readinghas none): the resident tick stamps a lost reading with the rank's node and its replacement count, and the hook ignores a stamp that no longer matches (kept when ignored, so asking again is ignored too).node.envwith the jobenvover it), as the island's own watch does.release-node --dry-runlists the records it would remove (run store and lease store) and what it would do with the lease; an unreadable quarantine record needs--force(the owed stops cannot be known).Review fixes (REV-885d)
fleet/nodes/<name>/settled/<run>-<island>-i<k>.json, exclusive create) and the owed list leaves those out.release-nodefirst writes a timestampedreleased.jsontombstone in both stores, then removes the markers and the records; a settle that finds a tombstone newer than the record writes nothing. A settle racing a release therefore never brings the quarantine back, in the run store or the lease store.finallyeven when the marker cannot be written.stoppedmarker in its state dir;kill_scriptexits 0 on that marker, so a later stop (release-node,yeto cleanup) neither signals a reused pid nor fails on the missing pid file. The process group is not checked against the run beyond the pid file in the run's own state dir (docstring).lease_trainer_nodestakes the island's nodes from its spares journal (newest incarnation) before the lease record, so a launcher that went mid-replacement restarts on the spare. Every start path (launch, start without a quarantined node, reattach) gives back leases of old nodes the island no longer runs on, except another island's pick or claim;assignedkeeps another island's nodes.--forceover a broken record, a run store kept in memory) runs the stops of its open owed rows first; only rows whose stop succeeded close (released elsewhere).down()andclose()join the owed-stop retries with a short timeout and drop finished ones.Notes
lease_store, a trainer node another run quarantined is left out of the trainer pick; when the inventory has no other free trainer node the new run waits--rl-node-lease-wait-sand fails with the note above; it does not start on a spare in its place.Tests
tests/test_ssh_island_spares.py(36): loss rules, replacement in the same layout (rank 1 and rank 0), restart following the journal, the pick rules (fabric group,unavailable, quarantine, claims and a claim lost to another island, leases, health, by name), the pick through the realpick_placement(the nodes that stay passed asrequired, need = island size, the lost node inexcludedas quarantined, a spare whose health check fails added toexcludedwith the check's text and asked again, the nodes that stay unchanged after the replacement), the nodes that stay kept when another group has more free nodes, aPlacementErroras the wait reason, aTypeError(one string asexcluded, or raised insidepick_placement) raised, an excluded required node and a placement that drops a required node refused, backoff, replacement limit, the fleet controller waiting past its recover timeout, an island given up while another runs on, no spares as on main, dry run, release-node, therelease-nodesubcommand's flags and exit codes, and the documentedyeto cluster release-node ... --dry-runthroughcluster_cli.tests/test_ssh_island_spares_recovery.py(83): as before (power-loss order, the 2x rule for open streams, sshd refusing new sessions, max wait and hourly report,fleet.waiting_absent_after_s3599/3601 s and single-island/fleet cases, owed stops and ledger rows, per-learner resume keys, the no-checker note, the shared quarantine, a restart while waiting, a stale health reading, no SSH under the ops lock, non-atomic stores), plus: release-node probes a live lease beforeforce=Trueand refuses a node that still runs the run; a kept lease of another run is not ended; the lease ended is the record'slease_holderwhen the command runs under its own holder; the quarantine names the lease holder and a restarted launcher keeps the quarantined lease out of the renewals; the trainer pick leaves out a node quarantined in the lease store (realNodeLeaseson a fake S3 store,node_leasekeys not mistaken for a quarantine) and names the quarantining run and island, the reason and release-node before the pick, on the waiting line and in the error; the island's ownspec.leaseshold the spares and the shared quarantine; a start on a node another run holds is refused; the health watches rebuilt on the new node set; and for the review fixes: a node picked again then power-lost, or health-lost with a failed stop, owes its stop again; a confirmed stop with a failed record update owes no row; with realNodeLeases, a restarted launcher renews its spare's lease, does not hold a released old node (stale record), and reattaches when another run took the old node; release-node away from the run's ledger says where the row is and the launcher closes it once; unreadable shared quarantines (store error, broken JSON, failed listing) keep nodes out of both picks, and a store error does not lose a running node;down()with a lost node; stale health readings with the realReading(a replaced rank, the same node back after two replacements, asked twice); the spare check's job ports; the dry run's lease and record plan; a broken record needing--force; an owed stop retried after a partition heals. For REV-885d: a settle racing release-node (between its read and its write, with another run leasing the node meanwhile) writes nothing back in either store and leaves no marker; an owed-stop retry racing release-node leaves the node released; a settle after a newer tombstone writes nothing; a settle clears only that node's stop of that incarnation, and a release leaves only the tombstone; an owed stop reads the record again and skips a node released meanwhile, and never runs another island's stop; the row closes even when the settle fails; a confirmed stop already settled is not owed again after a restart; a stopped node owes no row at a later release; the owed stop run by bash removes the pid file and leaves the marker, a second try and the plain kill script exit 0, a failed stop keeps the pid file (the stopped group is not a child of the test, so a zombie does not keep it alive on Linux); a launcher gone mid-replacement restarts on the spare and neither holds the released old node nor is refused by another run's lease on it; a failed start on a spare puts the lease record back; a start gives back a stale lease, but not another island's pick or claim, andassignedkeeps that island's node; a reattach takes the spare's lease when its pick did not; retries run only while waiting and only the island's own owed stops;--forceover a broken record, a failed stop and a run store kept in memory each stop the old incarnation before the row closes (a failed stop keeps it open);down()andclose()join the retries.tests/test_ssh_island_spares_e2e.py(real Rust syncer, local store, fleet controller over the fake SSH cluster, fake trainers): island 1 loses its rank 0 node while holding a PULL, the spare takes its place, and the island re-JOINs under its learner id, resuming from its owntrainer1/policy-releases/LATEST.json. Asserted: merge sequence 1..N with every step once; no fragment pushed twice; resume step equal to the newest checkpoint step; catch-up and final weights equal to the f32 Nesterov recomputation within 1e-6; island 0 on one connection with a push in every merged round. Its syncer binds port 0 and the test reads the bound port from its own log. 1 passed (7 of 7 runs).tests/test_trainer_provision.py: the stub ofstart_resident_sshtakes the new keywords and asserts them.stoppedand its reset on a pick, the lease record and the reattach's leases, the recorded spare lookup, the released-elsewhere close and the row note, unreadable quarantines in both picks and the running-node guard,down()skipping lost nodes, the stamp and the rank generation, the job ports, the other run's quarantine in the wait reason, the dry run's lease plan, the broken record's--force, the owed-stop retry; 27 for REV-885d: the settle rewriting the record, no tombstone check, no tombstone, markers kept on release, markers ignored, no re-read before the kill, the re-read ignoring the island, the row closed only when the settle succeeds, no join indown()orclose(), no pid file removal,kill_scriptignoring the marker, a close without the stop, a failed stop closing, the journal not used, the record written after the launch, no rollback, no stale release at a start, the claim-holder and other-island guards, retries not only while waiting, retries not filtered by island, the old node kept inassigned, another island's node dropped fromassigned,_owesalways true, a settle clearing every row; plus the earlier mutants re-anchored).--timeout=600): 18355 passed, 377 skipped, 11 xfailed, 0 failed. On an earlier base, one shard run hittest_node_lease.py::test_podman_needs_the_users_view_and_with_sudo_the_rootful_one, which saw a local process of another job (passes alone on main and on this branch; tracked separately).Customer gate
🤖 Generated with Claude Code