mirror of
https://github.com/wassname/ray.git
synced 2026-07-01 02:49:33 +08:00
[xlang] Cross language serialize ActorHandle (#7134)
This commit is contained in:
@@ -206,7 +206,8 @@ cdef class PythonFunctionDescriptor(FunctionDescriptor):
|
||||
"""
|
||||
module_name = target_class.__module__
|
||||
class_name = target_class.__name__
|
||||
return cls(module_name, "__init__", class_name)
|
||||
# Use id(targe_class) as function hash to solve actor name conflict.
|
||||
return cls(module_name, "__init__", class_name, str(id(target_class)))
|
||||
|
||||
@property
|
||||
def module_name(self):
|
||||
|
||||
@@ -33,6 +33,9 @@ from ray.includes.common cimport (
|
||||
CLanguage,
|
||||
CGcsClientOptions,
|
||||
)
|
||||
from ray.includes.function_descriptor cimport (
|
||||
CFunctionDescriptor,
|
||||
)
|
||||
from ray.includes.task cimport CTaskSpec
|
||||
|
||||
ctypedef unordered_map[c_string, c_vector[pair[int64_t, double]]] \
|
||||
@@ -66,6 +69,14 @@ cdef extern from "ray/core_worker/context.h" nogil:
|
||||
c_bool CurrentActorIsAsync()
|
||||
|
||||
cdef extern from "ray/core_worker/core_worker.h" nogil:
|
||||
cdef cppclass CActorHandle "ray::ActorHandle":
|
||||
CActorID GetActorID() const
|
||||
CJobID CreationJobID() const
|
||||
CLanguage ActorLanguage() const
|
||||
CFunctionDescriptor ActorCreationTaskFunctionDescriptor() const
|
||||
c_bool IsDirectCallActor() const
|
||||
c_string ExtensionData() const
|
||||
|
||||
cdef cppclass CCoreWorker "ray::CoreWorker":
|
||||
CCoreWorker(const CWorkerType worker_type, const CLanguage language,
|
||||
const c_string &store_socket,
|
||||
@@ -95,7 +106,8 @@ cdef extern from "ray/core_worker/core_worker.h" nogil:
|
||||
int max_retries)
|
||||
CRayStatus CreateActor(
|
||||
const CRayFunction &function, const c_vector[CTaskArg] &args,
|
||||
const CActorCreationOptions &options, CActorID *actor_id)
|
||||
const CActorCreationOptions &options,
|
||||
const c_string &extension_data, CActorID *actor_id)
|
||||
CRayStatus SubmitActorTask(
|
||||
const CActorID &actor_id, const CRayFunction &function,
|
||||
const c_vector[CTaskArg] &args, const CTaskOptions &options,
|
||||
@@ -121,6 +133,8 @@ cdef extern from "ray/core_worker/core_worker.h" nogil:
|
||||
CActorID DeserializeAndRegisterActorHandle(const c_string &bytes)
|
||||
CRayStatus SerializeActorHandle(const CActorID &actor_id, c_string
|
||||
*bytes)
|
||||
CRayStatus GetActorHandle(const CActorID &actor_id,
|
||||
CActorHandle **actor_handle) const
|
||||
void AddLocalReference(const CObjectID &object_id)
|
||||
void RemoveLocalReference(const CObjectID &object_id)
|
||||
void PromoteObjectToPlasma(const CObjectID &object_id)
|
||||
|
||||
Reference in New Issue
Block a user