Milestone 9 — Control-plane server (API / Redis / local MP4) ✅
Goal: the pure-CPU control plane — the Boson video API, job status, MP4 storage, render dispatch, and spillover. Volume-only by default: the MP4 is written to the control plane's local disk and TTL-cleaned; S3 is optional. Code: ~/modal_examples/milestones/m9_control_plane.py.
What was built
A server (stdlib-only, so it runs and self-tests with no external services) implementing:
POST /v1/videos→ createvideo_id, statusqueued, dispatch render async, return immediately.GET /v1/videos/{id}→ status/progress (Redis-like store).GET /v1/videos/{id}/content→ streams the MP4 from the control plane's local disk when ready; 409 when failed; 202 while processing.- Render dispatch integrates the M8 spillover controller; the MP4 is written to local disk and regularly TTL-cleaned (
LocalBlobStore.cleanup()). No S3.
Two-sided cleanup: the renderer caches the MP4 to its own disk, transmits to the control plane, then deletes its local copy (per-job, so warm containers don't accumulate); the control plane TTL-cleans served files.
Production mapping: StatusStore → Redis, LocalBlobStore → control-plane disk (or shared NFS/EFS), render_fn → Modal spawn(). S3 is optional (CDN/presigned downloads, or a multi-replica control plane without shared disk).
How it was validated (python3 m9_control_plane.py)
submit -> video_xxx queued
status -> completed, progress=100
content -> 54 bytes, video/mp4 (served from local disk)
cleanup -> stale MP4 removed, fresh kept
back-pressure -> ['queued','queued','failed'] (1 shed at cap)
failed render -> /content 409 (no infinite poll)
VALIDATION PASSED
Code review (separate subagent) — CHANGES NEEDED → fixed
| Finding (severity) | Fix applied |
|---|---|
/content couldn't distinguish failed from in_progress → clients poll forever (HIGH) |
/content now returns 409 + error for failed jobs; added a failed-path test over HTTP |
Shared SpilloverController unlocked → "thread-safe" was false (MED) |
Fixed in M8 (added a lock); verified under the multi-threaded control plane |
| In-memory MP4 hides a streaming/OOM problem (MED) | Switched default to a LocalBlobStore (disk-backed) with TTL cleanup; /content streams from disk. No S3. |
| Queued/worker race | Verified already fixed — POST returns the queued snapshot, not mutable state |
The POST→queued→in_progress→completed→content path and the shed path are both exercised end-to-end over real HTTP.
Validation also covers local-disk MP4 cleanup (stale file removed by TTL, fresh kept) — verified in python3 m9_control_plane.py.
Status: ✅ validated (API + status + local-disk MP4 + TTL cleanup + spillover + failed-path; no S3).