-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Make ActorHandles pickleable, also make proper ActorHandle and ActorC… #2007
Make ActorHandles pickleable, also make proper ActorHandle and ActorC… #2007
Conversation
# Record that this actor has been removed so that if this node | ||
# dies later, the actor won't be recreated. Alternatively, we could | ||
# remove the actor key from Redis here. | ||
ray.worker.global_worker.redis_client.hset(b"Actor:" + actor_id, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this key in Redis used anywhere?
Test FAILed. |
Test FAILed. |
Test FAILed. |
Test FAILed. |
Test PASSed. |
Test PASSed. |
python/ray/actor.py
Outdated
} | ||
|
||
if ray_forking: | ||
state["forked_actor_handle_id"] = compute_actor_handle_id( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm using this method to compute actor handle IDs for "forked" actor handles. However, if a user pickles and unpickles the actor handle, then I'm generating the actor handle ID randomly.
Test PASSed. |
Maybe the right way to do actor handle ID generation (for pickled handles) is the following. Suppose we have actor_handle = Actor.remote()
# Defining this remote function, which closes over actor_handle, will
# cause actor_handle to be pickled. The remote function will be broadcast
# to all the workers and unpickled there.
@ray.remote
def f():
actor_handle.method.remote()
f.remote() Instead of generating a random actor handle ID on each worker when the remote function is broadcast, maybe we should instead leave the actor handle in an "uninitialized" state, and then whenever a |
@robertnishihara, I like this suggestion. Just to clarify, what is the use case for closing over the actor handle vs. passing the actor handle into the |
@stephanie-wang one use case is that you want to use the actor handle on a different driver (e.g., "named actors". Another use case, I think, in RLlib/Tune is that certain user-defined functions have to have pre-specified signatures and the user isn't really able to just pass in an actor handle because that would require changing the signature and piping it through a bunch of RLlib abstractions, but they can define a function that just closes over the actor handle. |
Test PASSed. |
* master: (25 commits) [DataFrame] Add direct pandas imports for MVP (ray-project#1960) Make ActorHandles pickleable, also make proper ActorHandle and ActorC… (ray-project#2007) Expand local_dir in Trial init (ray-project#2013) Fixing ascii error for Python2 (ray-project#2009) [DataFrame] Implements df.update (ray-project#1997) [DataFrame] Implements df.as_matrix (ray-project#2001) [DataFrame] Implement quantile (ray-project#1992) [DataFrame] Impement sort_values and sort_index (ray-project#1977) [DataFrame] Implement rank (ray-project#1991) [DataFrame] Implemented prod, product, added test suite (ray-project#1994) [DataFrame] Implemented __setitem__, select_dtypes, and astype (ray-project#1941) [DataFrame] Implement diff (ray-project#1996) [DataFrame] Implemented nunique, skew (ray-project#1995) [DataFrame] Implements filter and dropna (ray-project#1959) [DataFrame] Implements df.pipe (ray-project#1999) [DataFrame] Apply() for Lists and Dicts (ray-project#1973) Clean up syntax for supported Python versions. (ray-project#1963) [DataFrame] Implements mode, to_datetime, and get_dummies (ray-project#1956) [DataFrame] Fix dtypes (ray-project#1930) keep_dims -> keepdims (ray-project#1980) ...
* master: [DataFrame] Add direct pandas imports for MVP (ray-project#1960) Make ActorHandles pickleable, also make proper ActorHandle and ActorC… (ray-project#2007) Expand local_dir in Trial init (ray-project#2013) Fixing ascii error for Python2 (ray-project#2009) [DataFrame] Implements df.update (ray-project#1997) [DataFrame] Implements df.as_matrix (ray-project#2001) [DataFrame] Implement quantile (ray-project#1992) [DataFrame] Impement sort_values and sort_index (ray-project#1977) [DataFrame] Implement rank (ray-project#1991) [DataFrame] Implemented prod, product, added test suite (ray-project#1994) [DataFrame] Implemented __setitem__, select_dtypes, and astype (ray-project#1941) [DataFrame] Implement diff (ray-project#1996) [DataFrame] Implemented nunique, skew (ray-project#1995) [DataFrame] Implements filter and dropna (ray-project#1959) [DataFrame] Implements df.pipe (ray-project#1999) [DataFrame] Apply() for Lists and Dicts (ray-project#1973)
* master: [DataFrame] Implement where (ray-project#1989) [DataFrame] Add direct pandas imports for MVP (ray-project#1960) Make ActorHandles pickleable, also make proper ActorHandle and ActorC… (ray-project#2007)
…lass classes.
This is intended to cleanup some of the Python actor code.
Note that should enable named actors via #1424 (comment).