Fix bug in which actor classes are not exported multiple times. (#4838)

This commit is contained in:
Robert Nishihara
2019-05-23 09:22:46 -07:00
committed by GitHub
parent 1a39fee9c6
commit 2015085192
3 changed files with 39 additions and 6 deletions
+26
View File
@@ -2942,3 +2942,29 @@ def test_get_postprocess(ray_start_regular):
assert ray.get(
[ray.put(i) for i in [0, 1, 3, 5, -1, -3, 4]]) == [1, 3, 5, 4]
def test_export_after_shutdown(ray_start_regular):
# This test checks that we can use actor and remote function definitions
# across multiple Ray sessions.
@ray.remote
def f():
pass
@ray.remote
class Actor(object):
def method(self):
pass
ray.get(f.remote())
a = Actor.remote()
ray.get(a.method.remote())
ray.shutdown()
# Start Ray and use the remote function and actor again.
ray.init(num_cpus=1)
ray.get(f.remote())
a = Actor.remote()
ray.get(a.method.remote())