[ray_client] actors v0 (#12388)

This commit is contained in:
Barak Michener
2020-12-01 13:12:08 -08:00
committed by GitHub
parent 0e892908f7
commit 6412dfaf38
15 changed files with 421 additions and 210 deletions
+9 -5
View File
@@ -12,6 +12,11 @@ from ray.util.placement_group import (
from ray import ActorClassID, Language
from ray._raylet import PythonFunctionDescriptor
from ray import cross_language
from ray.util.inspect import (
is_function_or_method,
is_class_method,
is_static_method,
)
logger = logging.getLogger(__name__)
@@ -195,7 +200,7 @@ class ActorClassMethodMetadata(object):
self = cls.__new__(cls)
actor_methods = inspect.getmembers(modified_class,
ray.utils.is_function_or_method)
is_function_or_method)
self.methods = dict(actor_methods)
# Extract the signatures of each of the methods. This will be used
@@ -208,9 +213,8 @@ class ActorClassMethodMetadata(object):
# Whether or not this method requires binding of its first
# argument. For class and static methods, we do not want to bind
# the first argument, but we do for instance methods
is_bound = (ray.utils.is_class_method(method)
or ray.utils.is_static_method(modified_class,
method_name))
is_bound = (is_class_method(method)
or is_static_method(modified_class, method_name))
# Print a warning message if the method signature is not
# supported. We don't raise an exception because if the actor
@@ -956,7 +960,7 @@ def modify_class(cls):
Class.__module__ = cls.__module__
Class.__name__ = cls.__name__
if not ray.utils.is_function_or_method(getattr(Class, "__init__", None)):
if not is_function_or_method(getattr(Class, "__init__", None)):
# Add __init__ if it does not exist.
# Actor creation will be executed with __init__ together.