Treat static methods as class methods instead of instance methods in actors (#6756)

* Treat static methods as class methods rather than instance methods

* Add tests for static methods in actors

* Revert formatting changes

* Readd future imports

* Restructure static method check

* Documentation enhancements

* Fix linting issues
This commit is contained in:
Ziyad Edher
2020-01-15 20:38:41 -05:00
committed by Edward Oakes
parent 2e972e725a
commit c480d1d1e4
4 changed files with 76 additions and 2 deletions
+4 -1
View File
@@ -21,6 +21,7 @@ from ray.utils import (
binary_to_hex,
is_function_or_method,
is_class_method,
is_static_method,
check_oversized_pickle,
decode,
ensure_str,
@@ -753,7 +754,9 @@ class FunctionActorManager:
# Execute the assigned method and save a checkpoint if necessary.
try:
if is_class_method(method):
is_bound = (is_class_method(method)
or is_static_method(type(actor), method_name))
if is_bound:
method_returns = method(*args, **kwargs)
else:
method_returns = method(actor, *args, **kwargs)