Repository navigation
[docs][kuberay] Add a Modal SDK sandbox deployment example - #66089
Closed
OneSizeFitsQuorum wants to merge 1 commit into
Closed
OneSizeFitsQuorum wants to merge 1 commit into
OneSizeFitsQuorum wants to merge 1 commit into
Conversation
Signed-off-by: OneSizeFitsQuorum <[email protected]>
|
This pull request has been automatically marked as stale because it has not had You can always ask for help on our discussion forum or Ray's public slack channel. If you'd like to keep this open, just leave any comment, and the stale label will be removed. |
pcmoritz
pushed a commit
that referenced
this pull request
Sep 26, 2026
## Why are these changes needed? #65992, #65942, and #65633 have merged, and this PR is rebased onto master, so the diff is the facade commit alone. #66359 stacks on it. #65633 (merged) exposes the sandbox control plane as a REST service. This PR adds a gRPC facade in front of the same detached `SandboxHost` actors, so an unmodified third-party sandbox client SDK pointed at this server can create sandboxes, exec commands, and use its filesystem API against a Ray cluster. The facade implements the subset of the SDK's control-plane (`ModalClient`) and command-router (`TaskCommandRouter`) services that its Sandbox API uses. The wire contract is vendored under `http/_proto/` as a minimal protobuf/grpclib stub set generated from checked-in `.proto` sources, so nothing third-party is needed to build or test. gRPC routes on the fully qualified method path and protobuf frames fields by number, so the vendored service, method, and field identifiers reproduce the external service's on-the-wire names verbatim; only the surface the facade uses is declared. The proto packages carry a `ray_sandbox_facade.` prefix that never reaches the wire, so the stubs can share a process with the client SDK. Design: - **Stateless where possible.** Object ids carry their payload (`im-<b64 image ref>`, `st-<b64 env json>`) and the sandbox id doubles as the client task id. Named creates are scoped to the client app and idempotent; a dead actor under a live name is killed and recreated. The one in-process table is the exec table, which keeps finished records for 120 s (the SDK reads output lazily) under a 50,000-record cap, so run a single facade process per cluster. - **Filesystem API via exec emulation.** The SDK implements its filesystem API by exec-ing a helper binary that sandbox images don't contain. The router recognizes its argv and emulates WriteFile / ReadFile / ListFiles with `SandboxHost` file operations; large writes flush in bounded slices. - **Scheduling-aware.** Every actor call is bounded, so an unscheduled actor on a scaling cluster surfaces as `UNAVAILABLE` (retried by the SDK) instead of hanging, and a dead actor maps to `NOT_FOUND` (the SDK's "task shut down" signal). Run with `python -m ray.experimental.sandbox.http.grpc_facade` (requires `grpclib`). Documented in the sandboxes guide under the HTTP API service section. One commit: the vendored wire contract (`.proto` sources, generated stubs, lint excludes), the facade, its tests, and docs. Review fixes that touch code shared with the lower PRs (`name:group` exec-user resolution, a bounded runsc download, a bounded `DELETE`, docs wording) live on those branches and are included here through the stack. Review fixes from the 2026-09-15 pass: - A `cidr_allowlist` the facade cannot enforce now fails `SandboxCreate` with `INVALID_ARGUMENT` instead of granting open egress behind a server-side warning, and `TaskSetNetworkAccess` fails with `UNIMPLEMENTED` instead of being acknowledged and ignored, so a client never runs with fewer restrictions than it asked for. - `TaskExecStart` reserves the exec id before anything reaches the actor and carries the start in its own task. A retry (the SDK retries `UNAVAILABLE`, which the facade answers when the actor has not replied within the scheduling grace) joins that in-flight start instead of running the command again; a start that fails for good is forgotten so a retry may start afresh. A test holds the first start in flight past the grace, retries, and checks the command ran once. - The exec record kind is `sandbox` or `fs` (was `host`), since both run in the sandbox. Update (2026-09-24), rebased onto the new #65633: - **Tests with the Modal client** (review request): `test_modal_client.py` runs the unmodified `modal` SDK (1.5.5) against the facade: create, exec with exit codes and stdout/stderr, `filesystem.write_bytes` / `read_bytes` including the typed not-found error, terminate, and the network-policy mappings. - **The facade and the Modal SDK can share a process.** The vendored protos declared `package modal.client`, which registered the same full names as the SDK's own protos in protobuf's process-wide descriptor pool, so importing both failed with `duplicate symbol 'modal.client.ObjectCreationType'` (hit while load-testing on Anyscale). The packages now carry a `ray_sandbox_facade.` prefix, and the generated gRPC stubs are rewritten to the external method paths, so the wire is unchanged: the regenerated `_grpc.py` files are byte-identical, every served path exists in the SDK's stubs, and the SDK's serialized messages parse into the vendored classes. `_proto/README.md` documents the regeneration step. - **`SandboxTerminate` no longer kills a host whose `terminate()` outlasts the wait** (Bugbot). As in the REST `DELETE`, the queued terminate finishes (with #65633's boot fix it first deletes a container that was still starting) and the host exits on its own. - **Exec records outlive fast traffic.** The SDK reads a command's stdout and stderr lazily, often after `wait()` returned. With the 1,000-record cap, a finished record lasted about a second at 700 execs/s and a late read got `NOT_FOUND`. Finished records now stay 120 s (hard cap 50,000), evicted by a bounded O(1) scan instead of a full-table copy per exec. - **Event loop:** resolver calls (create, lookups, kill) run in worker threads, and creates reuse one ActorClass (#65633). With real `SandboxHost` actors on a local Ray cluster and the Modal SDK issuing 48 concurrent creates, throughput went from 56 to 353–550 creates/s, the create RPC's p50 from 387 ms to 78–104 ms, and the facade's worst event-loop stall during the burst from 838 ms to 36 ms. Exec throughput is unchanged (about 1.3k/s on that machine). - **Malformed input is `INVALID_ARGUMENT`, not `INTERNAL`:** a bare `FROM` line, and fs-tools commands whose JSON isn't an object with an object payload (gemini, on #66359). - The image-seeding symlink finding (Bugbot) was fixed in #65992 before it merged (`_resolve_in_root`); `image_utils.py` is no longer part of this diff. - **Second pass** (Bugbot on the update): importing the facade no longer needs FastAPI (it takes the resolver from #65633's `http/resolver.py`), so it needs only `grpclib` and `ray[default]`, as the docs now say. Buffered `WriteFile` content is capped at `max_file_bytes` (`RESOURCE_EXHAUSTED` past it), and named-create retries re-send the idempotent `boot()`. ## Related issue number Follows #65633 (merged). ## Checks - `test_grpc_facade.py` drives the facade end to end over gRPC with the vendored stubs, and `test_modal_client.py` with the unmodified Modal SDK, both backed by the same fake resolver and runtime seams the REST app tests use. They skip when `grpclib` (and, for the latter, `modal`) is absent, so the sandbox core CI job, which installs neither, adds no new dependency. Ran locally with grpclib 0.4.9 and modal 1.5.5: `pytest --import-mode=importlib python/ray/experimental/sandbox/http/tests/` → 101 passed (21 wire tests, 3 Modal-client tests, and the 77-test HTTP API suite). - The facade module is never imported from `sandbox/__init__.py` or the REST `app.py` import graph, so it stays inert unless explicitly run. - `ruff check`, `ruff check --select I`, `black`, and `pydoclint` (the pre-commit versions and flags) pass on the changed files. - This PR was prepared with AI assistance. It is not a duplicate: it is one step of the Ray Sandbox series (#65570 → #65992 → #65942 → #65633 → #65839 → #66359), and no other open PR covers it (#66089, a KubeRay + Modal SDK guide, builds on it). Signed-off-by: xyuzh <[email protected]>
dstrodtman
added a commit
that referenced
this pull request
Oct 5, 2026
## Description KubeRay is one of the most-visited areas of the Ray docs, but it sits two levels down under Ray Clusters, and every KubeRay URL carries a redundant `cluster/kubernetes/` prefix. This PR promotes KubeRay to a top-level entry in the left sidebar and shortens its URLs by moving the KubeRay docs from `doc/source/cluster/kubernetes/` to `doc/source/kuberay/`. It replaces the top-nav tab approach from #65438. All the Ray on Kubernetes docs move to `kuberay/`. KubeRay is the officially supported way to run Ray on Kubernetes, and the docs already removed the examples for deploying Ray manually (#53833). The few guides that apply to Ray on Kubernetes more broadly still use KubeRay for their examples, so they stay with the rest of the KubeRay docs. The old `cluster/kubernetes/index` landing page becomes a short `cluster/kubernetes.md` page under Ray Clusters. It points readers to KubeRay, says that a manual deployment is possible but not officially supported, and lists the KubeRay guides that can help with other Ray on Kubernetes deployments. The KubeRay landing page now covers only KubeRay. Previews: - [Ray on Kubernetes](https://anyscale-ray--66674.com.readthedocs.build/en/66674/cluster/kubernetes.html) - [KubeRay](https://anyscale-ray--66674.com.readthedocs.build/en/66674/kuberay/index.html) **Please review commit by commit.** Each commit is scoped so it can be signed off on its own. The PR squash-merges as one change. Commits 3 through 5 came out of an earlier round of review, which kept KubeRay-independent guides in a general `cluster/kubernetes/` section. Commits 6 through 8 reverse that: they move those guides back under KubeRay and turn the general section into a single page. If you're reviewing for the first time, read commits 3 through 5 with the reversal in mind. The final state is what commits 1, 2, and 6 through 8 describe. ## Related issues Related to #65438, which this replaces. ## Additional information ### Commit 1: path change What to sign off on: every file shows as a git rename, and the only content deltas are path references that have to move with the files. - Moves `cluster/kubernetes/` to `kuberay/`, which is 128 files, all detected as renames. The tree moves as a unit, so the relative `images/` and `configs/` paths inside it stay valid. - Renames within the move, since every URL changes anyway: - Hub pages move into their directories as `index.md`: `benchmarks`, `examples`, `getting-started`, `references`, `troubleshooting`, `user-guides`, and `k8s-ecosystem`. - `k8s-ecosystem/` becomes `ecosystem/`. - Drops the redundant `kuberay-` filename prefix from 10 pages: `getting-started/operator-installation`, and `user-guides/auth`, `auth-rbac`, `dashboard`, `gcs-ft`, `gcs-persistent-ft`, `gcs-rocksdb-ft`, `history-server`, `mtls`, `serve-high-throughput`. - Path references updated with the move: - Toctrees and `{doc}`/`:doc:`/relative Markdown links inside and outside the tree (`ray-core/`, `serve/`, `ray-observability/`, `ray-overview/`, `cluster/`). - `.github/CODEOWNERS`: same owners, new path. - `.vale.ini`: the path-scoped KubeRay style section. - `conf.py`: adds `kuberay` to `all_toc_libs`. The directory scan only picks up `ray-*` names, so without this entry `DOC_LIB=<lib>` single-library builds would stop excluding KubeRay, and `DOC_LIB=kuberay` wouldn't work. It previously rode along with `cluster`. - `/en/master/` links in the JAX trainer example `README.md` and `.ipynb`. - Path mentions in `ray-contribute/writing-style.md`, `doc/.claude/skills/rst-to-myst/SKILL.md`, and the `_ext/llms_txt.py` docstring example. - Left alone on purpose: - `(kuberay-*)=` and `(k8s-*)=` label definitions and every label-targeted ref, since labels don't depend on filenames. - Absolute `docs.ray.io/en/latest/...` and release-pinned links in prose and in `python/ray/autoscaler/_private/kuberay/autoscaling_config.py`. The redirects below cover them. Rewriting `/en/latest/` links before a release ships the new paths would break them. **Redirects** (`doc/redirects/current.yaml`): - Specific `page` rules for the 7 hubs, the `k8s-ecosystem/*` prefix, and the 10 prefix drops, placed before the directory wildcard `/cluster/kubernetes/*` → `/kuberay/:splat`. - The existing catch-all `/cluster/kubernetes/*` → `/cluster/kubernetes/index.html` moves to `from: /kuberay/*` with its `to:` unchanged, so older releases keep resolving. - `rtd-redirects validate`: 0 errors, 0 warnings. Chain notes go from 58 to 78. - `rtd-redirects simulate --prefix /cluster/kubernetes/` passes on master, latest, `releases-2.58.0`, `releases-2.40.0`, and `releases-2.20.0`: 0 regressions, 0 wrong landings, 0 new loops on every version. Final state, all eight commits, run with `--git-renames doc/source` and each release's `objects.inv` as its page set: | Version | 0 hops | 1 hop | 2 hops | 3 hops | |---|---|---|---|---| | master (after) | 0 | 271 | 11 | 11 | | latest | 97 | 240 | 16 | 0 | | releases-2.58.0 | 96 | 240 | 17 | 0 | | releases-2.40.0 | 75 | 173 | 40 | 0 | | releases-2.20.0 | 66 | 173 | 49 | 0 | Every page under `/cluster/kubernetes/` on master today reaches its new path in one hop, including the storage and image pull latency guides and the landing page itself, `/cluster/kubernetes/index.html`, which lands on `/kuberay/index.html`. No master URL resolves without a redirect, because nothing stays under `/cluster/kubernetes/`. The new `cluster/kubernetes.html` page is a new URL. The 3-hop entries on master are URLs that don't match any current page, such as pages removed before this PR. They go from `/cluster/kubernetes/<page>` to `/kuberay/<page>`, then through the `/kuberay/*` catch-all to `/cluster/kubernetes/index.html`, then through the wildcard to `/kuberay/index.html`. They land on the KubeRay landing page, which is the page they reached before. The catch-all's `to:` stays `/cluster/kubernetes/index.html` so older releases, which have no `kuberay/` directory, keep resolving without a loop. The 2-hop entries on older releases are KubeRay pages newer than that release, and they land on the same index page as before. The remaining 2-hop entries are pre-existing chains outside KubeRay, such as RLlib and Tune. **llms.txt shards.** RtD page redirects fire on any 404 path, not only `.html`. On today's master, `/en/master/cluster/kubernetes/no-such-file.txt` already 301s through the existing `/cluster/kubernetes/*` catch-all. The local build emits `kuberay/llms-full.txt`, so `/cluster/kubernetes/llms-full.txt` reaches it through the directory wildcard in one hop, with no extra rule. `simulate` reports that URL as landing on the index instead, because its page sources only list HTML pages. It reports the same URL as missing on today's master, where it returns 200. ### Commit 2: navigation What to sign off on: sidebar order only. - Root toctree: adds `KubeRay <kuberay/index>` directly above Ray Core, and moves `Ecosystem` from above Ray Core to directly below APIs. - Removes `Deploying on Kubernetes` from the Ray Clusters toctree, so KubeRay has one parent. Commit 4 restores the entry for the general section. - `navbar.yml` doesn't reference KubeRay pages, so it doesn't change. ### Commit 3: keep KubeRay-independent content in `cluster/kubernetes/` Commit 7 reverses the page moves in this commit. The config file stays where this commit puts it. What to sign off on: these files don't depend on the KubeRay operator, and they keep their master paths. - Moves back to `cluster/kubernetes/`, as git renames: - `user-guides/storage.md`, with its two images. - `user-guides/reduce-image-pull-latency.md`. - `configs/static-ray-cluster.tls.yaml`. It's a plain-Deployment Ray cluster with no KubeRay, left over from the page #53833 removed, and its only consumer is `ray-core/configure.md`. Keeping it in place means that file's raw GitHub link doesn't change at all, so existing copies of the link keep working. - `.github/CODEOWNERS`: keeps the `/doc/source/cluster/kubernetes/` entry alongside the new `/doc/source/kuberay/` one, with the same owners. - `.vale.ini`: registers the KubeRay style for both paths. - The two pages need no redirects, because RtD page redirects only fire on a 404. ### Commit 4: general Ray on Kubernetes section Commit 7 replaces this section with a single page, `cluster/kubernetes.md`. What to sign off on: navigation only, plus a minimal index page. - Adds `cluster/kubernetes/index.md` as the parent for the two general guides. It links to KubeRay for deploying and managing Ray clusters with the operator. It's intentionally short for now. - Restores `Deploying on Kubernetes` in the Ray Clusters toctree, now pointing at that page. KubeRay keeps a single parent, the root toctree. - Moves the two guides from the KubeRay user-guides toctree to the new index. The KubeRay user-guides list keeps both as cross-references. - Updates the Ray on Kubernetes path mention in `ray-contribute/writing-style.md`. ### Commit 5: landing pages Commits 6 and 8 revise both pages again. What to sign off on: prose on the two index pages. - `kuberay/index.md`: retitles the page from "Ray on Kubernetes" to "KubeRay" and rewrites the opening as an introduction to KubeRay, without the "Overview" heading. The `kuberay-index` label moves to the H1, so its existing refs keep resolving. The custom resource list adds RayCronJob, so it names all four `ray.io/v1` kinds. The page links to the general section. - `cluster/kubernetes/index.md`: lists the operators that deploy and manage Ray clusters on Kubernetes, which are KubeRay and the Anyscale operator, with a link to the Anyscale on Kubernetes docs. ### Commit 6: center the KubeRay landing page on KubeRay What to sign off on: prose on the two landing pages. - `kuberay/index.md`: removes the Anyscale paragraph. Reframes the card grid and the "Learn more" lead-in around KubeRay rather than Kubernetes in general, and sentence-cases the card titles and buttons. Folds the one-item "About KubeRay" list into prose. - `cluster/kubernetes/index.md`: cuts the Anyscale operator entry to one line that links to the Anyscale docs. ### Commit 7: move the general guides back under KubeRay What to sign off on: path changes only, with no prose edits. - Moves `storage.md`, its two images, and `reduce-image-pull-latency.md` back to `kuberay/user-guides/` as git renames, and restores both guides to the KubeRay user-guides toctree in their original positions. - Renames `cluster/kubernetes/index.md` to `cluster/kubernetes.md`, since it no longer has child pages. The Ray Clusters toctree points at the new path. - Leaves `cluster/kubernetes/configs/static-ray-cluster.tls.yaml` in place, so the raw GitHub link in `ray-core/configure.md` doesn't change. - `.github/CODEOWNERS`: adds `/doc/source/cluster/kubernetes.md` and keeps the `/doc/source/cluster/kubernetes/` entry for the config file. `.vale.ini` and `ray-contribute/writing-style.md` point at the new page path. - Needs no new redirects. The old master URLs of the two guides reach their new paths in one hop through the existing `/cluster/kubernetes/*` wildcard. ### Commit 8: rewrite the Ray on Kubernetes page What to sign off on: prose on `cluster/kubernetes.md`. - States that KubeRay is the officially supported way to run Ray on Kubernetes, and that a manual deployment without an operator is possible but not officially supported. - Keeps a one-line pointer to the Anyscale docs for the Anyscale operator. - Adds a "KubeRay guides that apply more broadly" section, which links to the storage and dependencies, image pull latency, managed Kubernetes cluster setup, and scheduling guides. Their examples use KubeRay, and the section says so. ### Out of scope - Expanding `cluster/kubernetes.md` beyond its pointer to KubeRay and the guide list. - Reworking the Ray Clusters landing page prose and cards that still describe Kubernetes as one of two deployment paths. - `user-guides/k8s-*` slugs (`k8s-autoscaler`, `k8s-cluster-setup`, `k8s-events`), `persist-kuberay-*-logs`, and `troubleshooting/troubleshooting.md`. Reviewers: if you'd like any of these renamed, say so, and it can go in a follow-up so this PR stays a pure move. ### Verification - `make -C doc rtd-build` (RtD-faithful, `-W --keep-going`) builds clean for commits 1 and 2, and for the state after commit 5: `build succeeded.`, exit 0. The RtD preview build is the check for commits 6 through 8. - `rtd-redirects validate`: 0 errors, 0 warnings on the final state. `rtd-redirects simulate` reports 0 regressions, 0 wrong landings, and 0 new loops on every version in the table above. - Rebased onto master. The only conflict was `ray-observability/ray-distributed-debugger`, which master converted from RST to MyST. Commit 1 applies its two quickstart link updates to the new `.md` file. - Commit 1 shows all 128 targets as renames in `git show --stat --find-renames`. ### Coordination Open PRs touching this directory will need a rebase onto the new paths after this merges: #65848, #65709, #65965, #66089, #65840. I'll handle those rebases. Git rename detection should carry most of them over cleanly. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: Douglas Strodtman <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
nadongjun
pushed a commit
to nadongjun/ray
that referenced
this pull request
Oct 6, 2026
…roject#65839) ## Why are these changes needed? ray-project#65992, ray-project#65942, and ray-project#65633 have merged, and this PR is rebased onto master, so the diff is the facade commit alone. ray-project#66359 stacks on it. ray-project#65633 (merged) exposes the sandbox control plane as a REST service. This PR adds a gRPC facade in front of the same detached `SandboxHost` actors, so an unmodified third-party sandbox client SDK pointed at this server can create sandboxes, exec commands, and use its filesystem API against a Ray cluster. The facade implements the subset of the SDK's control-plane (`ModalClient`) and command-router (`TaskCommandRouter`) services that its Sandbox API uses. The wire contract is vendored under `http/_proto/` as a minimal protobuf/grpclib stub set generated from checked-in `.proto` sources, so nothing third-party is needed to build or test. gRPC routes on the fully qualified method path and protobuf frames fields by number, so the vendored service, method, and field identifiers reproduce the external service's on-the-wire names verbatim; only the surface the facade uses is declared. The proto packages carry a `ray_sandbox_facade.` prefix that never reaches the wire, so the stubs can share a process with the client SDK. Design: - **Stateless where possible.** Object ids carry their payload (`im-<b64 image ref>`, `st-<b64 env json>`) and the sandbox id doubles as the client task id. Named creates are scoped to the client app and idempotent; a dead actor under a live name is killed and recreated. The one in-process table is the exec table, which keeps finished records for 120 s (the SDK reads output lazily) under a 50,000-record cap, so run a single facade process per cluster. - **Filesystem API via exec emulation.** The SDK implements its filesystem API by exec-ing a helper binary that sandbox images don't contain. The router recognizes its argv and emulates WriteFile / ReadFile / ListFiles with `SandboxHost` file operations; large writes flush in bounded slices. - **Scheduling-aware.** Every actor call is bounded, so an unscheduled actor on a scaling cluster surfaces as `UNAVAILABLE` (retried by the SDK) instead of hanging, and a dead actor maps to `NOT_FOUND` (the SDK's "task shut down" signal). Run with `python -m ray.experimental.sandbox.http.grpc_facade` (requires `grpclib`). Documented in the sandboxes guide under the HTTP API service section. One commit: the vendored wire contract (`.proto` sources, generated stubs, lint excludes), the facade, its tests, and docs. Review fixes that touch code shared with the lower PRs (`name:group` exec-user resolution, a bounded runsc download, a bounded `DELETE`, docs wording) live on those branches and are included here through the stack. Review fixes from the 2026-09-15 pass: - A `cidr_allowlist` the facade cannot enforce now fails `SandboxCreate` with `INVALID_ARGUMENT` instead of granting open egress behind a server-side warning, and `TaskSetNetworkAccess` fails with `UNIMPLEMENTED` instead of being acknowledged and ignored, so a client never runs with fewer restrictions than it asked for. - `TaskExecStart` reserves the exec id before anything reaches the actor and carries the start in its own task. A retry (the SDK retries `UNAVAILABLE`, which the facade answers when the actor has not replied within the scheduling grace) joins that in-flight start instead of running the command again; a start that fails for good is forgotten so a retry may start afresh. A test holds the first start in flight past the grace, retries, and checks the command ran once. - The exec record kind is `sandbox` or `fs` (was `host`), since both run in the sandbox. Update (2026-09-24), rebased onto the new ray-project#65633: - **Tests with the Modal client** (review request): `test_modal_client.py` runs the unmodified `modal` SDK (1.5.5) against the facade: create, exec with exit codes and stdout/stderr, `filesystem.write_bytes` / `read_bytes` including the typed not-found error, terminate, and the network-policy mappings. - **The facade and the Modal SDK can share a process.** The vendored protos declared `package modal.client`, which registered the same full names as the SDK's own protos in protobuf's process-wide descriptor pool, so importing both failed with `duplicate symbol 'modal.client.ObjectCreationType'` (hit while load-testing on Anyscale). The packages now carry a `ray_sandbox_facade.` prefix, and the generated gRPC stubs are rewritten to the external method paths, so the wire is unchanged: the regenerated `_grpc.py` files are byte-identical, every served path exists in the SDK's stubs, and the SDK's serialized messages parse into the vendored classes. `_proto/README.md` documents the regeneration step. - **`SandboxTerminate` no longer kills a host whose `terminate()` outlasts the wait** (Bugbot). As in the REST `DELETE`, the queued terminate finishes (with ray-project#65633's boot fix it first deletes a container that was still starting) and the host exits on its own. - **Exec records outlive fast traffic.** The SDK reads a command's stdout and stderr lazily, often after `wait()` returned. With the 1,000-record cap, a finished record lasted about a second at 700 execs/s and a late read got `NOT_FOUND`. Finished records now stay 120 s (hard cap 50,000), evicted by a bounded O(1) scan instead of a full-table copy per exec. - **Event loop:** resolver calls (create, lookups, kill) run in worker threads, and creates reuse one ActorClass (ray-project#65633). With real `SandboxHost` actors on a local Ray cluster and the Modal SDK issuing 48 concurrent creates, throughput went from 56 to 353–550 creates/s, the create RPC's p50 from 387 ms to 78–104 ms, and the facade's worst event-loop stall during the burst from 838 ms to 36 ms. Exec throughput is unchanged (about 1.3k/s on that machine). - **Malformed input is `INVALID_ARGUMENT`, not `INTERNAL`:** a bare `FROM` line, and fs-tools commands whose JSON isn't an object with an object payload (gemini, on ray-project#66359). - The image-seeding symlink finding (Bugbot) was fixed in ray-project#65992 before it merged (`_resolve_in_root`); `image_utils.py` is no longer part of this diff. - **Second pass** (Bugbot on the update): importing the facade no longer needs FastAPI (it takes the resolver from ray-project#65633's `http/resolver.py`), so it needs only `grpclib` and `ray[default]`, as the docs now say. Buffered `WriteFile` content is capped at `max_file_bytes` (`RESOURCE_EXHAUSTED` past it), and named-create retries re-send the idempotent `boot()`. ## Related issue number Follows ray-project#65633 (merged). ## Checks - `test_grpc_facade.py` drives the facade end to end over gRPC with the vendored stubs, and `test_modal_client.py` with the unmodified Modal SDK, both backed by the same fake resolver and runtime seams the REST app tests use. They skip when `grpclib` (and, for the latter, `modal`) is absent, so the sandbox core CI job, which installs neither, adds no new dependency. Ran locally with grpclib 0.4.9 and modal 1.5.5: `pytest --import-mode=importlib python/ray/experimental/sandbox/http/tests/` → 101 passed (21 wire tests, 3 Modal-client tests, and the 77-test HTTP API suite). - The facade module is never imported from `sandbox/__init__.py` or the REST `app.py` import graph, so it stays inert unless explicitly run. - `ruff check`, `ruff check --select I`, `black`, and `pydoclint` (the pre-commit versions and flags) pass on the changed files. - This PR was prepared with AI assistance. It is not a duplicate: it is one step of the Ray Sandbox series (ray-project#65570 → ray-project#65992 → ray-project#65942 → ray-project#65633 → ray-project#65839 → ray-project#66359), and no other open PR covers it (ray-project#66089, a KubeRay + Modal SDK guide, builds on it). Signed-off-by: xyuzh <[email protected]>
nadongjun
pushed a commit
to nadongjun/ray
that referenced
this pull request
Oct 6, 2026
## Description KubeRay is one of the most-visited areas of the Ray docs, but it sits two levels down under Ray Clusters, and every KubeRay URL carries a redundant `cluster/kubernetes/` prefix. This PR promotes KubeRay to a top-level entry in the left sidebar and shortens its URLs by moving the KubeRay docs from `doc/source/cluster/kubernetes/` to `doc/source/kuberay/`. It replaces the top-nav tab approach from ray-project#65438. All the Ray on Kubernetes docs move to `kuberay/`. KubeRay is the officially supported way to run Ray on Kubernetes, and the docs already removed the examples for deploying Ray manually (ray-project#53833). The few guides that apply to Ray on Kubernetes more broadly still use KubeRay for their examples, so they stay with the rest of the KubeRay docs. The old `cluster/kubernetes/index` landing page becomes a short `cluster/kubernetes.md` page under Ray Clusters. It points readers to KubeRay, says that a manual deployment is possible but not officially supported, and lists the KubeRay guides that can help with other Ray on Kubernetes deployments. The KubeRay landing page now covers only KubeRay. Previews: - [Ray on Kubernetes](https://anyscale-ray--66674.com.readthedocs.build/en/66674/cluster/kubernetes.html) - [KubeRay](https://anyscale-ray--66674.com.readthedocs.build/en/66674/kuberay/index.html) **Please review commit by commit.** Each commit is scoped so it can be signed off on its own. The PR squash-merges as one change. Commits 3 through 5 came out of an earlier round of review, which kept KubeRay-independent guides in a general `cluster/kubernetes/` section. Commits 6 through 8 reverse that: they move those guides back under KubeRay and turn the general section into a single page. If you're reviewing for the first time, read commits 3 through 5 with the reversal in mind. The final state is what commits 1, 2, and 6 through 8 describe. ## Related issues Related to ray-project#65438, which this replaces. ## Additional information ### Commit 1: path change What to sign off on: every file shows as a git rename, and the only content deltas are path references that have to move with the files. - Moves `cluster/kubernetes/` to `kuberay/`, which is 128 files, all detected as renames. The tree moves as a unit, so the relative `images/` and `configs/` paths inside it stay valid. - Renames within the move, since every URL changes anyway: - Hub pages move into their directories as `index.md`: `benchmarks`, `examples`, `getting-started`, `references`, `troubleshooting`, `user-guides`, and `k8s-ecosystem`. - `k8s-ecosystem/` becomes `ecosystem/`. - Drops the redundant `kuberay-` filename prefix from 10 pages: `getting-started/operator-installation`, and `user-guides/auth`, `auth-rbac`, `dashboard`, `gcs-ft`, `gcs-persistent-ft`, `gcs-rocksdb-ft`, `history-server`, `mtls`, `serve-high-throughput`. - Path references updated with the move: - Toctrees and `{doc}`/`:doc:`/relative Markdown links inside and outside the tree (`ray-core/`, `serve/`, `ray-observability/`, `ray-overview/`, `cluster/`). - `.github/CODEOWNERS`: same owners, new path. - `.vale.ini`: the path-scoped KubeRay style section. - `conf.py`: adds `kuberay` to `all_toc_libs`. The directory scan only picks up `ray-*` names, so without this entry `DOC_LIB=<lib>` single-library builds would stop excluding KubeRay, and `DOC_LIB=kuberay` wouldn't work. It previously rode along with `cluster`. - `/en/master/` links in the JAX trainer example `README.md` and `.ipynb`. - Path mentions in `ray-contribute/writing-style.md`, `doc/.claude/skills/rst-to-myst/SKILL.md`, and the `_ext/llms_txt.py` docstring example. - Left alone on purpose: - `(kuberay-*)=` and `(k8s-*)=` label definitions and every label-targeted ref, since labels don't depend on filenames. - Absolute `docs.ray.io/en/latest/...` and release-pinned links in prose and in `python/ray/autoscaler/_private/kuberay/autoscaling_config.py`. The redirects below cover them. Rewriting `/en/latest/` links before a release ships the new paths would break them. **Redirects** (`doc/redirects/current.yaml`): - Specific `page` rules for the 7 hubs, the `k8s-ecosystem/*` prefix, and the 10 prefix drops, placed before the directory wildcard `/cluster/kubernetes/*` → `/kuberay/:splat`. - The existing catch-all `/cluster/kubernetes/*` → `/cluster/kubernetes/index.html` moves to `from: /kuberay/*` with its `to:` unchanged, so older releases keep resolving. - `rtd-redirects validate`: 0 errors, 0 warnings. Chain notes go from 58 to 78. - `rtd-redirects simulate --prefix /cluster/kubernetes/` passes on master, latest, `releases-2.58.0`, `releases-2.40.0`, and `releases-2.20.0`: 0 regressions, 0 wrong landings, 0 new loops on every version. Final state, all eight commits, run with `--git-renames doc/source` and each release's `objects.inv` as its page set: | Version | 0 hops | 1 hop | 2 hops | 3 hops | |---|---|---|---|---| | master (after) | 0 | 271 | 11 | 11 | | latest | 97 | 240 | 16 | 0 | | releases-2.58.0 | 96 | 240 | 17 | 0 | | releases-2.40.0 | 75 | 173 | 40 | 0 | | releases-2.20.0 | 66 | 173 | 49 | 0 | Every page under `/cluster/kubernetes/` on master today reaches its new path in one hop, including the storage and image pull latency guides and the landing page itself, `/cluster/kubernetes/index.html`, which lands on `/kuberay/index.html`. No master URL resolves without a redirect, because nothing stays under `/cluster/kubernetes/`. The new `cluster/kubernetes.html` page is a new URL. The 3-hop entries on master are URLs that don't match any current page, such as pages removed before this PR. They go from `/cluster/kubernetes/<page>` to `/kuberay/<page>`, then through the `/kuberay/*` catch-all to `/cluster/kubernetes/index.html`, then through the wildcard to `/kuberay/index.html`. They land on the KubeRay landing page, which is the page they reached before. The catch-all's `to:` stays `/cluster/kubernetes/index.html` so older releases, which have no `kuberay/` directory, keep resolving without a loop. The 2-hop entries on older releases are KubeRay pages newer than that release, and they land on the same index page as before. The remaining 2-hop entries are pre-existing chains outside KubeRay, such as RLlib and Tune. **llms.txt shards.** RtD page redirects fire on any 404 path, not only `.html`. On today's master, `/en/master/cluster/kubernetes/no-such-file.txt` already 301s through the existing `/cluster/kubernetes/*` catch-all. The local build emits `kuberay/llms-full.txt`, so `/cluster/kubernetes/llms-full.txt` reaches it through the directory wildcard in one hop, with no extra rule. `simulate` reports that URL as landing on the index instead, because its page sources only list HTML pages. It reports the same URL as missing on today's master, where it returns 200. ### Commit 2: navigation What to sign off on: sidebar order only. - Root toctree: adds `KubeRay <kuberay/index>` directly above Ray Core, and moves `Ecosystem` from above Ray Core to directly below APIs. - Removes `Deploying on Kubernetes` from the Ray Clusters toctree, so KubeRay has one parent. Commit 4 restores the entry for the general section. - `navbar.yml` doesn't reference KubeRay pages, so it doesn't change. ### Commit 3: keep KubeRay-independent content in `cluster/kubernetes/` Commit 7 reverses the page moves in this commit. The config file stays where this commit puts it. What to sign off on: these files don't depend on the KubeRay operator, and they keep their master paths. - Moves back to `cluster/kubernetes/`, as git renames: - `user-guides/storage.md`, with its two images. - `user-guides/reduce-image-pull-latency.md`. - `configs/static-ray-cluster.tls.yaml`. It's a plain-Deployment Ray cluster with no KubeRay, left over from the page ray-project#53833 removed, and its only consumer is `ray-core/configure.md`. Keeping it in place means that file's raw GitHub link doesn't change at all, so existing copies of the link keep working. - `.github/CODEOWNERS`: keeps the `/doc/source/cluster/kubernetes/` entry alongside the new `/doc/source/kuberay/` one, with the same owners. - `.vale.ini`: registers the KubeRay style for both paths. - The two pages need no redirects, because RtD page redirects only fire on a 404. ### Commit 4: general Ray on Kubernetes section Commit 7 replaces this section with a single page, `cluster/kubernetes.md`. What to sign off on: navigation only, plus a minimal index page. - Adds `cluster/kubernetes/index.md` as the parent for the two general guides. It links to KubeRay for deploying and managing Ray clusters with the operator. It's intentionally short for now. - Restores `Deploying on Kubernetes` in the Ray Clusters toctree, now pointing at that page. KubeRay keeps a single parent, the root toctree. - Moves the two guides from the KubeRay user-guides toctree to the new index. The KubeRay user-guides list keeps both as cross-references. - Updates the Ray on Kubernetes path mention in `ray-contribute/writing-style.md`. ### Commit 5: landing pages Commits 6 and 8 revise both pages again. What to sign off on: prose on the two index pages. - `kuberay/index.md`: retitles the page from "Ray on Kubernetes" to "KubeRay" and rewrites the opening as an introduction to KubeRay, without the "Overview" heading. The `kuberay-index` label moves to the H1, so its existing refs keep resolving. The custom resource list adds RayCronJob, so it names all four `ray.io/v1` kinds. The page links to the general section. - `cluster/kubernetes/index.md`: lists the operators that deploy and manage Ray clusters on Kubernetes, which are KubeRay and the Anyscale operator, with a link to the Anyscale on Kubernetes docs. ### Commit 6: center the KubeRay landing page on KubeRay What to sign off on: prose on the two landing pages. - `kuberay/index.md`: removes the Anyscale paragraph. Reframes the card grid and the "Learn more" lead-in around KubeRay rather than Kubernetes in general, and sentence-cases the card titles and buttons. Folds the one-item "About KubeRay" list into prose. - `cluster/kubernetes/index.md`: cuts the Anyscale operator entry to one line that links to the Anyscale docs. ### Commit 7: move the general guides back under KubeRay What to sign off on: path changes only, with no prose edits. - Moves `storage.md`, its two images, and `reduce-image-pull-latency.md` back to `kuberay/user-guides/` as git renames, and restores both guides to the KubeRay user-guides toctree in their original positions. - Renames `cluster/kubernetes/index.md` to `cluster/kubernetes.md`, since it no longer has child pages. The Ray Clusters toctree points at the new path. - Leaves `cluster/kubernetes/configs/static-ray-cluster.tls.yaml` in place, so the raw GitHub link in `ray-core/configure.md` doesn't change. - `.github/CODEOWNERS`: adds `/doc/source/cluster/kubernetes.md` and keeps the `/doc/source/cluster/kubernetes/` entry for the config file. `.vale.ini` and `ray-contribute/writing-style.md` point at the new page path. - Needs no new redirects. The old master URLs of the two guides reach their new paths in one hop through the existing `/cluster/kubernetes/*` wildcard. ### Commit 8: rewrite the Ray on Kubernetes page What to sign off on: prose on `cluster/kubernetes.md`. - States that KubeRay is the officially supported way to run Ray on Kubernetes, and that a manual deployment without an operator is possible but not officially supported. - Keeps a one-line pointer to the Anyscale docs for the Anyscale operator. - Adds a "KubeRay guides that apply more broadly" section, which links to the storage and dependencies, image pull latency, managed Kubernetes cluster setup, and scheduling guides. Their examples use KubeRay, and the section says so. ### Out of scope - Expanding `cluster/kubernetes.md` beyond its pointer to KubeRay and the guide list. - Reworking the Ray Clusters landing page prose and cards that still describe Kubernetes as one of two deployment paths. - `user-guides/k8s-*` slugs (`k8s-autoscaler`, `k8s-cluster-setup`, `k8s-events`), `persist-kuberay-*-logs`, and `troubleshooting/troubleshooting.md`. Reviewers: if you'd like any of these renamed, say so, and it can go in a follow-up so this PR stays a pure move. ### Verification - `make -C doc rtd-build` (RtD-faithful, `-W --keep-going`) builds clean for commits 1 and 2, and for the state after commit 5: `build succeeded.`, exit 0. The RtD preview build is the check for commits 6 through 8. - `rtd-redirects validate`: 0 errors, 0 warnings on the final state. `rtd-redirects simulate` reports 0 regressions, 0 wrong landings, and 0 new loops on every version in the table above. - Rebased onto master. The only conflict was `ray-observability/ray-distributed-debugger`, which master converted from RST to MyST. Commit 1 applies its two quickstart link updates to the new `.md` file. - Commit 1 shows all 128 targets as renames in `git show --stat --find-renames`. ### Coordination Open PRs touching this directory will need a rebase onto the new paths after this merges: ray-project#65848, ray-project#65709, ray-project#65965, ray-project#66089, ray-project#65840. I'll handle those rebases. Git rename detection should carry most of them over cleanly. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: Douglas Strodtman <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
|
This pull request has been automatically closed because there has been no more activity in the 14 days Please feel free to reopen or open a new pull request if you'd still like this to be addressed. Again, you can always ask for help on our discussion forum or Ray's public slack channel. Thanks again for your contribution! |
pawelbeza
pushed a commit
to pawelbeza/ray
that referenced
this pull request
Oct 23, 2026
…roject#65839) ## Why are these changes needed? ray-project#65992, ray-project#65942, and ray-project#65633 have merged, and this PR is rebased onto master, so the diff is the facade commit alone. ray-project#66359 stacks on it. ray-project#65633 (merged) exposes the sandbox control plane as a REST service. This PR adds a gRPC facade in front of the same detached `SandboxHost` actors, so an unmodified third-party sandbox client SDK pointed at this server can create sandboxes, exec commands, and use its filesystem API against a Ray cluster. The facade implements the subset of the SDK's control-plane (`ModalClient`) and command-router (`TaskCommandRouter`) services that its Sandbox API uses. The wire contract is vendored under `http/_proto/` as a minimal protobuf/grpclib stub set generated from checked-in `.proto` sources, so nothing third-party is needed to build or test. gRPC routes on the fully qualified method path and protobuf frames fields by number, so the vendored service, method, and field identifiers reproduce the external service's on-the-wire names verbatim; only the surface the facade uses is declared. The proto packages carry a `ray_sandbox_facade.` prefix that never reaches the wire, so the stubs can share a process with the client SDK. Design: - **Stateless where possible.** Object ids carry their payload (`im-<b64 image ref>`, `st-<b64 env json>`) and the sandbox id doubles as the client task id. Named creates are scoped to the client app and idempotent; a dead actor under a live name is killed and recreated. The one in-process table is the exec table, which keeps finished records for 120 s (the SDK reads output lazily) under a 50,000-record cap, so run a single facade process per cluster. - **Filesystem API via exec emulation.** The SDK implements its filesystem API by exec-ing a helper binary that sandbox images don't contain. The router recognizes its argv and emulates WriteFile / ReadFile / ListFiles with `SandboxHost` file operations; large writes flush in bounded slices. - **Scheduling-aware.** Every actor call is bounded, so an unscheduled actor on a scaling cluster surfaces as `UNAVAILABLE` (retried by the SDK) instead of hanging, and a dead actor maps to `NOT_FOUND` (the SDK's "task shut down" signal). Run with `python -m ray.experimental.sandbox.http.grpc_facade` (requires `grpclib`). Documented in the sandboxes guide under the HTTP API service section. One commit: the vendored wire contract (`.proto` sources, generated stubs, lint excludes), the facade, its tests, and docs. Review fixes that touch code shared with the lower PRs (`name:group` exec-user resolution, a bounded runsc download, a bounded `DELETE`, docs wording) live on those branches and are included here through the stack. Review fixes from the 2026-09-15 pass: - A `cidr_allowlist` the facade cannot enforce now fails `SandboxCreate` with `INVALID_ARGUMENT` instead of granting open egress behind a server-side warning, and `TaskSetNetworkAccess` fails with `UNIMPLEMENTED` instead of being acknowledged and ignored, so a client never runs with fewer restrictions than it asked for. - `TaskExecStart` reserves the exec id before anything reaches the actor and carries the start in its own task. A retry (the SDK retries `UNAVAILABLE`, which the facade answers when the actor has not replied within the scheduling grace) joins that in-flight start instead of running the command again; a start that fails for good is forgotten so a retry may start afresh. A test holds the first start in flight past the grace, retries, and checks the command ran once. - The exec record kind is `sandbox` or `fs` (was `host`), since both run in the sandbox. Update (2026-09-24), rebased onto the new ray-project#65633: - **Tests with the Modal client** (review request): `test_modal_client.py` runs the unmodified `modal` SDK (1.5.5) against the facade: create, exec with exit codes and stdout/stderr, `filesystem.write_bytes` / `read_bytes` including the typed not-found error, terminate, and the network-policy mappings. - **The facade and the Modal SDK can share a process.** The vendored protos declared `package modal.client`, which registered the same full names as the SDK's own protos in protobuf's process-wide descriptor pool, so importing both failed with `duplicate symbol 'modal.client.ObjectCreationType'` (hit while load-testing on Anyscale). The packages now carry a `ray_sandbox_facade.` prefix, and the generated gRPC stubs are rewritten to the external method paths, so the wire is unchanged: the regenerated `_grpc.py` files are byte-identical, every served path exists in the SDK's stubs, and the SDK's serialized messages parse into the vendored classes. `_proto/README.md` documents the regeneration step. - **`SandboxTerminate` no longer kills a host whose `terminate()` outlasts the wait** (Bugbot). As in the REST `DELETE`, the queued terminate finishes (with ray-project#65633's boot fix it first deletes a container that was still starting) and the host exits on its own. - **Exec records outlive fast traffic.** The SDK reads a command's stdout and stderr lazily, often after `wait()` returned. With the 1,000-record cap, a finished record lasted about a second at 700 execs/s and a late read got `NOT_FOUND`. Finished records now stay 120 s (hard cap 50,000), evicted by a bounded O(1) scan instead of a full-table copy per exec. - **Event loop:** resolver calls (create, lookups, kill) run in worker threads, and creates reuse one ActorClass (ray-project#65633). With real `SandboxHost` actors on a local Ray cluster and the Modal SDK issuing 48 concurrent creates, throughput went from 56 to 353–550 creates/s, the create RPC's p50 from 387 ms to 78–104 ms, and the facade's worst event-loop stall during the burst from 838 ms to 36 ms. Exec throughput is unchanged (about 1.3k/s on that machine). - **Malformed input is `INVALID_ARGUMENT`, not `INTERNAL`:** a bare `FROM` line, and fs-tools commands whose JSON isn't an object with an object payload (gemini, on ray-project#66359). - The image-seeding symlink finding (Bugbot) was fixed in ray-project#65992 before it merged (`_resolve_in_root`); `image_utils.py` is no longer part of this diff. - **Second pass** (Bugbot on the update): importing the facade no longer needs FastAPI (it takes the resolver from ray-project#65633's `http/resolver.py`), so it needs only `grpclib` and `ray[default]`, as the docs now say. Buffered `WriteFile` content is capped at `max_file_bytes` (`RESOURCE_EXHAUSTED` past it), and named-create retries re-send the idempotent `boot()`. ## Related issue number Follows ray-project#65633 (merged). ## Checks - `test_grpc_facade.py` drives the facade end to end over gRPC with the vendored stubs, and `test_modal_client.py` with the unmodified Modal SDK, both backed by the same fake resolver and runtime seams the REST app tests use. They skip when `grpclib` (and, for the latter, `modal`) is absent, so the sandbox core CI job, which installs neither, adds no new dependency. Ran locally with grpclib 0.4.9 and modal 1.5.5: `pytest --import-mode=importlib python/ray/experimental/sandbox/http/tests/` → 101 passed (21 wire tests, 3 Modal-client tests, and the 77-test HTTP API suite). - The facade module is never imported from `sandbox/__init__.py` or the REST `app.py` import graph, so it stays inert unless explicitly run. - `ruff check`, `ruff check --select I`, `black`, and `pydoclint` (the pre-commit versions and flags) pass on the changed files. - This PR was prepared with AI assistance. It is not a duplicate: it is one step of the Ray Sandbox series (ray-project#65570 → ray-project#65992 → ray-project#65942 → ray-project#65633 → ray-project#65839 → ray-project#66359), and no other open PR covers it (ray-project#66089, a KubeRay + Modal SDK guide, builds on it). Signed-off-by: xyuzh <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add a KubeRay deployment example for using the official Modal Python SDK with Ray's sandbox gRPC facade. The existing guide only demonstrates the native Ray API through a RayJob; this example provides a persistent RayCluster, a single facade sidecar, a ClusterIP Service, and a downloadable SDK client that writes a file, executes Python, checks a file round trip, and terminates the sandbox.
The facade shares the head Pod's process namespace and
/tmp/rayso the native Ray driver can discover the local raylet and access its sockets. The guide explains the client-facing command-router address, loopback port forwarding, authentication limitations, worker-local image caches, and cleanup.Dependencies and duplicate-work check
Draft: depends on #65839 and its base #65633. The guide explicitly labels this as a development preview tested against facade commit
259c9a3dd654478bac4784ca01923049c7172846, not a feature available in the released Ray 2.58.0 image. Revalidate and update the version prerequisites when those PRs land.This follows Andrew Sy Kim's suggestion to extend the KubeRay sandboxing user guide. Searched open Ray PRs for
sandbox KubeRay,sandbox SDK, andsandbox documentation, and open KubeRay PRs forsandbox. #65839 documents the facade in the core sandbox guide; it does not provide this KubeRay deployment manifest or downloadable SDK workflow. No competing KubeRay SDK guide PR was found. This change does not reimplement the facade or image-cache work in #65992.Validation
kubectl apply --dry-run=server -f doc/source/cluster/kubernetes/configs/ray-sandbox-sdk.yaml— passed.RAY_SANDBOX_GRPC_URL=http://127.0.0.1:15051 python doc/source/cluster/kubernetes/examples/ray_sandbox_sdk.pywith officialmodal==1.5.5— passed twice, with cold and warm image caches. Both runs printed the documented output. Ray ALIVE actors and runsc containers were empty afterward.black --check doc/source/cluster/kubernetes/examples/ray_sandbox_sdk.py,ruff checkandruff check --select Ion that file — passed.pre-commit run --files <the three changed files>— passed; the repository's global exclude skips this docs subtree, so the Python checks above were also run explicitly.sphinx-build -W -b html— passed. Cross-project reference labels were stubbed in the isolated harness; the full documentation build remains unverified.make -C doc rtd-build— attempted, but the repository preflight exited withCould not run the RtD fidelity check: no pinned versions parsed from requirements-doc.lock.txt, before Sphinx started. In this checkout the tracked symlink is materialized as a regular file containing its target path (../python/deplocks/docs/docbuild_depset_py3.11.lock). This environment issue and full-build validation need resolving before marking the draft ready.git diff --check— passed.The prerequisite custom image build itself was not rebuilt as part of this documentation validation; testing reused the pinned image from the SDK investigation. This is a deployment smoke test, not a production or scalability claim.
AI assistance and human review
AI assistance was used to draft the documentation and example, diagnose the deployment, and run validation. This PR remains a draft pending human line-by-line review and a local rerun before requesting maintainer review, as required by AGENTS.md.