runner: resolve relative operator python paths against repo root (multi-node portability)
Manifest "python" can now be a repo-relative path (venvs/mflux/bin/python) that resolves against db.ROOT, so the same operator code runs on any machine/checkout (M3 Ultra, M1 Ultra worker). All 6 venv operators switched to relative paths. Prep for the M1 Ultra second node. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
37cf85693a
commit
210d80484c
25
docs/BRIEF_OLLAMA_OPERATORS.md
Normal file
25
docs/BRIEF_OLLAMA_OPERATORS.md
Normal file
@ -0,0 +1,25 @@
|
||||
# MODELBEAST — ollama operators brief (Opus handover)
|
||||
|
||||
**From:** the asset-campaign session (2026-07-13). **Decision (John + Fable):** MODELBEAST is
|
||||
THE universal queue for all local model work on the tailnet — no second queue system. Direct
|
||||
Ollama calls (:11434) stay fine for quick interactive hits, but BULK LLM/vision sweeps must
|
||||
ride the job queue so they don't fight Klein/TRELLIS for Metal.
|
||||
|
||||
## The job: two new operators (mirror an existing operator's manifest+run.py pattern)
|
||||
|
||||
1. **`ollama_vision`** [category: llm] — params: `{model: "gemma3:4b", prompt, temperature=0}`,
|
||||
accepts: image (the job's asset), produces: text (a .json/.txt asset with the response).
|
||||
Implementation = one POST to localhost:11434/api/generate with the asset base64'd into
|
||||
`images`. Resource lane: gpu (that's the whole point — arbitration with image/mesh gen).
|
||||
|
||||
2. **`ollama_llm`** [category: llm] — same but text-only (`/api/chat`), no input asset,
|
||||
`{model: "qwen3:8b|qwen3:32b|qwen3:235b", prompt|messages}`.
|
||||
|
||||
Notes:
|
||||
- Keep operators thin — Ollama does the work; the operator is just queue admission + asset IO.
|
||||
- A bulk sweep is then N jobs (one per image) — the lane serialises them gracefully and
|
||||
`/api/jobs` gives progress/retry/cancel for free. No new batch machinery.
|
||||
- pgvector embeddings: NOT now (deferred by design). When un-deferred it's one more thin
|
||||
operator (`ollama_embed` → /api/embed); DB writes stay client-side.
|
||||
- Test: submit 3 ollama_vision jobs while a flux_local job runs; assert FIFO within the gpu
|
||||
lane and all 4 complete.
|
||||
@ -7,7 +7,7 @@
|
||||
"produces": ["image"],
|
||||
"resources": "gpu",
|
||||
"entry": "run.py",
|
||||
"python": "/Users/m3ultra/Documents/MODELBEAST/venvs/rmbg/bin/python",
|
||||
"python": "venvs/rmbg/bin/python",
|
||||
"params_schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
"produces": ["image"],
|
||||
"resources": "gpu",
|
||||
"entry": "run.py",
|
||||
"python": "/Users/m3ultra/Documents/MODELBEAST/venvs/mflux/bin/python",
|
||||
"python": "venvs/mflux/bin/python",
|
||||
"params_schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
"produces": ["image"],
|
||||
"resources": "gpu",
|
||||
"entry": "run.py",
|
||||
"python": "/Users/m3ultra/Documents/MODELBEAST/venvs/mflux/bin/python",
|
||||
"python": "venvs/mflux/bin/python",
|
||||
"params_schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
"produces": ["image"],
|
||||
"resources": "gpu",
|
||||
"entry": "run.py",
|
||||
"python": "/Users/m3ultra/Documents/MODELBEAST/venvs/mflux/bin/python",
|
||||
"python": "venvs/mflux/bin/python",
|
||||
"params_schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
"produces": ["model"],
|
||||
"resources": "gpu",
|
||||
"entry": "run.py",
|
||||
"python": "/Users/m3ultra/Documents/MODELBEAST/venvs/sf3d/bin/python",
|
||||
"python": "venvs/sf3d/bin/python",
|
||||
"params_schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
"produces": ["model"],
|
||||
"resources": "gpu",
|
||||
"entry": "run.py",
|
||||
"python": "/Users/m3ultra/Documents/MODELBEAST/vendor/trellis-mac/.venv/bin/python",
|
||||
"python": "vendor/trellis-mac/.venv/bin/python",
|
||||
"params_schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
@ -193,8 +193,13 @@ class Runner:
|
||||
|
||||
outdir = Path(job["outdir"])
|
||||
entry = Path(op["dir"]) / op.get("entry", "run.py")
|
||||
python = op.get("python") or sys.executable
|
||||
if op.get("python") and not Path(python).exists():
|
||||
# a manifest "python" may be relative to the repo root (portable across
|
||||
# machines) or absolute (legacy); resolve relative ones against db.ROOT
|
||||
op_py = op.get("python")
|
||||
if op_py and not Path(op_py).is_absolute():
|
||||
op_py = str(db.ROOT / op_py)
|
||||
python = op_py or sys.executable
|
||||
if op_py and not Path(python).exists():
|
||||
await self._update(con, job_id, status="error", finished_at=db.now(),
|
||||
error=f"operator not installed — {python} missing. "
|
||||
f"Run its install script under scripts/.")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user