Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core] Add __ray_call__ default actor method #41534

Merged
merged 6 commits into from
Dec 1, 2023
Merged

Conversation

ericl
Copy link
Contributor

@ericl ericl commented Nov 30, 2023

Why are these changes needed?

Similar to __ray_ready__, this adds a developer method __ray_call__(fn, *a, **kw) that can be used by library developers to run custom closures on actors.

For example, a common use case for an actor is to "get its current node id". Without this method, a library developer would have to tell users to add a special get_node_id method to their actor. With this new API, the library developer can instead run:

def fn(actor_self):
   return ray.get_runtime_context().get_node_id()

ray.get(actor.__ray_call__.remote(fn))

Signed-off-by: Eric Liang <ekhliang@gmail.com>
@ericl ericl merged commit b8f0fbb into ray-project:master Dec 1, 2023
11 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants