From 22bc1e9b3d100a3e5ddae0f3d7620cbb74068c9e Mon Sep 17 00:00:00 2001 From: Sihan Wang Date: Wed, 8 Feb 2023 14:11:44 -0800 Subject: [PATCH] [Serve][Doc] Refactor the Ray Serve API doc (#32307) - Add an index page to list all the APIs. (https://ray--32307.org.readthedocs.build/en/32307/serve/api/index.html) - With this change, when you search specific python API e.g`ray.serve.run`. The search result will show core api link page. (Previously, the user can't get the correct search result, because we put all APIs on one page.) image --- doc/source/_toc.yml | 2 +- doc/source/ray-references/api.rst | 2 +- doc/source/serve/api/index.md | 12 +++++ doc/source/serve/api/python_api.md | 49 +++++++++++++++++ doc/source/serve/{ => api}/rest_api.md | 0 doc/source/serve/{ => api}/serve_cli.md | 0 doc/source/serve/package-ref.md | 71 ------------------------- 7 files changed, 63 insertions(+), 73 deletions(-) create mode 100644 doc/source/serve/api/index.md create mode 100644 doc/source/serve/api/python_api.md rename doc/source/serve/{ => api}/rest_api.md (100%) rename doc/source/serve/{ => api}/serve_cli.md (100%) delete mode 100644 doc/source/serve/package-ref.md diff --git a/doc/source/_toc.yml b/doc/source/_toc.yml index 4975ca63a112..2e82bb4cab8a 100644 --- a/doc/source/_toc.yml +++ b/doc/source/_toc.yml @@ -315,7 +315,7 @@ parts: - file: serve/tutorials/deployment-graph-patterns/linear_pipeline - file: serve/tutorials/deployment-graph-patterns/branching_input - file: serve/tutorials/deployment-graph-patterns/conditional - - file: serve/package-ref + - file: serve/api/index - file: rllib/index title: Ray RLlib diff --git a/doc/source/ray-references/api.rst b/doc/source/ray-references/api.rst index 2e97eac3dfba..fb55ac2015c2 100644 --- a/doc/source/ray-references/api.rst +++ b/doc/source/ray-references/api.rst @@ -9,7 +9,7 @@ API References ../data/api/api.rst ../train/api.rst ../tune/api_docs/overview.rst - ../serve/package-ref.rst + ../serve/api/index.rst ../rllib/package_ref/index.rst ../workflows/api/api.rst ../cluster/package-overview.rst diff --git a/doc/source/serve/api/index.md b/doc/source/serve/api/index.md new file mode 100644 index 000000000000..c124fa6b2bf5 --- /dev/null +++ b/doc/source/serve/api/index.md @@ -0,0 +1,12 @@ +(serve-api)= +# Ray Serve API + +```{toctree} +:maxdepth: '-1' + +python_api +rest_api +serve_cli +``` + + diff --git a/doc/source/serve/api/python_api.md b/doc/source/serve/api/python_api.md new file mode 100644 index 000000000000..9b288318842f --- /dev/null +++ b/doc/source/serve/api/python_api.md @@ -0,0 +1,49 @@ +# Ray Serve Python API + +(core-apis)= + +```{eval-rst} +.. currentmodule:: ray +``` + +## Core APIs + +```{eval-rst} +.. autosummary:: + :toctree: doc/ + + serve.run + serve.start + serve.shutdown + serve.delete +``` + +(servehandle-api)= +## ServeHandle API + +```{eval-rst} +.. autosummary:: + :toctree: doc/ + + serve.handle.RayServeHandle + serve.handle.RayServeHandle.remote + serve.handle.RayServeHandle.options +``` + +## Batching Requests + +```{eval-rst} +.. autosummary:: + :toctree: doc/ + + serve.batch +``` + +## Deployment Graph APIs + +```{eval-rst} +.. autosummary:: + :toctree: doc/ + + serve.api.build +``` \ No newline at end of file diff --git a/doc/source/serve/rest_api.md b/doc/source/serve/api/rest_api.md similarity index 100% rename from doc/source/serve/rest_api.md rename to doc/source/serve/api/rest_api.md diff --git a/doc/source/serve/serve_cli.md b/doc/source/serve/api/serve_cli.md similarity index 100% rename from doc/source/serve/serve_cli.md rename to doc/source/serve/api/serve_cli.md diff --git a/doc/source/serve/package-ref.md b/doc/source/serve/package-ref.md deleted file mode 100644 index 0206a81339f7..000000000000 --- a/doc/source/serve/package-ref.md +++ /dev/null @@ -1,71 +0,0 @@ -(serve-api)= -# Ray Serve API - -(core-apis)= - -## Core APIs - -```{eval-rst} -.. autofunction:: ray.serve.run -``` - -```{eval-rst} -.. autofunction:: ray.serve.start -``` - -```{eval-rst} -.. autofunction:: ray.serve.deployment -``` - -```{eval-rst} -.. autofunction:: ray.serve.shutdown -``` - -(deployment-api)= - -## Deployment API - -```{eval-rst} -.. autoclass:: ray.serve.deployment.Deployment - :members: deploy, delete, options, get_handle, bind -``` - -(servehandle-api)= - -## ServeHandle API - -```{eval-rst} -.. autoclass:: ray.serve.handle.RayServeHandle - :members: remote, options -``` - -## Batching Requests - -```{eval-rst} -.. autofunction:: ray.serve.batch(max_batch_size=10, batch_wait_timeout_s=0.0) -``` - -## Serve CLI and REST API - -Check out the [CLI](serve-cli) and [REST API](serve-rest-api) for running, debugging, inspecting, and deploying Serve applications in production: - -```{toctree} -:maxdepth: 1 -:name: serve-non-python-api - -serve_cli -rest_api -``` - -## Deployment Graph APIs - -```{eval-rst} -.. autofunction:: ray.serve.api.build -``` - -% TODO(architkulkarni): This just compiles to "alias of Deployment(name=DAGDriver,version=None,route_prefix=/)" -% in the docs, find out how to make Sphinx correctly autodocument this class. -% ```{eval-rst} -% .. autoclass:: ray.serve.drivers.DAGDriver -% :members: predict, predict_with_route -% ```