From fe4a78b7c75b068e17b578feed1f001e7a855ecd Mon Sep 17 00:00:00 2001 From: Simon Mo Date: Mon, 26 Oct 2020 16:52:19 -0700 Subject: [PATCH] [Hotfix] Pin Pydantic Version (#11622) --- doc/requirements-doc.txt | 2 +- python/ray/serve/tests/test_standalone.py | 62 +++++++++++------------ python/requirements.txt | 2 +- python/setup.py | 2 +- 4 files changed, 34 insertions(+), 34 deletions(-) diff --git a/doc/requirements-doc.txt b/doc/requirements-doc.txt index d72917fff..861b8f878 100644 --- a/doc/requirements-doc.txt +++ b/doc/requirements-doc.txt @@ -11,7 +11,7 @@ opencv-python-headless==4.3.0.36 pandas pickle5 pillow -pydantic +pydantic<1.7 pygments pyyaml recommonmark diff --git a/python/ray/serve/tests/test_standalone.py b/python/ray/serve/tests/test_standalone.py index f37391373..a32518028 100644 --- a/python/ray/serve/tests/test_standalone.py +++ b/python/ray/serve/tests/test_standalone.py @@ -19,6 +19,37 @@ from ray.test_utils import wait_for_condition from ray._private.services import new_port +def test_detached_deployment(): + # https://github.com/ray-project/ray/issues/11437 + + cluster = Cluster() + head_node = cluster.add_node(node_ip_address="127.0.0.1", num_cpus=6) + + # Create first job, check we can run a simple serve endpoint + ray.init(head_node.address) + first_job_id = ray.get_runtime_context().job_id + client = serve.start(detached=True) + client.create_backend("f", lambda _: "hello") + client.create_endpoint("f", backend="f") + assert ray.get(client.get_handle("f").remote()) == "hello" + + ray.shutdown() + + # Create the second job, make sure we can still create new backends. + ray.init(head_node.address) + assert ray.get_runtime_context().job_id != first_job_id + + client = serve.connect() + client.create_backend("g", lambda _: "world") + client.create_endpoint("g", backend="g") + assert ray.get(client.get_handle("g").remote()) == "world" + + # Test passed, clean up. + client.shutdown() + ray.shutdown() + cluster.shutdown() + + @pytest.mark.skipif( not hasattr(socket, "SO_REUSEPORT"), reason=("Port sharing only works on newer verion of Linux. " @@ -172,36 +203,5 @@ def test_cluster_handle_affinity(): cluster.shutdown() -def test_detached_deployment(): - # https://github.com/ray-project/ray/issues/11437 - - cluster = Cluster() - head_node = cluster.add_node(node_ip_address="127.0.0.1", num_cpus=6) - - # Create first job, check we can run a simple serve endpoint - ray.init(head_node.address) - first_job_id = ray.get_runtime_context().job_id - client = serve.start(detached=True) - client.create_backend("f", lambda _: "hello") - client.create_endpoint("f", backend="f") - assert ray.get(client.get_handle("f").remote()) == "hello" - - ray.shutdown() - - # Create the second job, make sure we can still create new backends. - ray.init(head_node.address) - assert ray.get_runtime_context().job_id != first_job_id - - client = serve.connect() - client.create_backend("g", lambda _: "world") - client.create_endpoint("g", backend="g") - assert ray.get(client.get_handle("g").remote()) == "world" - - # Test passed, clean up. - client.shutdown() - ray.shutdown() - cluster.shutdown() - - if __name__ == "__main__": sys.exit(pytest.main(["-v", "-s", __file__])) diff --git a/python/requirements.txt b/python/requirements.txt index 2be4b13b8..1072e6e74 100644 --- a/python/requirements.txt +++ b/python/requirements.txt @@ -37,7 +37,7 @@ scipy==1.4.1 tabulate tensorboardX uvicorn -pydantic +pydantic<1.7 dataclasses; python_version < '3.7' # Requirements for running tests diff --git a/python/setup.py b/python/setup.py index 0957b359e..23f303678 100644 --- a/python/setup.py +++ b/python/setup.py @@ -101,7 +101,7 @@ optional_ray_files += ray_dashboard_files extras = { "debug": [], "serve": [ - "uvicorn", "flask", "requests", "pydantic", + "uvicorn", "flask", "requests", "pydantic<1.7", "dataclasses; python_version < '3.7'" ], "tune": [