Serve video as a job at /v1/videos, matching the wan2gp-api container - #68
Merged
Merged
Conversation
diffuseR::serve's video endpoint was POST /v1/videos/generations returning
raw mp4 bytes synchronously. Move it to the create/poll/download job shape
the wan2gp-api container now uses, so a client written for that contract
(xtx.api's wan2gp_api backend) can talk to either service unchanged:
POST /v1/videos -> 202 {id, status}
GET /v1/videos/{id} -> {status, progress, ...}
GET /v1/videos/{id}/content -> the mp4
The server is single-threaded and holds the model in-process, so true
background async is not possible without a second model copy: generation is
still synchronous on create (the create call blocks for the render), but the
result is stored behind a job id and fetched separately, and the split makes
the contract uniform with the container. A bounded LRU (max_jobs, default 8)
keeps recent results and evicts old files. Image generation
(/v1/images/generations) and the CUDA-OOM-exits-for-restart behaviour are
unchanged. test_serve.R covers create/status/content and eviction with the
model call stubbed (44 assertions pass).
# Conflicts: # DESCRIPTION # NEWS.md
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.
diffuseR::serve's video endpoint was
POST /v1/videos/generationsreturningraw mp4 bytes synchronously. This moves it to the create/poll/download job
shape the wan2gp-api container now uses, so a client written for that
contract (xtx.api's
wan2gp_apibackend) can talk to either serviceunchanged:
The server is single-threaded and holds the model in-process, so true
background async is not possible without a second model copy. Generation is
still synchronous on create (the create call blocks for the render), but the
result is stored behind a job id and fetched separately, which makes the
contract uniform with the container. A bounded LRU (
max_jobs, default 8)keeps recent results and evicts old files.
POST /v1/images/generationsandthe CUDA-OOM-exits-for-restart behaviour are unchanged.
Verification
test_serve.R: 44 assertions pass against source (pkgload::load_all),covering create/status/content and eviction with the model call stubbed.