Skip to content

Instantly share code, notes, and snippets.

Created February 11, 2019 04:19
What would you like to do?
class Counter(object):
def __init__(self):
self.x = 0
def inc(self):
self.x += 1
def get_value(self):
return self.x
# Create an actor process.
c = Counter.remote()
# Check the actor's counter value.
print(ray.get(c.get_value.remote())) # 0
# Increment the counter twice and check the value again.
print(ray.get(c.get_value.remote())) # 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment