Skip to content

Commit c33c6c8

Browse files
committed
send priority and remove error msg
1 parent 1b2aa44 commit c33c6c8

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

comfy_execution/jobs.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,16 @@ def is_previewable(media_type, item):
5050

5151
def normalize_queue_item(item, status):
5252
"""Convert queue item tuple to unified job dict."""
53-
_, prompt_id, _, extra_data, _ = item[:5]
53+
priority, prompt_id, _, extra_data, _ = item[:5]
5454
create_time = extra_data.get('create_time')
5555
extra_pnginfo = extra_data.get('extra_pnginfo', {}) or {}
5656
workflow_id = extra_pnginfo.get('workflow', {}).get('id')
5757

5858
return {
5959
'id': prompt_id,
6060
'status': status,
61+
'priority': priority,
6162
'create_time': create_time,
62-
'error_message': None,
6363
'execution_error': None,
6464
'execution_start_time': None,
6565
'execution_end_time': None,
@@ -72,7 +72,7 @@ def normalize_queue_item(item, status):
7272
def normalize_history_item(prompt_id, history_item, include_outputs=False):
7373
"""Convert history item dict to unified job dict."""
7474
prompt_tuple = history_item['prompt']
75-
_, _, prompt, extra_data, _ = prompt_tuple[:5]
75+
priority, _, prompt, extra_data, _ = prompt_tuple[:5]
7676
create_time = extra_data.get('create_time')
7777
extra_pnginfo = extra_data.get('extra_pnginfo', {}) or {}
7878
workflow_id = extra_pnginfo.get('workflow', {}).get('id')
@@ -89,15 +89,13 @@ def normalize_history_item(prompt_id, history_item, include_outputs=False):
8989
outputs = history_item.get('outputs', {})
9090
outputs_count, preview_output = get_outputs_summary(outputs)
9191

92-
error_message = None
9392
execution_error = None
9493
if status == JobStatus.FAILED and status_info:
9594
messages = status_info.get('messages', [])
9695
for entry in messages:
9796
if isinstance(entry, (list, tuple)) and len(entry) >= 2 and entry[0] == 'execution_error':
9897
detail = entry[1]
9998
if isinstance(detail, dict):
100-
error_message = str(detail.get('exception_message', ''))
10199
execution_error = detail
102100
break
103101

@@ -111,8 +109,8 @@ def normalize_history_item(prompt_id, history_item, include_outputs=False):
111109
job = {
112110
'id': prompt_id,
113111
'status': status,
112+
'priority': priority,
114113
'create_time': create_time,
115-
'error_message': error_message,
116114
'execution_error': execution_error,
117115
'execution_start_time': execution_start_time,
118116
'execution_end_time': execution_end_time,

tests/execution/test_execution.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -942,7 +942,7 @@ def test_jobs_api_job_structure(
942942
assert "outputs_count" in job, "Job should have outputs_count"
943943
assert "preview_output" in job, "Job should have preview_output"
944944
assert "workflow_id" in job, "Job should have workflow_id"
945-
assert "error_message" in job, "Job should have error_message"
945+
assert "execution_error" in job, "Job should have execution_error"
946946

947947
def test_jobs_api_preview_output_structure(
948948
self, client: ComfyClient, builder: GraphBuilder

tests/execution/test_jobs.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,10 +256,11 @@ def test_basic_normalization(self):
256256

257257
assert job['id'] == 'prompt-123'
258258
assert job['status'] == 'pending'
259+
assert job['priority'] == 10
259260
assert job['create_time'] == 1234567890
260261
assert job['execution_start_time'] is None
261262
assert job['execution_end_time'] is None
262-
assert job['error_message'] is None
263+
assert job['execution_error'] is None
263264
assert job['outputs_count'] == 0
264265
assert job['workflow_id'] == 'workflow-abc'
265266

@@ -288,6 +289,7 @@ def test_completed_job(self):
288289

289290
assert job['id'] == 'prompt-456'
290291
assert job['status'] == 'completed'
292+
assert job['priority'] == 5
291293
assert job['execution_start_time'] == 1234567890000
292294
assert job['execution_end_time'] == 1234567890000 + 2500 # +2.5 seconds in ms
293295
assert job['workflow_id'] == 'workflow-xyz'
@@ -323,10 +325,10 @@ def test_failed_job(self):
323325
# List view - includes execution_error
324326
job = normalize_history_item('prompt-789', history_item)
325327
assert job['status'] == 'failed'
326-
assert job['error_message'] == 'CUDA out of memory'
327328
assert job['execution_error'] == error_detail
328329
assert job['execution_error']['node_id'] == '5'
329330
assert job['execution_error']['node_type'] == 'KSampler'
331+
assert job['execution_error']['exception_message'] == 'CUDA out of memory'
330332

331333
def test_include_outputs(self):
332334
"""When include_outputs=True, should include full output data."""

0 commit comments

Comments
 (0)