17 lines
263 B
Python
17 lines
263 B
Python
from ray import ray
|
|
|
|
ray.connect("localhost:50050")
|
|
|
|
@ray.remote
|
|
def plus2(x):
|
|
return x + 2
|
|
|
|
print(ray.get(plus2.remote(4)))
|
|
|
|
@ray.remote
|
|
def fact(x):
|
|
if x <= 0:
|
|
return 1
|
|
return x * ray.get(fact.remote(x - 1))
|
|
|
|
print(ray.get(fact.remote(20)))
|