MCPcopy
hub / github.com/Comfy-Org/ComfyUI-Manager / queue_count

Function queue_count

comfyui_manager/glob/manager_server.py:1761–1810  ·  view source on GitHub ↗

Get current queue status with optional client filtering. Query parameters: client_id: Optional client ID to filter tasks Returns: JSON with queue counts and processing status

(request)

Source from the content-addressed store, hash-verified

1759
1760@routes.get("/v2/manager/queue/status")
1761async def queue_count(request):
1762 """Get current queue status with optional client filtering.
1763
1764 Query parameters:
1765 client_id: Optional client ID to filter tasks
1766
1767 Returns:
1768 JSON with queue counts and processing status
1769 """
1770 client_id = request.query.get("client_id")
1771
1772 if client_id:
1773 # Filter tasks by client_id
1774 running_client_tasks = [
1775 task
1776 for task in task_queue.running_tasks.values()
1777 if task.client_id == client_id
1778 ]
1779 pending_client_tasks = [
1780 item
1781 for priority, counter, item in task_queue.pending_tasks
1782 if item.client_id == client_id
1783 ]
1784 history_client_tasks = {
1785 ui_id: task
1786 for ui_id, task in task_queue.history_tasks.items()
1787 if hasattr(task, "client_id") and task.client_id == client_id
1788 }
1789
1790 return web.json_response(
1791 {
1792 "client_id": client_id,
1793 "total_count": len(pending_client_tasks) + len(running_client_tasks),
1794 "done_count": len(history_client_tasks),
1795 "in_progress_count": len(running_client_tasks),
1796 "pending_count": len(pending_client_tasks),
1797 "is_processing": len(running_client_tasks) > 0,
1798 }
1799 )
1800 else:
1801 # Return overall status
1802 return web.json_response(
1803 {
1804 "total_count": task_queue.total_count(),
1805 "done_count": task_queue.done_count(),
1806 "in_progress_count": len(task_queue.running_tasks),
1807 "pending_count": len(task_queue.pending_tasks),
1808 "is_processing": task_queue.is_processing(),
1809 }
1810 )
1811
1812
1813@routes.post("/v2/manager/queue/start")

Callers

nothing calls this directly

Calls 6

is_processingMethod · 0.80
getMethod · 0.45
valuesMethod · 0.45
itemsMethod · 0.45
total_countMethod · 0.45
done_countMethod · 0.45

Tested by

no test coverage detected