Files
alzeo/tests/test_install_custom_model_limits.py
Hasan BasbunarandClaude Opus 5.5 e7dce64b99 install.sh: disk need from what is left, configs written with their unit, custom models updatable, checks that name what they found
- I4: a snapshot counts as cached when every shard its index names is in it
  (huggingface_hub creates the folder before the first byte); otherwise the
  bytes already cached come off the need (a 74-of-124 GB resume was checked
  against 10 GB)
- I5: the PLE table's 50 GB are checked on PLE_DIR's disk when it is not
  HF_CACHE's
- I6: the YaRN patch or restore runs right before the unit that reads it is
  installed (or at the end of step 7 on --no-service): a run dying in between
  left the old mode's unit on the new mode's configs, a crash at next start
- I7: oc-limits.sh has a row for a kept custom --model-path, and its refusal
  can fire (read <<<"$(cmd)" hid the status); every update of such a box
  died at step 7
- I8: a box kept on the pre-v1.9 BF16 draft is told how to reach v1.9's
- I9: --no-service on a 1m box names the installed unit and both ways out
  instead of a CONTEXT_MODE nobody set; README says so
- I10: a failing nvidia-smi is quoted instead of "Install failed at line N"
- I11/I12: the smoke curl's failure points at the journal, a kept engine gets
  30 min, and a wall of "!" is refused rather than "Installed, verified"
  (the live 27B answers READY in 24 to 34 tokens, 5 of 5)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-24 16:09:46 +02:00

40 lines
1.9 KiB
Python

#!/usr/bin/env python3
"""A box that serves a custom --model-path can be updated.
install.sh keeps a --model-path it does not know, as MODEL_CHOICE=custom, and at step 7
asks oc-limits.sh for opencode's limits. The table had no row for it, and the refusal
could not fire: `read <<<"$(cmd)"` returns 0 whatever cmd returned. So every update of
such a box died at step 7 under "returned no limits" (found in review, 2026-09-24).
"""
import pathlib
import subprocess
import tempfile
import unittest
REPO = pathlib.Path(__file__).resolve().parents[1]
TEXT = (REPO / "install.sh").read_text()
class ACustomModelHasLimits(unittest.TestCase):
def test_the_table_has_a_row_for_a_kept_custom_model(self):
for mode, want in (("native", "173000 64000 local"), ("1m", "480000 160000 local, 1M")):
r = subprocess.run([str(REPO / "oc-limits.sh"), "custom", mode],
capture_output=True, text=True, timeout=30)
self.assertEqual((r.returncode, r.stdout.strip()), (0, want), r.stderr)
def test_a_refusal_of_the_table_is_named(self):
start = TEXT.index('OC_ROW="$("$REPO_DIR/oc-limits.sh" "$MODEL_CHOICE" "$OC_SELECTOR")"')
block = TEXT[start:TEXT.index("# The output CEILING", start)]
fake = pathlib.Path(tempfile.mkdtemp(prefix="oc-refuses-"))
(fake / "oc-limits.sh").write_text("#!/bin/sh\necho 'oc-limits: unknown target \"x\"' >&2\nexit 2\n")
(fake / "oc-limits.sh").chmod(0o755)
script = ('set -euo pipefail\ndie(){ echo "DIE: $*"; exit 1; }\n'
f'REPO_DIR="{fake}"; MODEL_CHOICE=x; OC_SELECTOR=1m\n' + block + "echo REACHED\n")
r = subprocess.run(["bash", "-c", script], capture_output=True, text=True, timeout=30)
self.assertIn("DIE: oc-limits.sh refused MODEL_CHOICE=x", r.stdout, r.stdout + r.stderr)
self.assertNotIn("REACHED", r.stdout)
if __name__ == "__main__":
unittest.main(verbosity=2)