ComfyUI
ComfyUI copied to clipboard
Add unified jobs API with /api/jobs endpoints
Summary
- Add
GET /api/jobsendpoint with filtering, sorting, and pagination- Filter by status:
pending,in_progress,completed,error - Sort by
create_timeorexecution_time - Pagination via
limit/offset
- Filter by status:
- Add
GET /api/jobs/{job_id}for single job details with full outputs - Track
execution_timein history for completed jobs - Include
outputs_countandpreview_outputin job responses - Preview logic matches frontend (prefers
type=output, supports images/video/audio/3D)
Motivation
Currently /queue and /history are separate endpoints with different response shapes. This unified API provides:
- Consistent job representation across all states
- Proper pagination and filtering
- Summary fields (
outputs_count,preview_output) for list views without fetching full outputs
Test plan
- [x] Run existing tests:
pytest tests/execution/test_execution.py -v - [x] Verify
/api/jobsreturns jobs from queue and history on https://www.github.com/Comfy-Org/ComfyUI_frontend/commit/a57ea57a09a274efdc8444b949452509d7cf49de - [x] Verify
/api/jobs/{id}returns full job with outputs - [x] Verify
execution_timeis tracked for completed jobs
Rebasing
Can you test this properly? The endpoint doesn't work after I run a regular workflow.
Can you test this properly? The endpoint doesn't work after I run a regular workflow.
Fixed an issue with preview as text. This endpoint has been working for me otherwise, but I'm stuck with testing light workflows since I'm on a Mac
rebasing