The remote-GPU line, verified on hardware rather than asserted. **Dubbing renders on the worker.** dub_generate.py dispatches the coarse `dub_segments` operation through the gateway, following the audiobook pattern: per-unit local fallback after consecutive remote failures, one aggregated notice rather than one per segment. A 40-minute dub that loses its worker at segment 200 degrades instead of producing 200 error rows. **An out-of-date worker is now refused by name.** This was the worst defect in the plan and it was silent: an un-upgraded worker registered cleanly, then ignored `inputs` and rendered a clone with NO reference audio — returned as success. A plausible wrong result with nothing anywhere to surface it. Workers now declare features, and one missing them is turned away with the features named and `no task was run`. Verified live: a worker one commit behind was correctly refused. **"Offline" and "cannot run this" are different facts.** Asking a live worker for an engine it lacks answered "is offline or cannot be reached. Wake the selected worker" — while that worker reported ready, one free slot and 3.6 ms latency. The user was sent to wake a machine that was already awake. The scheduler now distinguishes absent from present-but- incapable, and names the engine rather than the operation, because the engine is the thing a user can install. **An engine with no catalog entry is no longer hidden.** A `repo_ids` non-emptiness check had been implemented as a runtime filter, so a worker silently refused to advertise any engine lacking a models.yaml entry — which is four registered engines, including CosyVoice. Users with those already installed would have lost remote support with only a log line. Empty `repo_ids` now means "not downloadable here", never "not runnable". **And a script so this stops being done by hand.** scripts/verify-remote-worker.sh runs the per-phase acceptance checks against a live worker, non-destructively. Its preconditions are the mistakes that cost the most time: exactly one listener on the control port (two instances silently shared it), and never detecting the worker with a pgrep pattern that matches the ssh shell running it. Its first real run found the dubbing picker claiming remote placement. That turned out to be the CHECK being stale, not the picker — the port had landed since it was written. It now asserts self-consistency instead: the picker may claim remote only for an operation the control plane actually advertises as remotely producible, which cannot rot the next time an op is ported. Backend 5291 passed, frontend 1812 passed. Acceptance script: no automated failures across Phases 4-8 on an RTX 4090. Four checks remain MANUAL by design — true airplane mode, concurrent downloads, killing a worker mid-audiobook, and the model-list UI — and are reported as unverified rather than passed.
51 lines
1.8 KiB
Python
51 lines
1.8 KiB
Python
import asyncio
|
|
import io
|
|
import zipfile
|
|
from types import SimpleNamespace
|
|
|
|
import pytest
|
|
import torch
|
|
|
|
|
|
def test_worker_runs_dubbing_as_one_task_and_reports_each_segment(monkeypatch):
|
|
from worker.executor import TaskExecutor
|
|
|
|
class Backend:
|
|
sample_rate = 24_000
|
|
applies_own_mastering = True
|
|
|
|
def generate(self, text, **_kwargs):
|
|
return torch.full((1, len(text) * 10), 0.1)
|
|
|
|
monkeypatch.setattr(TaskExecutor, "_load_backend", staticmethod(lambda _engine: Backend()))
|
|
progress = []
|
|
|
|
async def report(fraction, stage):
|
|
progress.append((fraction, stage))
|
|
|
|
assignment = SimpleNamespace(
|
|
operation="dub_segments", engine="test", params_json=(
|
|
'{"segments":[{"index":3,"text":"one","effect_preset":"raw",'
|
|
'"watermark":false},{"index":8,"text":"two","effect_preset":"raw",'
|
|
'"watermark":false}],"ref_audio":[null,null]}'
|
|
), inputs=[], deadlines=SimpleNamespace(model_load_seconds=30, execution_seconds=30),
|
|
)
|
|
result = asyncio.run(TaskExecutor().execute(assignment, on_progress=report))
|
|
|
|
with zipfile.ZipFile(io.BytesIO(result["payload"])) as bundle:
|
|
assert bundle.namelist() == ["segments/3.wav", "segments/8.wav"]
|
|
assert progress == [(0.5, "segment 1 of 2"), (1.0, "segment 2 of 2")]
|
|
|
|
|
|
def test_remote_dub_decoder_rejects_non_segment_members(tmp_path, monkeypatch):
|
|
from api.routers import dub_generate
|
|
from services.gpu_gateway import RemoteResult
|
|
|
|
artifact = tmp_path / "bad.zip"
|
|
with zipfile.ZipFile(artifact, "w") as bundle:
|
|
bundle.writestr("../escape.wav", b"bad")
|
|
monkeypatch.setattr(dub_generate, "DUB_DIR", str(tmp_path / "dubs"))
|
|
|
|
with pytest.raises(ValueError, match="unexpected dub artifact member"):
|
|
dub_generate._decode_remote_dub(RemoteResult("task", "worker", "GPU", str(artifact)))
|