mirror of
https://github.com/wassname/ray.git
synced 2026-07-26 13:37:24 +08:00
Use subprocess.check_output in tests (#5465)
This commit is contained in:
committed by
Robert Nishihara
parent
c7ae4e5e1f
commit
0440c00019
@@ -10,18 +10,19 @@ import time
|
||||
|
||||
import ray
|
||||
|
||||
from ray.tests.utils import run_and_get_output
|
||||
|
||||
|
||||
def _test_cleanup_on_driver_exit(num_redis_shards):
|
||||
stdout = run_and_get_output([
|
||||
"ray",
|
||||
"start",
|
||||
"--head",
|
||||
"--num-redis-shards",
|
||||
str(num_redis_shards),
|
||||
])
|
||||
lines = [m.strip() for m in stdout.split("\n")]
|
||||
output = ray.utils.decode(
|
||||
subprocess.check_output(
|
||||
[
|
||||
"ray",
|
||||
"start",
|
||||
"--head",
|
||||
"--num-redis-shards",
|
||||
str(num_redis_shards),
|
||||
],
|
||||
stderr=subprocess.STDOUT))
|
||||
lines = [m.strip() for m in output.split("\n")]
|
||||
init_cmd = [m for m in lines if m.startswith("ray.init")]
|
||||
assert 1 == len(init_cmd)
|
||||
redis_address = init_cmd[0].split("redis_address=\"")[-1][:-2]
|
||||
@@ -90,7 +91,7 @@ def _test_cleanup_on_driver_exit(num_redis_shards):
|
||||
assert (0, 1) == StateSummary()
|
||||
|
||||
ray.shutdown()
|
||||
subprocess.Popen(["ray", "stop"]).wait()
|
||||
subprocess.check_output(["ray", "stop"])
|
||||
|
||||
|
||||
@pytest.mark.skipif(
|
||||
|
||||
Reference in New Issue
Block a user