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)
| 1759 | |
| 1760 | @routes.get("/v2/manager/queue/status") |
| 1761 | async 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") |
nothing calls this directly
no test coverage detected