From 10c208906176c043e9adfe2e2e664464860783ed 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 | 31 +++++++++++++++++++++++ python/requirements.txt | 2 +- python/setup.py | 2 +- 4 files changed, 34 insertions(+), 3 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 6498169e6..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. " 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 02c36bb6c..d64d8402e 100644 --- a/python/setup.py +++ b/python/setup.py @@ -102,7 +102,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": [