Job CRUD operations and Celery task dispatch.
Source: web/backend/routers/jobs.py
POST /api/jobsCreate a job and dispatch it to the Celery worker.
Request body: JobCreateRequest
Process:
config_json from requestpending statusrun_pipeline_task.delay(str(job.id)) → Pipeline Taskscelery_task_id on the jobResponse: JobResponse
GET /api/jobsList jobs with optional filtering and pagination.
Query parameters:
| Param | Type | Default | Description |
|---|---|---|---|
status |
str |
None |
Filter by status |
limit |
int |
20 | Results per page (1-100) |
offset |
int |
0 | Pagination offset |
Response: JobListResponse
GET /api/jobs/{job_id}Get a single job by ID.
Response: JobResponse
DELETE /api/jobs/{job_id}Delete a job and clean up its files.
Process:
POST /api/jobs/{job_id}/stopRequest an early stop for a running lip-sync job.
Validation:
404 when the job does not exist.400 unless the job uses the lip-sync pipeline.400 unless the job is pending or running.After validation, the endpoint writes job:{id}:cancel to Redis with a 24-hour
expiry and returns { "detail": "stop requested" }. The worker polls this flag
via Progress Reporter and, for remote GPU work, forwards cancellation to the
inference server. The frontend requires a separate inline confirmation before it
calls this endpoint; the API itself remains suitable for programmatic clients.
GET /api/jobs/{job_id}/downloadDownload the job’s output file. The response type depends on the configured storage backend:
FileResponse (direct file stream)RedirectResponse to a time-limited signed URLPOST /api/jobs/{job_id}/export-epubTrigger an on-demand text-and-narration EPUB export for a completed lip-sync
reader job. The presenter is intentionally omitted because EPUB reading systems
do not reliably synchronize video with Media Overlays. The task stores separate
state in job.config_json:
epub_export_status: running, done, or failedepub_export_output: output filename when completeepub_export_error: error message when failedGET /api/jobs/{job_id}/export-epub/statusReturn the current EPUB export state using the common export_status,
export_output, and export_error response keys.
GET /api/jobs/{job_id}/export-epub/downloadDownload the exported EPUB when epub_export_status == "done".
Jobs Router
├── Web Database (async session)
├── DB Models (Job, JobStatus, UploadedFile)
├── Schemas (JobCreateRequest, JobResponse, JobListResponse)
├── Storage Service (delete_job_files, get_download_response)
└── Pipeline Tasks (main and EPUB-export tasks; lazy imports)