web: route Scope streams through the live-runner discovery flow#23
Open
qianghan wants to merge 1 commit into
Open
web: route Scope streams through the live-runner discovery flow#23qianghan wants to merge 1 commit into
qianghan wants to merge 1 commit into
Conversation
Scope runs as a live runner, so its capacity lives in the live-runner registry
(GET /discovery -> POST /apps/{runner}/session -> stream), not the AI-worker
CheckAICapacity path that legacy /live-video-to-video uses. The sdk-service
web/app.py called start_lv2v for everything, so Scope requests hit the AI-worker
capacity check (0 on a live-runner-only orchestrator) and got "insufficient
capacity" even with a healthy, priced, idle runner.
Wire web/app.py to call start_scope() (already implemented on ja/live-runner)
for live-runner models (scope), keeping start_lv2v for the legacy serverless
path. Built on top of ja/live-runner so the live-runner client lib
(discovery.py, live_runner.py, scope.start_scope) is present.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: qianghan <qiang@livepeer.org>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
livepeer-python-gatewayalready wraps the legacy AI‑worker path:start_lv2v(...)→POST {orch}/live-video-to-video, where the orchestrator gates admission throughorch.CheckAICapacity→AIWorker.HasCapacity. That capacity check only sees AI workers.Scope runs as a live runner, not an AI worker. Its capacity lives in the live‑runner registry that the
ja/live-runnerbranch introduces (GET {orch}/discovery→POST {orch}/apps/{runner_id}/sessionto reserve a session, then stream + per‑session payment). Because the legacy capacity check is blind to live runners, a live‑runner‑only orchestrator (e.g. ourscope-1) rejects/live-video-to-videowith "insufficient capacity" even when/discoveryshows the runner healthy, priced, and idle.ja/live-runnerships the client for the new flow aslivepeer_gateway.scope.start_scope(...), but the FastAPI web wrapper (web/app.py) still routed every model throughstart_lv2v. So there was no way to drive a Scope live‑runner end‑to‑end through the SDK service — the discovery/reserve/pay path was unreachable from the HTTP API.This PR wires the web wrapper to pick the right flow per model, so Scope streams actually reach the live runner.
What
web/app.py— route by model:_LIVE_RUNNER_MODELS = {"scope"}set.start_job, ifmodel_idis a live‑runner model, callawait start_scope(orch_url, req, token=..., signer_url=...)(discover → reserve → stream + payment challenge). Otherwise keep the legacystart_lv2vpath (run in a thread since it's sync).rejections: [{url, reason}]) for easier debugging.This is purely additive: non‑Scope models keep the existing legacy behavior; only
scopetakes the live‑runner path.Verified
Against a live
scope-1orchestrator (live‑runner only):start_scopeperformsGET /discovery, reserves a session viaPOST /apps/{runner_id}/session, and answers the runner payment challenge — confirmed in orchestrator logs (discovery hit, session reserved, payment processed).start_lv2vpath used to fail this same orchestrator with "insufficient capacity"; the live‑runner path is admitted.Known follow‑ups (not in this PR)
in=none, out=none). This PR unblocks discovery/reserve/pay; trickle media wiring is the next step.start_scope.Base branch:
ja/live-runner(these changes depend on thelivepeer_gateway.scopemodule introduced there).