Skip to content

Commit

Permalink
Add /actors/deployment-to-actors route
Browse files Browse the repository at this point in the history
  • Loading branch information
albireox committed Dec 29, 2024
1 parent 41f5583 commit 4d5636b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

### 🚀 New

* Add `/actors/actor-to-deployment` route.
* Add `/actors/actor-to-deployment` and `/actors/deployment-to-actors` routes.

### 🔧 Fixed

Expand Down
15 changes: 15 additions & 0 deletions src/lvmapi/routers/actors.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,21 @@ async def get_actor_to_deployment_route() -> dict[str, str]:
return config["actors.actor_to_deployment"]


@router.get("/deployment-to-actors", summary="Get deployment to actors mapping")
async def get_deployment_to_actors_route() -> dict[str, list[str]]:
"""Returns the deployment to actors mapping."""

actor_to_deployment = config["actors.actor_to_deployment"]

deployment_to_actors = {}
for actor, deployment in actor_to_deployment.items():
if deployment not in deployment_to_actors:
deployment_to_actors[deployment] = []
deployment_to_actors[deployment].append(actor)

return deployment_to_actors


@router.get("/ping", summary="Actor ping")
async def get_ping_route(actors: list[str] | None = None) -> dict[str, bool]:
"""Pings a list of actors."""
Expand Down

0 comments on commit 4d5636b

Please sign in to comment.