Commit 7a97d5c
authored
## Description
Makes the Serve dashboard scale endpoint report client errors with 404
status code instead of 400 when an application or deployment is not
found.
#51417 added the `HTTPStatusCode` enum and the
`rest_response(status_code=...)` plumbing, but adoption across dashboard
modules is ongoing.
**Backend (`python/ray/dashboard/modules/serve/serve_head.py`):**
- In `scale_deployment`, when `ValueError` with `"not found"` occurred
(looking up a nonexistent application or deployment), the endpoint
returned HTTP 400 (Bad Request). Scaling a nonexistent resource is a
client error representing a missing resource, so it now returns HTTP 404
(Not Found).
## Related issues
Related to #51442 (umbrella: revisit Ray dashboard API status codes).
Since #51442 is an umbrella issue, this PR covers the `serve_head.py`
scope only, allowing each dashboard module to be reviewed independently.
## Tests
Updated the existing unit test `test_error_case` in
`python/ray/dashboard/modules/serve/tests/test_serve_dashboard.py`:
- Verified that scaling a nonexistent application
(`app_name="nonexistent"`) returns HTTP status code 404 instead of 400.
## Not a duplicate
Checked existing open issues and PRs for #51442. No active PR currently
addresses status code fixes for `serve_head.py`. Commented on #51442
prior to working on this scope.
Signed-off-by: Vũ Hoàng Minh <vhminh23@clc.fitus.edu.vn>
1 parent 1c018ee commit 7a97d5c
2 files changed
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
264 | 264 | | |
265 | 265 | | |
266 | 266 | | |
267 | | - | |
| 267 | + | |
268 | 268 | | |
269 | 269 | | |
270 | 270 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
969 | 969 | | |
970 | 970 | | |
971 | 971 | | |
972 | | - | |
| 972 | + | |
973 | 973 | | |
974 | 974 | | |
975 | 975 | | |
| |||
0 commit comments