dask / dask/distributed

Get actor from other client having it's id

Open
#4,333 0 comments 2 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.7k
Forks
778
Avg merge
2h 50m
Merged PRs (30d)
3

Description

Hello everyone, this is my first Feature Request in open source!

I'm using dask as an execution environment but with a twist. Instead of creating dockers with small python services, I decided to try to use Actors with my python code. (I know that Actors have a lot of limitations, ¿should I be using Ray for this?)

For this usecase I sometimes need to check if there is an Actor running in the dask cluster that already solves some purpose.

For example, I need a "telegram bot class" with "bot A" configuration running (created from dask client A (I'll need a lot of bots like services)).

I'm able to do it already from the same client, creating an Actor and comunicating with it using the ActorFuture that points to it.

**But** if for some reason I need to find if "bot A" (from dask client B) is in the cluster (created by dask client A), the task becomes a bit harder.

Right now, I've this solution:

**Client B knows the key of the "Actor A" created from Client A**
```
from dask.distributed import Client
from distributed.utils_comm import gather_from_workers
from distributed.core import coerce_to_address

client = Client(..., asynchronous=True)
# The rest of the code is run inside an async method
key = "Test-5f024dd7-4fe8-460d-8153-35dcf89c7ba4"
key_locations = await client.scheduler.who_has(keys=[key])
who_has = {
k: [coerce_to_address(addr) for addr in v]
for k, v in key_locations.items()
}
actor_data = await gather_from_workers(who_has, rpc=client.rpc, who=key_locations[key][0])
actor_future = actor_link_data[0][key]
```

I think that this vervose part could be inserted inside the client itself.

For example:
`client.get_actor(key)`

What do you think?

It would make more sense if the Actors had an option to keep them alive, like in ray https://docs.ray.io/en/master/actors.html#actor-lifetimes

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.