mirror of
https://github.com/wassname/ray.git
synced 2026-08-04 13:14:14 +08:00
Implement named actors using the GCS service (#8328)
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user