importrayray.init()# Define the Counter actor.
@ray.remoteclassCounter:def__init__(self):self.i=0defget(self):returnself.idefincr(self,value):self.i+=value# Create a Counter actor.
c=Counter.remote()# Submit calls to the actor. These calls run asynchronously but in
# submission order on the remote actor process.
for_inrange(10):c.incr.remote(1)# Retrieve final actor state.
print(ray.get(c.get.remote()))# -> 10