Implement named actors using the GCS service (#8328)

This commit is contained in:
Edward Oakes
2020-05-09 08:58:10 -05:00
committed by GitHub
parent 93138e617a
commit 2677b71003
37 changed files with 483 additions and 87 deletions
+11 -5
View File
@@ -26,11 +26,17 @@ def get_actor(name):
Returns:
The ActorHandle object corresponding to the name.
"""
actor_name = _calculate_key(name)
pickled_state = _internal_kv_get(actor_name)
if pickled_state is None:
raise ValueError("The actor with name={} doesn't exist".format(name))
handle = pickle.loads(pickled_state)
if ray._raylet.gcs_actor_service_enabled():
worker = ray.worker.global_worker
handle = worker.core_worker.get_named_actor_handle(name)
else:
actor_name = _calculate_key(name)
pickled_state = _internal_kv_get(actor_name)
if pickled_state is None:
raise ValueError(
"The actor with name={} doesn't exist".format(name))
handle = pickle.loads(pickled_state)
return handle