mirror of
https://github.com/wassname/ray.git
synced 2026-08-16 11:27:09 +08:00
Remove actor handle IDs (#5889)
* Remove actor handle ID from main ActorHandle constructor * Set the actor caller ID when calling submit task instead of in the actor handle * Remove ActorHandle::Fork, remove actor handle ID from protobuf * Make inner actor handle const, remove new_actor_handles * Move caller ID into the common task spec, start refactoring raylet * Some fixes for forking actor handles * Store ActorHandle state in CoreWorker, only expose actor ID to Python * Remove some unused fields * lint * doc * fix merge * Remove ActorHandleID from python/cpp * doc * Fix core worker test * Move actor table subscription to CoreWorker, reset actor handles on actor failure * lint * Remove GCS client from direct actor * fix tests * Fix * Fix tests for raylet codepath * Fix local mode * Fix multithreaded test * Fix AsyncSubscribe issue... * doc * fix serve * Revert bazel
This commit is contained in:
@@ -3,7 +3,6 @@ from libcpp.string cimport string as c_string
|
||||
from libcpp.vector cimport vector as c_vector
|
||||
|
||||
from ray.includes.common cimport (
|
||||
CActorHandle,
|
||||
CGcsClientOptions,
|
||||
)
|
||||
|
||||
@@ -25,48 +24,3 @@ cdef class GcsClientOptions:
|
||||
|
||||
cdef CGcsClientOptions* native(self):
|
||||
return <CGcsClientOptions*>(self.inner.get())
|
||||
|
||||
cdef class ActorHandle:
|
||||
"""Cython wrapper class of C++ `ray::ActorHandle`."""
|
||||
cdef:
|
||||
unique_ptr[CActorHandle] inner
|
||||
|
||||
def __init__(self, ActorID actor_id, ActorHandleID actor_handle_id,
|
||||
JobID job_id, list creation_function_descriptor):
|
||||
cdef:
|
||||
c_vector[c_string] c_descriptor
|
||||
ObjectID cursor = ObjectID.from_random()
|
||||
|
||||
c_descriptor = string_vector_from_list(creation_function_descriptor)
|
||||
self.inner.reset(new CActorHandle(
|
||||
actor_id.native(), actor_handle_id.native(), job_id.native(),
|
||||
cursor.native(), LANGUAGE_PYTHON, False, c_descriptor))
|
||||
|
||||
def fork(self, c_bool ray_forking):
|
||||
cdef:
|
||||
ActorHandle other = ActorHandle.__new__(ActorHandle)
|
||||
if ray_forking:
|
||||
other.inner = self.inner.get().Fork()
|
||||
else:
|
||||
other.inner = self.inner.get().ForkForSerialization()
|
||||
return other
|
||||
|
||||
@staticmethod
|
||||
def from_bytes(c_string bytes, TaskID current_task_id):
|
||||
cdef:
|
||||
ActorHandle self = ActorHandle.__new__(ActorHandle)
|
||||
self.inner.reset(new CActorHandle(bytes, current_task_id.native()))
|
||||
return self
|
||||
|
||||
def to_bytes(self):
|
||||
cdef:
|
||||
c_string output
|
||||
|
||||
self.inner.get().Serialize(&output)
|
||||
return output
|
||||
|
||||
def actor_id(self):
|
||||
return ActorID(self.inner.get().GetActorID().Binary())
|
||||
|
||||
def actor_handle_id(self):
|
||||
return ActorHandleID(self.inner.get().GetActorHandleID().Binary())
|
||||
|
||||
Reference in New Issue
Block a user