mirror of
https://github.com/wassname/ray.git
synced 2026-08-09 12:20:09 +08:00
Add back some tests for xray. (#2772)
This commit is contained in:
committed by
Philipp Moritz
parent
9f06c19edd
commit
32f7d6fcf5
+12
-7
@@ -1675,25 +1675,30 @@ class ResourcesTest(unittest.TestCase):
|
||||
ray.get(a1.test.remote())
|
||||
|
||||
@unittest.skipIf(
|
||||
os.environ.get("RAY_USE_XRAY") == "1",
|
||||
"This test does not work with xray yet.")
|
||||
os.environ.get("RAY_USE_XRAY") != "1",
|
||||
"This test only works with xray.")
|
||||
def testZeroCPUs(self):
|
||||
ray.init(num_cpus=0)
|
||||
|
||||
@ray.remote(num_cpus=0)
|
||||
def f():
|
||||
return 1
|
||||
|
||||
# The task should be able to execute.
|
||||
ray.get(f.remote())
|
||||
|
||||
def testZeroCPUsActor(self):
|
||||
ray.worker._init(
|
||||
start_ray_local=True, num_local_schedulers=2, num_cpus=[0, 2])
|
||||
|
||||
local_plasma = ray.worker.global_worker.plasma_client.store_socket_name
|
||||
|
||||
@ray.remote(num_cpus=0)
|
||||
def f():
|
||||
return ray.worker.global_worker.plasma_client.store_socket_name
|
||||
|
||||
@ray.remote
|
||||
class Foo(object):
|
||||
def method(self):
|
||||
return ray.worker.global_worker.plasma_client.store_socket_name
|
||||
|
||||
# Make sure tasks and actors run on the remote local scheduler.
|
||||
assert ray.get(f.remote()) != local_plasma
|
||||
a = Foo.remote()
|
||||
assert ray.get(a.method.remote()) != local_plasma
|
||||
|
||||
|
||||
Reference in New Issue
Block a user