Add ability to specify worker and driver ports (#8071)

This commit is contained in:
Edward Oakes
2020-05-20 15:31:13 -05:00
committed by GitHub
parent d76578700d
commit a76434ccde
25 changed files with 408 additions and 143 deletions
+4 -1
View File
@@ -153,7 +153,10 @@ def ray_start_object_store_memory(request):
@pytest.fixture
def call_ray_start(request):
parameter = getattr(request, "param", "ray start --head --num-cpus=1")
parameter = getattr(
request, "param",
"ray start --head --num-cpus=1 --min-worker-port=0 --max-worker-port=0"
)
command_args = parameter.split(" ")
out = ray.utils.decode(
subprocess.check_output(command_args, stderr=subprocess.STDOUT))
+4 -2
View File
@@ -43,8 +43,10 @@ def test_dynamic_res_deletion(shutdown_only):
available_res = ray.available_resources()
cluster_res = ray.cluster_resources()
assert res_name not in available_res
assert res_name not in cluster_res
def check_resources():
return res_name not in available_res and res_name not in cluster_res
ray.test_utils.wait_for_condition(check_resources)
def test_dynamic_res_infeasible_rescheduling(ray_start_regular):
+14 -3
View File
@@ -285,7 +285,10 @@ ray.get([a.log.remote(), f.remote()])
@pytest.mark.parametrize(
"call_ray_start", ["ray start --head --num-cpus=1 --num-gpus=1"],
"call_ray_start", [
"ray start --head --num-cpus=1 --num-gpus=1 " +
"--min-worker-port=0 --max-worker-port=0"
],
indirect=True)
def test_drivers_release_resources(call_ray_start):
address = call_ray_start
@@ -334,6 +337,7 @@ print("success")
print(output_line)
if output_line == "success":
return
time.sleep(1)
raise RayTestTimeoutException(
"Timed out waiting for process to print success.")
@@ -376,6 +380,13 @@ def test_calling_start_ray_head(call_ray_stop_only):
])
subprocess.check_output(["ray", "stop"])
# Test starting Ray with the worker port range specified.
subprocess.check_output([
"ray", "start", "--head", "--min-worker-port", "50000",
"--max-worker-port", "51000"
])
subprocess.check_output(["ray", "stop"])
# Test starting Ray with the number of CPUs specified.
subprocess.check_output(["ray", "start", "--head", "--num-cpus", "2"])
subprocess.check_output(["ray", "stop"])
@@ -419,7 +430,7 @@ def test_calling_start_ray_head(call_ray_stop_only):
assert blocked.returncode is None
kill_process_by_name("raylet")
wait_for_children_of_pid_to_exit(blocked.pid, timeout=120)
wait_for_children_of_pid_to_exit(blocked.pid, timeout=30)
blocked.wait()
assert blocked.returncode != 0, "ray start shouldn't return 0 on bad exit"
@@ -431,7 +442,7 @@ def test_calling_start_ray_head(call_ray_stop_only):
wait_for_children_of_pid(blocked.pid, num_children=7, timeout=30)
blocked.terminate()
wait_for_children_of_pid_to_exit(blocked.pid, timeout=120)
wait_for_children_of_pid_to_exit(blocked.pid, timeout=30)
blocked.wait()
assert blocked.returncode != 0, "ray start shouldn't return 0 on bad exit"