mirror of
https://github.com/vale981/ray
synced 2025-03-13 22:56:38 -04:00
28 lines
325 B
Python
28 lines
325 B
Python
![]() |
import ray
|
||
|
|
||
|
|
||
|
ray.init()
|
||
|
|
||
|
|
||
|
@ray.remote
|
||
|
def f(a: int) -> str:
|
||
|
return "a = {}".format(a + 1)
|
||
|
|
||
|
|
||
|
@ray.remote
|
||
|
def g(s: str) -> str:
|
||
|
return s + " world"
|
||
|
|
||
|
|
||
|
@ray.remote
|
||
|
def h(a: str, b: int) -> str:
|
||
|
return a
|
||
|
|
||
|
|
||
|
print(f.remote(1))
|
||
|
x = f.remote(1)
|
||
|
print(g.remote(x))
|
||
|
|
||
|
# typechecks but doesn't run
|
||
|
print(ray.get(f.remote(x)))
|