mirror of
https://github.com/wassname/ray.git
synced 2026-09-10 12:38:43 +08:00
[Core] Type check ObjectRef (#9856)
* Type check ObjectRef * Bug fix * Port typing tests to bazel test
This commit is contained in:
@@ -1,25 +0,0 @@
|
||||
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
|
||||
|
||||
|
||||
# Does not typecheck:
|
||||
a = h.remote(1, 1)
|
||||
b = f.remote("hello")
|
||||
c = f.remote(1, 1)
|
||||
d = f.remote(1) + 1
|
||||
@@ -1,26 +0,0 @@
|
||||
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)))
|
||||
Reference in New Issue
Block a user