Skip to content

Conversation

@ric-yu
Copy link
Contributor

@ric-yu ric-yu commented Dec 2, 2025

Summary

  • Add GET /api/jobs endpoint with filtering, sorting, and pagination
    • Filter by status: pending, in_progress, completed, error
    • Sort by create_time or execution_time
    • Pagination via limit/offset
  • Add GET /api/jobs/{job_id} for single job details with full outputs
  • Track execution_time in history for completed jobs
  • Include outputs_count and preview_output in 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

@ric-yu ric-yu requested a review from guill as a code owner December 2, 2025 19:23
@ric-yu ric-yu marked this pull request as draft December 2, 2025 19:24
@ric-yu ric-yu force-pushed the feature/unified-jobs-api branch 2 times, most recently from ae57e94 to c4b7a84 Compare December 2, 2025 19:52
@ric-yu ric-yu marked this pull request as ready for review December 2, 2025 20:03
@Kosinkadink Kosinkadink added the Core Core team dependency label Dec 3, 2025
@ric-yu ric-yu marked this pull request as draft December 4, 2025 00:50
@ric-yu ric-yu marked this pull request as ready for review December 4, 2025 05:31
@ric-yu ric-yu marked this pull request as draft December 4, 2025 05:31
@ric-yu ric-yu marked this pull request as ready for review December 4, 2025 07:52
@ric-yu ric-yu force-pushed the feature/unified-jobs-api branch from 57fd19f to c860cc6 Compare December 4, 2025 20:53
@ric-yu
Copy link
Contributor Author

ric-yu commented Dec 4, 2025

Rebasing

@comfyanonymous
Copy link
Member

Can you test this properly? The endpoint doesn't work after I run a regular workflow.

@ric-yu
Copy link
Contributor Author

ric-yu commented Dec 9, 2025

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

@ric-yu ric-yu force-pushed the feature/unified-jobs-api branch from c5c3db7 to 1f7c1a9 Compare December 9, 2025 20:03
@ric-yu ric-yu force-pushed the feature/unified-jobs-api branch from 1371f61 to ed61899 Compare December 12, 2025 00:25
@ric-yu
Copy link
Contributor Author

ric-yu commented Dec 12, 2025

rebasing

@Kosinkadink Kosinkadink merged commit 1ca89b8 into Comfy-Org:master Dec 18, 2025
10 checks passed
lrivera pushed a commit to Research-Warrant/ComfyUI that referenced this pull request Jan 8, 2026
* feat: create a /jobs api to return queue and history jobs

* update unused vars

* include priority

* create jobs helper file

* fix ruff

* update how we set error message

* include execution error in both responses

* rename error -> failed, fix output shape

* re-use queue and history functions

* set workflow id

* allow srot by exec duration

* fix tests

* send priority and remove error msg

* use ws messages to get start and end times

* revert main.py fully

* refactor: move all /jobs business logic to jobs.py

* fix failing test

* remove some tests

* fix non dict nodes

* address comments

* filter by workflow id and remove null fields

* add clearer typing - remove get("..") or ..

* refactor query params to top get_job(s) doc, add remove_sensitive_from_queue

* add brief comment explaining why we skip animated

* comment that format field is for frontend backward compatibility

* fix whitespace

---------

Co-authored-by: Jedrzej Kosinski <[email protected]>
Co-authored-by: guill <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Core Core team dependency Core-Important

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants