This commit addresses BE-672 by ensuring all execution-related websocket
messages include the workflow_id field when available.
Changes:
- Added extract_workflow_id() helper function in comfy_execution/jobs.py
to extract workflow_id from extra_data
- Updated execution.py to include workflow_id in all websocket messages:
- execution_start
- execution_cached
- execution_success
- execution_error
- execution_interrupted
- executing
- executed (including cached UI)
- Updated main.py to include workflow_id in:
- progress messages (via hijack_progress hook)
- final executing message (node=None)
- Updated comfy_execution/progress.py to include workflow_id in:
- progress_state messages
- preview image metadata
The workflow_id is extracted from extra_data['extra_pnginfo']['workflow']['id']
and is conditionally included in messages only when present, maintaining
backward compatibility with workflows that don't have this field.
Fixes: BE-672
Co-authored-by: Luke Mino-Altherr <luke-mino-altherr@users.noreply.github.com>
Move count increment before isinstance(item, dict) check so that
non-dict output items (like text strings from PreviewAny node)
are included in outputs_count.
This aligns OSS Python with Cloud's Go implementation which uses
len(itemsArray) to count ALL items regardless of type.
Amp-Thread-ID: https://ampcode.com/threads/T-019c0bb5-14e0-744f-8808-1e57653f3ae3
Co-authored-by: Amp <amp@ampcode.com>
* 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 <kosinkadink1@gmail.com>
Co-authored-by: guill <jacob.e.segal@gmail.com>