Five workstreams that finish the remote-GPU line, plus the test hole that let a broken signature reach a commit. **Downloads go through the normal path** (Phase 5). Rather than a second remote-only route, the existing Models install flow became target-aware, so a model landing on a worker uses the same code, the same progress events and the same UI as a local one. Progress rows key on (target, repo_id) — the aggregator keyed on bare repo_id, so the same model downloading here and on a worker at once collapsed into one row that told the user nothing true about either. **Audiobooks render chapter by chapter on the worker** (Phase 8), with per-chapter local fallback and ONE aggregated notice. The failure that shape exists to prevent: a remote GPU that sleeps at chapter 40 of 200 must not turn a working book into 160 rows of PROGRESS_LEASE_EXPIRED. Dictation is deliberately NOT ported — it runs ASR per utterance inside a live WebSocket loop, and paying queue admission plus a round trip there would spend the one thing that route is for. **Dubbing stays local, and says so** (Phase 7). The coarse worker operation is not finished, so the picker still reports dubbing as local rather than showing a green remote chip over work this machine is doing. What could not wait is the in-loop OOM retry: it sniffed the error string and flushed the *local* CUDA cache, which under remote execution is the wrong machine's GPU entirely. That is fixed now, before the path that would have exercised it exists. **Two instances can no longer share the control plane.** A second VoiceStudio silently bound the same worker port and coexisted, so remote workers landed on whichever process won the race — a session that registers with one instance and appears dead to the other. This produced hours of misdiagnosis during hardware testing and would hit any user with the app open twice. The second instance now keeps running locally and explains the conflict instead of quietly competing. **And the hole that allowed all this to be missable.** gpu_gateway called Scheduler.submit(pinned_worker_id=...) one commit before that parameter existed. Every remote generation raised TypeError; 5236 tests passed anyway, because nothing exercised the gateway against the real scheduler. tests/test_gpu_gateway_scheduler_contract.py now runs that path for real and binds every gateway→dependency call signature. Verified by renaming the parameter away and watching both tests fail with the original error. Gallery previews also fall back to a local render when a downloaded clip cannot be decoded, rather than yielding silence. Backend 5274 passed, frontend 1812 passed. Not yet verified on hardware: Phases 4, 5, 6, 7, 8. Only the TTS path and its artifact transport have been proven on a real GPU.
41 lines
1.4 KiB
Python
41 lines
1.4 KiB
Python
"""Safety invariants for the unfinished coarse remote-dubbing port."""
|
|
|
|
import pytest
|
|
|
|
from api.routers import dub_generate
|
|
|
|
|
|
def test_local_oom_flushes_the_cuda_cache_before_retry(monkeypatch):
|
|
flushed = []
|
|
monkeypatch.setattr(dub_generate.torch.cuda, "is_available", lambda: True)
|
|
monkeypatch.setattr(dub_generate.torch.cuda, "empty_cache", lambda: flushed.append(True))
|
|
|
|
assert dub_generate._prepare_oom_retry(
|
|
RuntimeError("CUDA out of memory"), execution_target="local"
|
|
)
|
|
assert flushed == [True]
|
|
|
|
|
|
def test_remote_oom_never_flushes_the_control_plane_gpu(monkeypatch):
|
|
flushed = []
|
|
monkeypatch.setattr(dub_generate.torch.cuda, "is_available", lambda: True)
|
|
monkeypatch.setattr(dub_generate.torch.cuda, "empty_cache", lambda: flushed.append(True))
|
|
error = RuntimeError("CUDA out of memory on worker gpu2")
|
|
|
|
with pytest.raises(RuntimeError) as caught:
|
|
dub_generate._prepare_oom_retry(error, execution_target="remote")
|
|
|
|
assert caught.value is error
|
|
assert flushed == []
|
|
|
|
|
|
def test_non_oom_does_not_flush_or_retry(monkeypatch):
|
|
flushed = []
|
|
monkeypatch.setattr(dub_generate.torch.cuda, "is_available", lambda: True)
|
|
monkeypatch.setattr(dub_generate.torch.cuda, "empty_cache", lambda: flushed.append(True))
|
|
|
|
assert not dub_generate._prepare_oom_retry(
|
|
RuntimeError("bad reference audio"), execution_target="local"
|
|
)
|
|
assert flushed == []
|