Skip to content

Commit

Permalink
Add status endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
lsbardel committed Aug 4, 2024
1 parent 30bcd84 commit ade61a7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
]
},
{
"name": "API Serve",
"name": "AIO-FLUID EXAMPLE Serve",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/examples/main.py",
"cwd": "${workspaceFolder}",
"justMyCode": false,
"args": [
"ls"
"serve"
],
"debugOptions": [
"RedirectOutput"
Expand Down
1 change: 1 addition & 0 deletions fluid/scheduler/consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ def __init__(self, **config: Any) -> None:
self._queue_tasks_worker = WorkerFunction(
self._queue_task, name="queue-task-worker"
)
self.add_workers(self._queue_tasks_worker)
for i in range(self.config.max_concurrent_tasks):
worker_name = f"task-worker-{i+1}"
self.add_workers(
Expand Down
11 changes: 11 additions & 0 deletions fluid/scheduler/endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,17 @@ async def get_tasks(task_manager: TaskManagerDep) -> list[TaskInfo]:
return await task_manager.broker.get_tasks_info()


@router.get(
"/tasks/status",
response_model=dict,
summary="Task consumer status",
description="Retrieve a list of tasks runs",
)
async def get_task_status(task_manager: TaskManagerDep) -> dict:
if isinstance(task_manager, Worker):
return await task_manager.status()
return {}

@router.post(
"/tasks",
response_model=TaskRun,
Expand Down

0 comments on commit ade61a7

Please sign in to comment.