- Added `ollama-models.yaml` to .gitignore and implemented logic to copy it in gpu-rent.ps1 and gpu-rent.sh. - Enhanced env.example to include new variables for LLM runtime options and local watchdog configuration. - Updated CLI commands to support LLM options during setup and execution, including new flags for Ollama and llama.cpp. - Improved documentation in cli.md and README.md to reflect changes in LLM integration and local watchdog functionality. - Adjusted architecture and decisions documentation to clarify the role of LLMs and local watchdog in the system.
50 lines
1.4 KiB
Python
50 lines
1.4 KiB
Python
from gpu_rent.tunnel import decide_watch, tunnel_forwards
|
|
|
|
|
|
def test_decide_ok_active():
|
|
d = decide_watch("ACTIVE", tunnel_alive=True)
|
|
assert d.kind == "ok"
|
|
|
|
|
|
def test_decide_reconnect_when_tunnel_dead():
|
|
d = decide_watch("ACTIVE", tunnel_alive=False)
|
|
assert d.kind == "reconnect"
|
|
|
|
|
|
def test_decide_unshelve_expired():
|
|
for st in ("EXPIRED", "SHELVED", "SHELVED_OFFLOADED"):
|
|
d = decide_watch(st, tunnel_alive=True)
|
|
assert d.kind == "unshelve", st
|
|
|
|
|
|
def test_decide_exit_error():
|
|
d = decide_watch("ERROR", tunnel_alive=True)
|
|
assert d.kind == "exit"
|
|
|
|
|
|
def test_decide_exit_missing():
|
|
d = decide_watch(None, tunnel_alive=False)
|
|
assert d.kind == "exit"
|
|
|
|
|
|
def test_tunnel_forwards_swarm_only(monkeypatch):
|
|
class Cfg:
|
|
swarmui_local_port = 17801
|
|
llm_runtime = "none"
|
|
ollama_local_port = 17811
|
|
llamacpp_local_port = 17812
|
|
|
|
monkeypatch.setattr("gpu_rent.tunnel.load_state", lambda: type("S", (), {"notes": {}})())
|
|
assert tunnel_forwards(Cfg()) == [(17801, 7801)]
|
|
|
|
|
|
def test_tunnel_forwards_ollama(monkeypatch):
|
|
class Cfg:
|
|
swarmui_local_port = 17801
|
|
llm_runtime = "ollama"
|
|
ollama_local_port = 17811
|
|
llamacpp_local_port = 17812
|
|
|
|
monkeypatch.setattr("gpu_rent.tunnel.load_state", lambda: type("S", (), {"notes": {}})())
|
|
assert tunnel_forwards(Cfg()) == [(17801, 7801), (17811, 11434)]
|