Fix more Windows issues (#9011)

Co-authored-by: Mehrdad <noreply@github.com>
This commit is contained in:
mehrdadn
2020-06-19 18:51:45 -07:00
committed by GitHub
parent f8d49d69c1
commit 981f67bfb0
11 changed files with 61 additions and 59 deletions
+2 -1
View File
@@ -214,7 +214,8 @@ def test_worker_replica_failure(serve_instance):
def __call__(self):
pass
temp_path = tempfile.gettempdir() + "/" + serve.utils.get_random_letters()
temp_path = os.path.join(tempfile.gettempdir(),
serve.utils.get_random_letters())
serve.create_backend("replica_failure", Worker, temp_path)
serve.update_backend_config("replica_failure", {"num_replicas": 2})
serve.create_endpoint(
+3 -3
View File
@@ -1,8 +1,8 @@
SRCS = [] + select({
"@bazel_tools//src/conditions:windows": [
"@bazel_tools//src/conditions:windows": glob([
# TODO(mehrdadn): This should be added for all platforms once resulting errors are fixed
"conftest.py",
],
"**/conftest.py",
]),
"//conditions:default": [],
})
+2 -2
View File
@@ -182,13 +182,13 @@ def call_ray_start(request):
# Disconnect from the Ray cluster.
ray.shutdown()
# Kill the Ray cluster.
subprocess.check_output(["ray", "stop"])
subprocess.check_call(["ray", "stop"])
@pytest.fixture
def call_ray_stop_only():
yield
subprocess.check_output(["ray", "stop"])
subprocess.check_call(["ray", "stop"])
@pytest.fixture()
+1 -1
View File
@@ -306,7 +306,7 @@ class AutoscalingTest(unittest.TestCase):
return self.provider
def write_config(self, config):
path = self.tmpdir + "/simple.yaml"
path = os.path.join(self.tmpdir, "simple.yaml")
with open(path, "w") as f:
f.write(yaml.dump(config))
return path
+4 -3
View File
@@ -8,12 +8,12 @@ import tempfile
from ray.autoscaler.util import prepare_config, validate_config
from ray.test_utils import recursive_fnmatch
RAY_PATH = os.path.abspath(os.path.join(__file__, "../../"))
RAY_PATH = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
CONFIG_PATHS = recursive_fnmatch(
os.path.join(RAY_PATH, "autoscaler"), "*.yaml")
CONFIG_PATHS += recursive_fnmatch(
os.path.join(RAY_PATH, "tune/examples/"), "*.yaml")
os.path.join(RAY_PATH, "tune", "examples"), "*.yaml")
class AutoscalingConfigTest(unittest.TestCase):
@@ -52,7 +52,8 @@ class AutoscalingConfigTest(unittest.TestCase):
pass
def testInvalidConfig(self):
self._test_invalid_config("tests/additional_property.yaml")
self._test_invalid_config(
os.path.join("tests", "additional_property.yaml"))
if __name__ == "__main__":
+22 -22
View File
@@ -359,66 +359,66 @@ def test_calling_start_ray_head(call_ray_stop_only):
# should also test the non-head node code path.
# Test starting Ray with no arguments.
subprocess.check_output(["ray", "start", "--head"])
subprocess.check_output(["ray", "stop"])
subprocess.check_call(["ray", "start", "--head"])
subprocess.check_call(["ray", "stop"])
# Test starting Ray with a redis port specified.
subprocess.check_output(["ray", "start", "--head"])
subprocess.check_output(["ray", "stop"])
subprocess.check_call(["ray", "start", "--head"])
subprocess.check_call(["ray", "stop"])
# Test starting Ray with a node IP address specified.
subprocess.check_output(
subprocess.check_call(
["ray", "start", "--head", "--node-ip-address", "127.0.0.1"])
subprocess.check_output(["ray", "stop"])
subprocess.check_call(["ray", "stop"])
# Test starting Ray with the object manager and node manager ports
# specified.
subprocess.check_output([
subprocess.check_call([
"ray", "start", "--head", "--object-manager-port", "12345",
"--node-manager-port", "54321"
])
subprocess.check_output(["ray", "stop"])
subprocess.check_call(["ray", "stop"])
# Test starting Ray with the worker port range specified.
subprocess.check_output([
subprocess.check_call([
"ray", "start", "--head", "--min-worker-port", "50000",
"--max-worker-port", "51000"
])
subprocess.check_output(["ray", "stop"])
subprocess.check_call(["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"])
subprocess.check_call(["ray", "start", "--head", "--num-cpus", "2"])
subprocess.check_call(["ray", "stop"])
# Test starting Ray with the number of GPUs specified.
subprocess.check_output(["ray", "start", "--head", "--num-gpus", "100"])
subprocess.check_output(["ray", "stop"])
subprocess.check_call(["ray", "start", "--head", "--num-gpus", "100"])
subprocess.check_call(["ray", "stop"])
# Test starting Ray with the max redis clients specified.
subprocess.check_output(
subprocess.check_call(
["ray", "start", "--head", "--redis-max-clients", "100"])
subprocess.check_output(["ray", "stop"])
subprocess.check_call(["ray", "stop"])
if "RAY_USE_NEW_GCS" not in os.environ:
# Test starting Ray with redis shard ports specified.
subprocess.check_output([
subprocess.check_call([
"ray", "start", "--head", "--redis-shard-ports", "6380,6381,6382"
])
subprocess.check_output(["ray", "stop"])
subprocess.check_call(["ray", "stop"])
# Test starting Ray with all arguments specified.
subprocess.check_output([
subprocess.check_call([
"ray", "start", "--head", "--redis-shard-ports", "6380,6381,6382",
"--object-manager-port", "12345", "--num-cpus", "2", "--num-gpus",
"0", "--redis-max-clients", "100", "--resources", "{\"Custom\": 1}"
])
subprocess.check_output(["ray", "stop"])
subprocess.check_call(["ray", "stop"])
# Test starting Ray with invalid arguments.
with pytest.raises(subprocess.CalledProcessError):
subprocess.check_output(
subprocess.check_call(
["ray", "start", "--head", "--address", "127.0.0.1:6379"])
subprocess.check_output(["ray", "stop"])
subprocess.check_call(["ray", "stop"])
# Test --block. Killing a child process should cause the command to exit.
blocked = subprocess.Popen(["ray", "start", "--head", "--block"])
+15 -11
View File
@@ -94,7 +94,8 @@ def run_test_project(project_dir, command, args):
def test_session_start_default_project():
result, mock_calls, test_dir = run_test_project(
"session-tests/project-pass", session_start, ["default"])
os.path.join("session-tests", "project-pass"), session_start,
["default"])
loaded_project = ray.projects.ProjectDefinition(test_dir)
assert result.exit_code == 0
@@ -138,7 +139,8 @@ def test_session_start_default_project():
def test_session_execute_default_project():
result, mock_calls, test_dir = run_test_project(
"session-tests/project-pass", session_execute, ["default"])
os.path.join("session-tests", "project-pass"), session_execute,
["default"])
loaded_project = ray.projects.ProjectDefinition(test_dir)
assert result.exit_code == 0
@@ -159,13 +161,14 @@ def test_session_execute_default_project():
assert expected_commands == commands_executed
result, mock_calls, test_dir = run_test_project(
"session-tests/project-pass", session_execute, ["--shell", "uptime"])
os.path.join("session-tests", "project-pass"), session_execute,
["--shell", "uptime"])
assert result.exit_code == 0
def test_session_start_docker_fail():
result, _, _ = run_test_project("session-tests/with-docker-fail",
session_start, [])
result, _, _ = run_test_project(
os.path.join("session-tests", "with-docker-fail"), session_start, [])
assert result.exit_code == 1
assert ("Docker support in session is currently "
@@ -173,8 +176,9 @@ def test_session_start_docker_fail():
def test_session_invalid_config_errored():
result, _, _ = run_test_project("session-tests/invalid-config-fail",
session_start, [])
result, _, _ = run_test_project(
os.path.join("session-tests", "invalid-config-fail"), session_start,
[])
assert result.exit_code == 1
assert "validation failed" in result.output
@@ -184,7 +188,7 @@ def test_session_invalid_config_errored():
def test_session_create_command():
result, mock_calls, test_dir = run_test_project(
"session-tests/commands-test", session_start,
os.path.join("session-tests", "commands-test"), session_start,
["first", "--a", "1", "--b", "2"])
# Verify the project can be loaded.
@@ -202,7 +206,7 @@ def test_session_create_command():
def test_session_create_multiple():
for args in [{"a": "*", "b": "2"}, {"a": "1", "b": "*"}]:
result, mock_calls, test_dir = run_test_project(
"session-tests/commands-test", session_start,
os.path.join("session-tests", "commands-test"), session_start,
["first", "--a", args["a"], "--b", args["b"]])
loaded_project = ray.projects.ProjectDefinition(test_dir)
@@ -227,14 +231,14 @@ def test_session_create_multiple():
# Using multiple wildcards shouldn't work
result, mock_calls, test_dir = run_test_project(
"session-tests/commands-test", session_start,
os.path.join("session-tests", "commands-test"), session_start,
["first", "--a", "*", "--b", "*"])
assert result.exit_code == 1
def test_session_commands():
result, mock_calls, test_dir = run_test_project(
"session-tests/commands-test", session_commands, [])
os.path.join("session-tests", "commands-test"), session_commands, [])
assert "This is the first parameter" in result.output
assert "This is the second parameter" in result.output
+2 -2
View File
@@ -95,7 +95,7 @@ class RunExperimentTest(unittest.TestCase):
return {"timesteps_this_iter": 1, "done": True}
def _save(self, path):
checkpoint = path + "/checkpoint"
checkpoint = os.path.join(path, "checkpoint")
with open(checkpoint, "w") as f:
f.write("OK")
return checkpoint
@@ -116,7 +116,7 @@ class RunExperimentTest(unittest.TestCase):
return {"timesteps_this_iter": 1, "done": True}
def _export_model(self, export_formats, export_dir):
path = export_dir + "/exported"
path = os.path.join(export_dir, "exported")
with open(path, "w") as f:
f.write("OK")
return {export_formats[0]: path}
@@ -1145,7 +1145,7 @@ class E2EPopulationBasedTestingSuite(unittest.TestCase):
return {"mean_accuracy": self.training_iteration}
def _save(self, path):
checkpoint = path + "/checkpoint"
checkpoint = os.path.join(path, "checkpoint")
with open(checkpoint, "w") as f:
f.write("OK")
return checkpoint