-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Open
Labels
P1Issue that should be fixed within a few weeksIssue that should be fixed within a few weekscoreIssues that should be addressed in Ray CoreIssues that should be addressed in Ray Corecore-apienhancementRequest for new feature and/or capabilityRequest for new feature and/or capability
Description
Description
Please support calls to classmethods of actors. Currently this
import ray
class Foo:
def __init__(self, x):
self.x = x
def run(self):
pass
@classmethod
def main(cls, x):
main_instance = cls(x)
return main_instance.run()
@ray.remote
class Bar(Foo):
def run(self):
return self.x
ray.init()
x = ray.get(Bar.main.remote(1))
print(x)
fails with
Traceback (most recent call last):
File "...", line 23, in <module>
x = ray.get(Bar.main.remote(1))
AttributeError: 'function' object has no attribute 'remote'
I would expect to see the output
1
Use case
classmethods are useful concepts and are used all over the place. For example, they are a great way to overload the __init__
by implementing several from_<whatever>(data: whatever)
classmethods.
Metadata
Metadata
Assignees
Labels
P1Issue that should be fixed within a few weeksIssue that should be fixed within a few weekscoreIssues that should be addressed in Ray CoreIssues that should be addressed in Ray Corecore-apienhancementRequest for new feature and/or capabilityRequest for new feature and/or capability