mirror of
https://github.com/vale981/ray
synced 2025-03-05 18:11:42 -05:00
[Serve][Doc] Moves Serve REST API and Serve CLI API into separate subpages (#26914)
This commit is contained in:
parent
8a9d994dd0
commit
04c7ccacf1
3 changed files with 171 additions and 167 deletions
|
@ -49,173 +49,14 @@
|
|||
.. autofunction:: ray.serve.batch(max_batch_size=10, batch_wait_timeout_s=0.0)
|
||||
```
|
||||
|
||||
(serve-rest-api)=
|
||||
## Operational APIs
|
||||
|
||||
## Serve REST API
|
||||
Check out the [CLI](serve-cli) and [REST API](serve-rest-api) for running, debugging, inspecting, and deploying Serve applications in production:
|
||||
|
||||
### REST API
|
||||
```{toctree}
|
||||
:maxdepth: 1
|
||||
:name: serve-non-python-api
|
||||
|
||||
#### `GET "/api/serve/deployments/"`
|
||||
|
||||
Gets latest config that Serve has received. This config represents the current goal state for the Serve application. Starts a Serve application on the Ray cluster if it's not already running. See the [config schema](serve-rest-api-config-schema) for the response's JSON schema.
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```
|
||||
GET /api/serve/deployments/ HTTP 1.1
|
||||
Host: http://localhost:52365/
|
||||
Accept: application/json
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200 OK
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"import_path": "fruit.deployment_graph",
|
||||
"runtime_env": {
|
||||
"working_dir": "https://github.com/ray-project/serve_config_examples/archive/HEAD.zip"
|
||||
},
|
||||
"deployments": [
|
||||
{"name": "MangoStand", "user_config": {"price": 1}},
|
||||
{"name": "OrangeStand", "user_config": {"price": 2}},
|
||||
{"name": "PearStand", "user_config": {"price": 3}}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
#### `PUT "/api/serve/deployments/"`
|
||||
|
||||
Declaratively deploys the Serve application. Starts Serve on the Ray cluster if it's not already running. See the [config schema](serve-rest-api-config-schema) for the request's JSON schema.
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```
|
||||
PUT /api/serve/deployments/ HTTP 1.1
|
||||
Host: http://localhost:52365/
|
||||
Accept: application/json
|
||||
|
||||
{
|
||||
"import_path": "fruit.deployment_graph",
|
||||
"runtime_env": {
|
||||
"working_dir": "https://github.com/ray-project/serve_config_examples/archive/HEAD.zip"
|
||||
},
|
||||
"deployments": [
|
||||
{"name": "MangoStand", "user_config": {"price": 1}},
|
||||
{"name": "OrangeStand", "user_config": {"price": 2}},
|
||||
{"name": "PearStand", "user_config": {"price": 3}}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
**Example Response**
|
||||
|
||||
|
||||
```http
|
||||
HTTP/1.1 200 OK
|
||||
Content-Type: application/json
|
||||
```
|
||||
|
||||
#### `GET "/api/serve/deployments/status"`
|
||||
|
||||
Gets the Serve application's current status, including all the deployment statuses. This config represents the current goal state for the Serve application. Starts a Serve application on the Ray cluster if it's not already running. See the [status schema](serve-rest-api-status-schema) for the response's JSON schema.
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```
|
||||
GET /api/serve/deployments/ HTTP 1.1
|
||||
Host: http://localhost:52365/
|
||||
Accept: application/json
|
||||
```
|
||||
|
||||
**Example Response**
|
||||
|
||||
```http
|
||||
HTTP/1.1 200 OK
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"app_status": {
|
||||
"status": "RUNNING",
|
||||
"message": "",
|
||||
"deployment_timestamp": 1855994527.146304
|
||||
},
|
||||
"deployment_statuses": [
|
||||
{
|
||||
"name": "MangoStand",
|
||||
"status": "HEALTHY",
|
||||
"message": ""
|
||||
},
|
||||
{
|
||||
"name": "OrangeStand",
|
||||
"status": "HEALTHY",
|
||||
"message": ""
|
||||
},
|
||||
{
|
||||
"name": "PearStand",
|
||||
"status": "HEALTHY",
|
||||
"message": ""
|
||||
},
|
||||
{
|
||||
"name": "FruitMarket",
|
||||
"status": "HEALTHY",
|
||||
"message": ""
|
||||
},
|
||||
{
|
||||
"name": "DAGDriver",
|
||||
"status": "HEALTHY",
|
||||
"message": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
#### `DELETE "/api/serve/deployments/"`
|
||||
|
||||
Shuts down the Serve application running on the Ray cluster. Has no
|
||||
effect if Serve is not running on the Ray cluster.
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```
|
||||
DELETE /api/serve/deployments/ HTTP 1.1
|
||||
Host: http://localhost:52365/
|
||||
Accept: application/json
|
||||
```
|
||||
|
||||
**Example Response**
|
||||
|
||||
```http
|
||||
HTTP/1.1 200 OK
|
||||
Content-Type: application/json
|
||||
```
|
||||
|
||||
(serve-rest-api-config-schema)=
|
||||
|
||||
### Config Schema
|
||||
|
||||
```{eval-rst}
|
||||
.. autopydantic_model:: ray.serve.schema.ServeApplicationSchema
|
||||
|
||||
```
|
||||
|
||||
(serve-rest-api-status-schema)=
|
||||
|
||||
### Status Schema
|
||||
|
||||
```{eval-rst}
|
||||
.. autopydantic_model:: ray.serve.schema.ServeStatusSchema
|
||||
|
||||
```
|
||||
|
||||
(serve-cli)=
|
||||
|
||||
## Serve CLI
|
||||
|
||||
```{eval-rst}
|
||||
.. click:: ray.serve.scripts:cli
|
||||
:prog: serve
|
||||
:show-nested:
|
||||
```
|
||||
serve_cli
|
||||
rest_api
|
||||
```
|
154
doc/source/serve/rest_api.md
Normal file
154
doc/source/serve/rest_api.md
Normal file
|
@ -0,0 +1,154 @@
|
|||
(serve-rest-api)=
|
||||
|
||||
# Serve REST API
|
||||
|
||||
## REST API
|
||||
|
||||
```
|
||||
GET /api/serve/deployments/ HTTP 1.1
|
||||
Host: http://localhost:52365/
|
||||
Accept: application/json
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200 OK
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"import_path": "fruit.deployment_graph",
|
||||
"runtime_env": {
|
||||
"working_dir": "https://github.com/ray-project/serve_config_examples/archive/HEAD.zip"
|
||||
},
|
||||
"deployments": [
|
||||
{"name": "MangoStand", "user_config": {"price": 1}},
|
||||
{"name": "OrangeStand", "user_config": {"price": 2}},
|
||||
{"name": "PearStand", "user_config": {"price": 3}}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### `PUT "/api/serve/deployments/"`
|
||||
|
||||
Declaratively deploys the Serve application. Starts Serve on the Ray cluster if it's not already running. See the [config schema](serve-rest-api-config-schema) for the request's JSON schema.
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```
|
||||
PUT /api/serve/deployments/ HTTP 1.1
|
||||
Host: http://localhost:52365/
|
||||
Accept: application/json
|
||||
|
||||
{
|
||||
"import_path": "fruit.deployment_graph",
|
||||
"runtime_env": {
|
||||
"working_dir": "https://github.com/ray-project/serve_config_examples/archive/HEAD.zip"
|
||||
},
|
||||
"deployments": [
|
||||
{"name": "MangoStand", "user_config": {"price": 1}},
|
||||
{"name": "OrangeStand", "user_config": {"price": 2}},
|
||||
{"name": "PearStand", "user_config": {"price": 3}}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
**Example Response**
|
||||
|
||||
|
||||
```http
|
||||
HTTP/1.1 200 OK
|
||||
Content-Type: application/json
|
||||
```
|
||||
|
||||
### `GET "/api/serve/deployments/status"`
|
||||
|
||||
Gets the Serve application's current status, including all the deployment statuses. This config represents the current goal state for the Serve application. Starts a Serve application on the Ray cluster if it's not already running. See the [status schema](serve-rest-api-status-schema) for the response's JSON schema.
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```
|
||||
GET /api/serve/deployments/ HTTP 1.1
|
||||
Host: http://localhost:52365/
|
||||
Accept: application/json
|
||||
```
|
||||
|
||||
**Example Response**
|
||||
|
||||
```http
|
||||
HTTP/1.1 200 OK
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"app_status": {
|
||||
"status": "RUNNING",
|
||||
"message": "",
|
||||
"deployment_timestamp": 1855994527.146304
|
||||
},
|
||||
"deployment_statuses": [
|
||||
{
|
||||
"name": "MangoStand",
|
||||
"status": "HEALTHY",
|
||||
"message": ""
|
||||
},
|
||||
{
|
||||
"name": "OrangeStand",
|
||||
"status": "HEALTHY",
|
||||
"message": ""
|
||||
},
|
||||
{
|
||||
"name": "PearStand",
|
||||
"status": "HEALTHY",
|
||||
"message": ""
|
||||
},
|
||||
{
|
||||
"name": "FruitMarket",
|
||||
"status": "HEALTHY",
|
||||
"message": ""
|
||||
},
|
||||
{
|
||||
"name": "DAGDriver",
|
||||
"status": "HEALTHY",
|
||||
"message": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### `DELETE "/api/serve/deployments/"`
|
||||
|
||||
Shuts down the Serve application running on the Ray cluster. Has no
|
||||
effect if Serve is not running on the Ray cluster.
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```
|
||||
DELETE /api/serve/deployments/ HTTP 1.1
|
||||
Host: http://localhost:52365/
|
||||
Accept: application/json
|
||||
```
|
||||
|
||||
**Example Response**
|
||||
|
||||
```http
|
||||
HTTP/1.1 200 OK
|
||||
Content-Type: application/json
|
||||
```
|
||||
|
||||
(serve-rest-api-config-schema)=
|
||||
|
||||
## Config Schema
|
||||
|
||||
```{eval-rst}
|
||||
.. autopydantic_model:: ray.serve.schema.ServeApplicationSchema
|
||||
|
||||
```
|
||||
|
||||
(serve-rest-api-status-schema)=
|
||||
|
||||
## Status Schema
|
||||
|
||||
```{eval-rst}
|
||||
.. autopydantic_model:: ray.serve.schema.ServeStatusSchema
|
||||
|
||||
```
|
9
doc/source/serve/serve_cli.md
Normal file
9
doc/source/serve/serve_cli.md
Normal file
|
@ -0,0 +1,9 @@
|
|||
(serve-cli)=
|
||||
|
||||
# Serve CLI
|
||||
|
||||
```{eval-rst}
|
||||
.. click:: ray.serve.scripts:cli
|
||||
:prog: serve
|
||||
:show-nested:
|
||||
```
|
Loading…
Add table
Reference in a new issue