Add some better balancing, reconnection

This commit is contained in:
Barak Michener 2020-12-04 22:40:50 -08:00
parent 715f79c9c0
commit 324ba0d160
6 changed files with 77 additions and 29 deletions

View file

@ -1,6 +1,7 @@
from ray import ray
import sys
ray.connect("localhost:50050")
ray.connect(sys.argv[1])
@ray.remote
def plus2(x):
@ -14,4 +15,17 @@ def fact(x):
return 1
return x * ray.get(fact.remote(x - 1))
print(ray.get(fact.remote(20)))
#print(ray.get(fact.remote(20)))
@ray.remote
def sleeper(x):
import time
time.sleep(1)
return x * 2
holder = []
for i in range(20):
holder.append(sleeper.remote(i))
print([ray.get(x) for x in holder])