-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
514 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
docs/3.0rc/api-ref/rest-api/server/task-workers/read-task-workers.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
openapi: post /api/task_workers/filter | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
openapi: post /api/task_workers/filter | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,7 @@ | |
saved_searches, | ||
task_run_states, | ||
task_runs, | ||
task_workers, | ||
templates, | ||
ui, | ||
variables, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from typing import List, Optional | ||
|
||
from fastapi import Body | ||
from pydantic import BaseModel | ||
|
||
from prefect.server import models | ||
from prefect.server.models.task_workers import TaskWorkerResponse | ||
from prefect.server.utilities.server import PrefectRouter | ||
|
||
router = PrefectRouter(prefix="/task_workers", tags=["Task Workers"]) | ||
|
||
|
||
class TaskWorkerFilter(BaseModel): | ||
task_keys: List[str] | ||
|
||
|
||
@router.post("/filter") | ||
async def read_task_workers( | ||
task_worker_filter: Optional[TaskWorkerFilter] = Body( | ||
default=None, description="The task worker filter", embed=True | ||
), | ||
) -> List[TaskWorkerResponse]: | ||
"""Read active task workers. Optionally filter by task keys.""" | ||
|
||
if task_worker_filter and task_worker_filter.task_keys: | ||
return await models.task_workers.get_workers_for_task_keys( | ||
task_keys=task_worker_filter.task_keys, | ||
) | ||
|
||
else: | ||
return await models.task_workers.get_all_workers() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ | |
saved_searches, | ||
task_run_states, | ||
task_runs, | ||
task_workers, | ||
variables, | ||
work_queues, | ||
workers, | ||
|
Oops, something went wrong.