mirror of
https://github.com/wassname/ray.git
synced 2026-08-09 12:20:09 +08:00
Add basic functionality for Cython functions and actors (#1193)
* Add basic functionality for Cython functions and actors * Fix up per @pcmoritz comments * Fixes per @richardliaw comments * Fixes per @robertnishihara comments * Forgot double quotes when updating masked_log * Remove import typing for Python 2 compatibility
This commit is contained in:
committed by
Philipp Moritz
parent
11f8f8bd8c
commit
4f0da6f81c
+5
-3
@@ -15,7 +15,7 @@ import ray.local_scheduler
|
||||
import ray.signature as signature
|
||||
import ray.worker
|
||||
from ray.utils import (binary_to_hex, FunctionProperties, random_string,
|
||||
release_gpus_in_use, select_local_scheduler)
|
||||
release_gpus_in_use, select_local_scheduler, is_cython)
|
||||
|
||||
|
||||
def random_actor_id():
|
||||
@@ -261,7 +261,8 @@ def fetch_and_register_actor(actor_class_key, worker):
|
||||
worker.actors[actor_id_str] = unpickled_class.__new__(unpickled_class)
|
||||
actor_methods = inspect.getmembers(
|
||||
unpickled_class, predicate=(lambda x: (inspect.isfunction(x) or
|
||||
inspect.ismethod(x))))
|
||||
inspect.ismethod(x) or
|
||||
is_cython(x))))
|
||||
for actor_method_name, actor_method in actor_methods:
|
||||
function_id = compute_actor_method_function_id(
|
||||
class_name, actor_method_name).id()
|
||||
@@ -682,7 +683,8 @@ def actor_handle_from_class(Class, class_id, num_cpus, num_gpus,
|
||||
# Get the actor methods of the given class.
|
||||
actor_methods = inspect.getmembers(
|
||||
Class, predicate=(lambda x: (inspect.isfunction(x) or
|
||||
inspect.ismethod(x))))
|
||||
inspect.ismethod(x) or
|
||||
is_cython(x))))
|
||||
# Extract the signatures of each of the methods. This will be used
|
||||
# to catch some errors if the methods are called with inappropriate
|
||||
# arguments.
|
||||
|
||||
Reference in New Issue
Block a user