Files
alzeo/tests/text_lane_fixture.py
T
Hasan BasbunarandClaude Opus 5.5 06cf4dbee5 a text lane left out gets its units only beside a side lane at boot (issue #57)
A box booting Flash FP4-Local whose record named the flash lane took it
for every run's text lane whatever --no-flash said, and fetched it again
(35 and 136 GB). Left out, that lane now stays the run's text lane, read
as the box has it, with its units only at this release's pins: none of
its downloads, nothing started, the box's port, cache and binds kept,
and its steps and its end say so, with the way back (a Load; the
installer for a custom model; --with-<lane> fetches it whole at once)
and where the other text lane stands. --no-service with it left out is
refused: ./run.sh would have found no checkpoint.

The uninstall of a side lane at boot gives the boot back only to a text
lane that can start, its image and its checkpoint on the box
(text_lane_prepared, moved to lanes.sh; text_lane_give_back, shared by
the three uninstalls), and opencode's default follows the lane the box
comes back to when none can (text_lane_home). Found in two reviews: the
first way back, --with-<lane>, tests that stopped after the rule, and
five smaller defects of the second version.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 22:29:30 +02:00

37 lines
1.9 KiB
Python

"""Text lanes that can start, for the tests of the boot a side lane's uninstall gives back (lanes.sh
text_lane_back, text_lane_give_back): the image their unit or launcher runs is on the box, and the
checkpoint it serves is whole in the cache it mounts (text_lane_prepared). The empty units these tests
wrote before name neither: since v1.37.7 they are lanes that cannot start, and get no boot (review of
2026-10-21)."""
import pathlib
IMAGE = "lmsysorg/sglang@sha256:" + "e" * 64
# the docker of a box that has that image and no other: a stub's first line, before the rest of it
DOCKER_HAS_IT = f'[ "$1 $2" = "image inspect" ] && {{ [ "$3" = "{IMAGE}" ]; exit; }}\n'
def _engine(hf, repo):
return (f" -v {hf}:/root/.cache/huggingface \\\n {IMAGE} \\\n"
f" python3 -m sglang.launch_server \\\n --model-path {repo} --tp-size 1\n")
def _snapshot(hf, repo):
snap = pathlib.Path(hf) / "hub" / f"models--{repo.replace('/', '--')}" / "snapshots" / "main"
snap.mkdir(parents=True, exist_ok=True)
(snap / "model.safetensors").write_text("w")
def put_ready(units, cfg, hf, lanes):
"""The units of these text lanes ("27b", "flash"), each one able to start: the 27B unit names the
image and its checkpoint, the flash unit runs a launcher in cfg that does, and both checkpoints are
whole in hf."""
units, cfg = pathlib.Path(units), pathlib.Path(cfg)
if "27b" in lanes:
(units / "qwen38-sglang.service").write_text(
"[Service]\nExecStart=/usr/bin/docker run --rm \\\n" + _engine(hf, "org/text-27b"))
_snapshot(hf, "org/text-27b")
if "flash" in lanes:
(units / "qwen38-flash.service").write_text(f"[Service]\nExecStart=/bin/bash {cfg}/launch-flash.sh\n")
(cfg / "launch-flash.sh").write_text("exec /usr/bin/docker run --rm \\\n" + _engine(hf, "org/text-flash"))
_snapshot(hf, "org/text-flash")