How can I get attribute of a actor

How severe does this issue affect your experience of using Ray?

  • Medium: It contributes to significant difficulty to complete my task, but I can work around it.

For example, I have an x in class A, and class A is a ray actor. Here is the code.

@ray.remote
class A:
  def __init__(self):
    self.x=10
a=A.remote()

How can I get x without adding extra functions? a.x seems not good.
And I try ray.get(a).x and ray.get(a.x). Those also failed.

You cannot. You need to add a getter function to do that.

1 Like