Skip to content

Site image catalog: pick an ssh island's or pool's image from verified records - #889

Merged
michaellchung merged 4 commits into
mainfrom
own/image-adopt
Nov 26, 2026
Merged

michaellchung merged 4 commits into
mainfrom
own/image-adopt

Conversation

@michaellchung

@michaellchung michaellchung commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

What

own-cluster-fleet-stability tasks 7.1 and 7.4: the site image catalog and the image selection order.

  • yeto/launch/site_images.py: the catalog (~/.yeto/site-images.yaml, YETO_SITE_IMAGES_PATH overrides the default, or the inventory's top-level site_images:; a relative path is taken from the inventory's directory). A record holds model, role, engine, ref (docker reference grammar, pinned by digest), device family, CPU and card architectures (known values only), versions, evidence (evidence.at an ISO-8601 time with a zone, read as UTC) and status (verified-smoke / retired). A bad record is refused with [yeto] site image catalog: <file>: images[i]: ...; an unknown key or a newer catalog version is a warning and the catalog is read as far as it goes.
  • Writes: add reads and writes under an flock on a lock file next to the catalog, fsyncs the temporary file before os.replace and the directory after, keeps the file mode (a new catalog is 0644) and never overwrites a broken catalog. A record replaces only the one of the same model, role, engine, ref, CPU and card architectures: one image adopted on two kinds of cards keeps two records.
  • match(model, role, profile) resolves the model alias (yeto.models.resolve) and returns the verified records that fit every node (none for no node), newest evidence.at (by time) first, then the later record. select(explicit, model, role, profile) -> (ref, source): explicit, then site catalog, then built-in default; a fallback names the closest records and why each does not fit (SiteImage.problems).
  • Selection is wired into the two own-cluster routes only:
    • ssh: trainer island: only when every --gpu entry is ssh:, --rl-image is omitted and the inventory names no trainer image. A mixed fleet (ssh and cloud islands) takes the built-in default and prints one line saying why. The trainer nodes matched are the inventory nodes with no roles or with a role that is trainer or starts with trainer-, so a trainer spare (trainer-spare) must fit the image too. main has no trainer-spare role yet: the own-cluster spare PR (ssh islands: replace a lost node of a resident trainer island with a spare (own-cluster 4.1-4.4) #885) hooks its role in when it rebases onto this one; the prefix match already covers it.
    • ssh sampler pool: container.image: auto nodes without an inventory image. The catalog is matched once against all those nodes of the pool (a spare starts the same image); the pool fixes the choice at its first start, keeps it in its state file next to the pool record (a restarted controller starts the same image) and never re-reads the catalog mid-run; pool --dry-run prints the same choice.
    • The first choice is made under a lock with a double check, so parallel node starts choose once and all start the same image. The kept file is written to a tempfile.mkstemp file in the same directory and moved with os.replace. The kept file's key is the model, the engine and the catalog: a kept choice of another model is not reused, and a kept choice never replaces an image the inventory names.
  • A configuration that names its image (--rl-image, inventory image/images, container.image) never reads the catalog and prints nothing new. The inventory key is validated in node_inventory.site_images_value, which site_images reuses (no import cycle).
  • tests/yeto_home_guard.py: YETO_SITE_IMAGES_PATH joins STATE_ENV, so the test session never touches a real catalog.

Tests

  • tests/test_site_images.py (68 tests): schema refusals per key (ref grammar, card architectures, evidence time zone), unknown-key and newer-version warnings, broken catalog prefix, flock across 8 spawned processes and a blocked writer, fsync calls, file mode, two records for two kinds of cards, match priority by UTC time (offsets, sub-second), alias resolution, no-node match, fallback reasons, trainer wiring (site record, default with reason, mixed fleet, explicit / other cloud / no inventory unchanged with a broken catalog present), pool wiring (site record, engine catalog fallback, pool-wide match, choice fixed once and kept across a restart, named images unchanged, broken catalog reported). Added this round: parallel starts choose the pool images once (6 threads at a barrier: one choice, every start gets it); a kept image never replaces a named one and is not reused for another model; a record of another device family does not fit; the trainer match takes trainer spares; the kept file goes through a temporary file of its own (a directory at a fixed temporary name does not break it).
  • Related suites on this head (71 files: ssh, inventory, node profile, engine images, rl_backend, preflight, image, run flags, layout, home guard, node leases, and every test file importing the inventory, the cluster preflight or the manifest check): 1479 passed, 6 skipped, 3 xfailed.
  • Full suite on the stack head (image adopt: trainer and sampler smoke, the yeto image adopt command and its docs #894): see that PR.
  • Mutation check: 29 mutations of the new and changed lines in round 1: 28 killed; 1 equivalent (the dry-run computing each node's choice alone gives the same pool-wide match). Round 2: 7 mutations, all killed (no double check, no lock, a kept file overriding a named image, a kept key without the model, device family unchecked, trainer role without the prefix match, a fixed temp file name).

Customer gate

  • 52 customer goldens (tests/test_k31_customer_plan_golden.py, tests/golden/breakers): 52 passed.
  • examples/k31 dry-runs (run up --dry-run of both customer run configs with their preflight logs, NC pool --dry-run), normalized, are line-for-line identical to main 61af344. No golden or example file changed.

Rebased onto main 61af344 (#882, #883, #884, #887, #896): the inventory knows images, lease_store, node_health, nodes and site_images (the unknown-key message of #884's test now lists site_images too), and the pool keeps #883's health wiring and #884's lease_store next to site_images.

Not merged; part 1 of 3 (7.2 and 7.3 + 7.5 follow, stacked on this branch).

🤖 Generated with Claude Code

michaellchung and others added 4 commits November 26, 2026 20:02
A site that adopts an image for a model records it in a site image
catalog (~/.yeto/site-images.yaml, or the inventory's top-level
site_images:). Each record names the model, role, engine, digest, CPU
and card architectures, versions, smoke evidence and its status.

An ssh: trainer island whose --rl-image and inventory name no image, and
an ssh sampler pool node on container.image auto without an inventory
image, now take the newest verified-smoke record that fits every node,
before the built-in default; the launcher and the pool dry-run print the
image and where it came from. A configuration that names its image never
reads the catalog, so explicit images (every customer config) are
unchanged. A broken catalog is refused when it is read.

own-cluster-fleet-stability 7.1, 7.4.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two image adopt runs writing one catalog could each read the old file and
the later rename would drop the other's record. add() now reads and writes
under an flock on a lock file next to the catalog, and save() fsyncs the
temporary file and the directory around the rename.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- read the catalog for a trainer only when every --gpu entry is ssh:; a
  mixed fleet takes the built-in default and prints why
- a record is one image on one hardware: same_image keys on the CPU and
  card architectures too
- evidence.at must be an ISO-8601 time with a zone; it is read as UTC and
  records order by the time; a bad one names the catalog and the entry
- an ssh sampler pool chooses its images once for all its nodes (a spare
  starts the same image), keeps them in its state, and the dry-run prints
  the same choice
- YETO_SITE_IMAGES_PATH moves the default catalog; the test home guard
  points it into the session tree
- card_archs are checked against the known architectures; a fallback
  names the closest records and why they do not fit
- ref follows the docker reference grammar; no node matches nothing;
  the catalog keeps its file mode (a new one is 0644); the model alias is
  resolved before matching; errors start with "[yeto] site image catalog:"
- unknown keys and a newer catalog version are warnings, read as far as
  they go; the inventory key is checked by node_inventory and reused

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…; spares in the trainer match

- SshSamplerPoolOps.image_for chooses the pool's images under a lock
  (double-checked): parallel starts of an IslandPool take one choice, and
  the kept file names the image the nodes run; it is written through a
  temporary file of its own (mkstemp in the same directory) and os.replace
- the ssh: trainer island's catalog match covers the trainer nodes and
  every node of a trainer-* role (a trainer-spare starts the island's image)
- tests for the kept file never replacing a named image or another model's
  choice, and for a record of another device family

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant