How do I access “attributes” that have been generated via @property decorator? This is a very simple example below but I routinely use @property on “attribute-esque” variables that do not perform a function.
Does not work (if you remove @property from greeting works fine).
import ray
@ray.remote
class Child(object):
def __init__(self):
from faker import Faker
self.name = Faker().name()
self.age = 1
def grow(self):
self.age += 1
return self.age
@property
def greeting(self):
return (
f'My name is {self.name} '
f'and I am {self.age} years old'
)
if __name__ == '__main__':
children = [Child.remote() for i in range(10)]
print(children)
futures = [c.greeting.remote() for c in children]
print(futures)
for future in ray.get(futures):
print(future)