mirror of
https://github.com/wassname/ray.git
synced 2026-07-06 05:16:30 +08:00
Make test_utils.py use pipes to avoid file access conflicts on Windows (#9072)
Co-authored-by: Mehrdad <noreply@github.com>
This commit is contained in:
@@ -1,8 +1,5 @@
|
||||
import os
|
||||
import subprocess
|
||||
import tempfile
|
||||
|
||||
import ray
|
||||
import ray.test_utils
|
||||
from ray import serve
|
||||
|
||||
|
||||
@@ -20,20 +17,11 @@ def driver(flask_request):
|
||||
serve.create_backend("driver", driver)
|
||||
serve.create_endpoint("driver", backend="driver", route="/driver")
|
||||
""".format(ray.worker._global_node._redis_address)
|
||||
|
||||
with tempfile.NamedTemporaryFile(mode="w", delete=False) as f:
|
||||
path = f.name
|
||||
f.write(script)
|
||||
|
||||
proc = subprocess.Popen(["python", path])
|
||||
return_code = proc.wait(timeout=10)
|
||||
assert return_code == 0
|
||||
ray.test_utils.run_string_as_driver(script)
|
||||
|
||||
handle = serve.get_handle("driver")
|
||||
assert ray.get(handle.remote()) == "OK!"
|
||||
|
||||
os.remove(path)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import sys
|
||||
|
||||
Reference in New Issue
Block a user