igneum/tools/fleet/lib/__init__.py

20 lines
1.6 KiB
Python

"""tools/fleet/lib: the ONE tested library for operations on a rented box (Josh's standing rule, CLAUDE.md e1d0b23,
6 October 2026). Every fleet playbook (canary, wave, matrix, recovery, devnet2-gate) calls these; a watcher reads the
chain-side fact (height, peers, exec tip, paid records), never a reported MH/s or a process name.
from lib import Box
b = Box.from_registry("dn2-1") # or Box(host, port, label)
b.run("hostname") # ssh, with ServerAlive and a timeout; (rc, out, err)
b.put([local, ...], "/root/fleet/in/") # scp with three tries
b.install_payload(url_or_path, sha256) # the node binary into /root/fleet/in/igneumd-<sha16>, checked on the box
b.start_node(binary, override, peers, devnet_suffix=None, verifier=None, extra=[]) # anchored kill of the old one, then start
b.wait_synced(limit_s) # the watch line's synced=true (chain-side)
b.height(), b.peers(), b.exec_tip(), b.exec_status(), b.proving_status(), b.state_root(height), b.paid_segments()
b.start_miner(label, wallet, device=0, pack_dir=...) # one igneum-miner with the CUDA worker; returns the pid
b.start_prover(label, wallet, hub_peer, threshold="", miner="keep") # box-prover.sh
b.stop_all() # every stage process (anchored), never sshd
b.destroy() # the provider call plus the registry row
Process patterns are anchored on the executable's path or use -x (tools/ci/pgrep-self-match-check.sh).
"""
from .box import Box, Registry, SshError # noqa: F401