Repository navigation
[doc] Convert the running-applications pages to MyST - #66679
Conversation
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Douglas Strodtman <[email protected]>
Whitespace only, verified by ray-soft-wrap's verify.py. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Douglas Strodtman <[email protected]>
There was a problem hiding this comment.
Code Review
This pull request migrates several documentation files related to Ray Job Submission and Cluster Scaling from reStructuredText (.rst) to MyST Markdown (.md) format. The review feedback highlights a few issues in the newly formatted files: specifically, two Python code errors in rest.md (an undefined JobStatus reference causing a NameError and an invalid .json() call on a dictionary causing an AttributeError), as well as minor syntax formatting issues in sdk.md and ray-client.md where backticks are incorrectly formatted or escaped.
| rst = json.loads(resp.text) | ||
| status = rst["status"] | ||
| print(f"status: {status}") | ||
| if status in {JobStatus.SUCCEEDED, JobStatus.STOPPED, JobStatus.FAILED}: |
There was a problem hiding this comment.
The REST API returns the job status as a string (e.g., "SUCCEEDED", "STOPPED", "FAILED"). Since JobStatus is not imported or defined in this Python example, referencing JobStatus.SUCCEEDED will raise a NameError. Using string literals directly is cleaner and works out of the box without requiring Ray imports.
| if status in {JobStatus.SUCCEEDED, JobStatus.STOPPED, JobStatus.FAILED}: | |
| if status in {"SUCCEEDED", "STOPPED", "FAILED"}: |
There was a problem hiding this comment.
Applied in 240dee9. The REST API returns the status as a plain string, so the literals work without importing JobStatus.
| rst = json.loads(resp.text) | ||
| json = rst.json() | ||
| stopped = json["stopped"] | ||
| print(stopped) |
There was a problem hiding this comment.
The current code parses the response body using json.loads(resp.text) into a dictionary rst, and then attempts to call rst.json(). This will raise an AttributeError: 'dict' object has no attribute 'json'. Additionally, assigning the result to a variable named json overrides the imported json module. Using resp.json() directly is the standard and correct way to parse JSON responses with the requests library.
| rst = json.loads(resp.text) | |
| json = rst.json() | |
| stopped = json["stopped"] | |
| print(stopped) | |
| rst = resp.json() | |
| stopped = rst["stopped"] | |
| print(stopped) |
| ``` | ||
|
|
||
| :::{tip} | ||
| By default, the Ray job server will generate a new `job_id` and return it, but you can alternatively choose a unique `job_id` string first and pass it into {code}`submit_job`. In this case, the Job will be executed with your given id, and will throw an error if the same `job_id` is submitted more than once for the same Ray cluster. |
There was a problem hiding this comment.
The Sphinx-style role {code}submit_jobcan be simplified to standard Markdown inline code submit_job `` for better readability and consistency with MyST Markdown guidelines.
| By default, the Ray job server will generate a new `job_id` and return it, but you can alternatively choose a unique `job_id` string first and pass it into {code}`submit_job`. In this case, the Job will be executed with your given id, and will throw an error if the same `job_id` is submitted more than once for the same Ray cluster. | |
| By default, the Ray job server will generate a new `job_id` and return it, but you can alternatively choose a unique `job_id` string first and pass it into `submit_job`. In this case, the Job will be executed with your given id, and will throw an error if the same `job_id` is submitted more than once for the same Ray cluster. |
There was a problem hiding this comment.
Leaving this as is. The original RST uses the :code: role, and {code} is its direct MyST equivalent. Switching to plain backticks changes the rendered HTML classes, which this format-only conversion avoids.
| :::{warning} | ||
| Anyone with Ray Client access can execute arbitrary code on the Ray Cluster. | ||
|
|
||
| **Do not expose this to \`0.0.0.0/0\`.** |
There was a problem hiding this comment.
The backticks around the IP address are escaped (\0.0.0.0/0`), which renders them as literal backticks in the output. Using standard Markdown inline code backticks (`` 0.0.0.0/0` ``) will correctly render the IP address as monospaced text inside the bold warning block.
| **Do not expose this to \`0.0.0.0/0\`.** | |
| **Do not expose this to `0.0.0.0/0`.** |
There was a problem hiding this comment.
Applied in 240dee9. The escape matched the literal backticks that /en/master shows, but those are an RST rendering bug, so this fixes them.
Addresses gemini-code-assist review comments. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Douglas Strodtman <[email protected]>
## Summary
Converts the seven `doc/source/cluster/running-applications/` pages that
are still reStructuredText from RST to MyST Markdown, as part of the
ongoing RST-to-MyST migration of `doc/source/`. These are the Ray Jobs
quickstart, SDK overview, REST API, CLI reference, and SDK reference,
plus Ray Client and the autoscaler SDK reference. This is a format-only
change, apart from the fixes noted below. The rendered pages should
otherwise match `/en/master`.
The PR has three commits:
1. The conversion, which keeps the source line wrapping so it reads line
by line against the `.rst`.
2. A whitespace-only soft-wrap pass, verified by `ray-soft-wrap`'s
`verify.py`.
3. Review fixes to the `rest` examples and the `ray-client` warning.
## Conversion notes
- `sphinx-click` (`click::`), `autofunction`, `autosummary`, and
`currentmodule` directives are wrapped in `{eval-rst}`, following
`serve/api/cli.md`, `ray-core/api/sandboxes.md`, and
`serve/api/index.md`. Each `ray-job-*-doc` label stays inside the
`{eval-rst}` block with its `click::` directive, so it still targets the
generated command section.
- One `quickstart` code block was indented with tabs. It's rebuilt with
docutils' 8-column tab expansion, and the text matches the `/en/master`
render.
- `ray-client` had two empty RST comments (`..`) above code blocks. They
rendered nothing and carried no text, so they're dropped.
- **Rendering fix.** In `ray-client`, the bold warning "Do not expose
this to `0.0.0.0/0`" shows literal backticks on `/en/master`, because
RST doesn't nest inline markup. Markdown does, so `0.0.0.0/0` now
renders as inline code inside the bold text.
- **Broken examples fixed.** Two `rest` examples fail when run, and both
bugs predate this PR. The polling loop compared against `JobStatus.*`
without importing it, which raises `NameError`. It now compares against
the status strings the REST API returns. The stop example called
`.json()` on an already-parsed dict and rebound the `json` module name.
It now uses `resp.json()`.
- Bare URLs in `quickstart` are wrapped as `<https://...>` autolinks
because MyST's `linkify` is off.
Every label is preserved. `cluster/package-overview.rst` lists three of
these pages in its toctree with an `.rst` suffix. Sphinx strips a known
source suffix from toctree entries, so those entries still resolve, and
a separate conversion PR converts that page. No other caller references
these pages by file path. None of the pages has doctest blocks, and
`doc/BUILD.bazel` doesn't name them.
## Overlapping open PRs
ray-project#65693 adds 8 lines to `job-submission/sdk.rst`. After this merges, that
change moves to `sdk.md`.
## Duplicate check
No other open PR converts these files. I checked every open PR's file
list.
## Testing
- Static checks on each new `.md`: frontmatter parses, fences balance,
no residual RST outside fences, no `.html#` or `.rst` link targets,
every label present.
- `python3 doc/.claude/skills/ray-soft-wrap/scripts/verify.py`: passed.
- RtD preview build: green under `fail_on_warning` before the review
fixes. The rebuild for the latest commit is pending.
- `render_diff.py` against `/en/master`, run before the review fixes: 7
of 7 pages render identically. The review fixes intentionally change the
`ray-client` warning and the `rest` code blocks.
AI assistance (Claude Code) was used for this conversion. I review every
changed line before requesting review.
🤖 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]>
Summary
Converts the seven
doc/source/cluster/running-applications/pages that are still reStructuredText from RST to MyST Markdown, as part of the ongoing RST-to-MyST migration ofdoc/source/. These are the Ray Jobs quickstart, SDK overview, REST API, CLI reference, and SDK reference, plus Ray Client and the autoscaler SDK reference. This is a format-only change, apart from the fixes noted below. The rendered pages should otherwise match/en/master.The PR has three commits:
.rst.ray-soft-wrap'sverify.py.restexamples and theray-clientwarning.Conversion notes
sphinx-click(click::),autofunction,autosummary, andcurrentmoduledirectives are wrapped in{eval-rst}, followingserve/api/cli.md,ray-core/api/sandboxes.md, andserve/api/index.md. Eachray-job-*-doclabel stays inside the{eval-rst}block with itsclick::directive, so it still targets the generated command section.quickstartcode block was indented with tabs. It's rebuilt with docutils' 8-column tab expansion, and the text matches the/en/masterrender.ray-clienthad two empty RST comments (..) above code blocks. They rendered nothing and carried no text, so they're dropped.ray-client, the bold warning "Do not expose this to0.0.0.0/0" shows literal backticks on/en/master, because RST doesn't nest inline markup. Markdown does, so0.0.0.0/0now renders as inline code inside the bold text.restexamples fail when run, and both bugs predate this PR. The polling loop compared againstJobStatus.*without importing it, which raisesNameError. It now compares against the status strings the REST API returns. The stop example called.json()on an already-parsed dict and rebound thejsonmodule name. It now usesresp.json().quickstartare wrapped as<https://...>autolinks because MyST'slinkifyis off.Every label is preserved.
cluster/package-overview.rstlists three of these pages in its toctree with an.rstsuffix. Sphinx strips a known source suffix from toctree entries, so those entries still resolve, and a separate conversion PR converts that page. No other caller references these pages by file path. None of the pages has doctest blocks, anddoc/BUILD.bazeldoesn't name them.Overlapping open PRs
#65693 adds 8 lines to
job-submission/sdk.rst. After this merges, that change moves tosdk.md.Duplicate check
No other open PR converts these files. I checked every open PR's file list.
Testing
.md: frontmatter parses, fences balance, no residual RST outside fences, no.html#or.rstlink targets, every label present.python3 doc/.claude/skills/ray-soft-wrap/scripts/verify.py: passed.fail_on_warningbefore the review fixes. The rebuild for the latest commit is pending.render_diff.pyagainst/en/master, run before the review fixes: 7 of 7 pages render identically. The review fixes intentionally change theray-clientwarning and therestcode blocks.AI assistance (Claude Code) was used for this conversion. I review every changed line before requesting review.
🤖 Generated with Claude Code