forked from ray-project/ray
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Serve] Enable serve metrics lib working in ray actor (ray-project#33717
) Make sure ray.serve.lib working with ray.actor without serve context. ``` @ray.remote class MyActor: def __init__(self): self.my_counter = metrics.Counter( "my_ray_actor", description=("The number of requests to this deployment."), tag_keys=("my_tag",), ) def test(self): self.my_counter.inc(tags={"my_tag": "value"}) return "hello" @serve.deployment(num_replicas=2) class Model: def __init__(self, model_name): self.my_actor = MyActor.remote() async def __call__(self, req: starlette.requests.Request): await self.my_actor.test.remote() return ``` Signed-off-by: Jack He <[email protected]>
- Loading branch information
1 parent
f313f1f
commit 45df7d6
Showing
2 changed files
with
118 additions
and
0 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
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