Skip to content

[core][gcs] Bound retained finished job metadata - #65693

Closed
zhjwpku wants to merge 2 commits into
ray-project:masterfrom
zhjwpku:gcs-finished-job-retention
Closed

zhjwpku wants to merge 2 commits into
ray-project:masterfrom
zhjwpku:gcs-finished-job-retention

Conversation

@zhjwpku

@zhjwpku zhjwpku commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

Description

Finished JobTableData rows are currently retained indefinitely. In persistent, high-churn clusters, Redis memory usage, full-table reads, and GCS restart loading grow with cluster lifetime rather than the useful history window.

This PR adds maximum_gcs_dead_job_cached_count, with a default of 10,000, to bound retained finished driver-job records. Finished jobs are ordered deterministically by end time and JobID. Overflow is deleted using the existing bounded GCS deletion batch size, and the retention index is rebuilt after a GCS restart so persisted rows and lowered limits are also covered. Successful evictions are reported through gcs_finished_job_evictions_total.

A finished driver does not always make its job metadata observability-only. Detached actors may outlive the driver and still need the originating job config and exported function metadata. This PR restores actor references before rebuilding finished-job retention state, pins referenced records, and makes them evictable only after the final operational reference is released.

Cleanup also handles reference changes during asynchronous deletion. It rechecks references when a deletion finishes and restores the persisted JobTableData without dropping the cached job config if a reference was added in flight. Retried MarkJobFinished requests release the driver reference only once, so they cannot consume references held by detached actors.

Ray Jobs API submission metadata remains in separate InternalKV storage. This policy bounds core State API driver history without deleting submission history, although driver details may no longer be available after the core record is evicted.

Duplicate work

I checked issue #65692 and searched open PRs for both #65692 and GCS finished-job retention. No other open PR addresses this change.

Testing

  • CCACHE_FOUND=FALSE bazel test //src/ray/gcs/tests:gcs_job_manager_test --spawn_strategy=local --jobs=4 --test_output=errors — passed
  • CCACHE_FOUND=FALSE bazel test //src/ray/gcs/tests:gcs_function_manager_test --spawn_strategy=local --jobs=4 --test_output=errors — passed
  • pre-commit run --files src/ray/gcs/gcs_function_manager.h src/ray/gcs/gcs_job_manager.h src/ray/gcs/gcs_job_manager.cc src/ray/gcs/tests/gcs_job_manager_test.cc src/ray/common/ray_config_def.h doc/source/cluster/running-applications/job-submission/sdk.rst doc/source/ray-observability/user-guides/cli-sdk.rst — passed
  • git diff --check — passed

The tests cover steady-state eviction, deterministic restart ordering, actor pinning and release, eviction triggered by a newly pinned job, references added during asynchronous deletion, and idempotent job-finish retries.

AI assistance

AI assistance was used for code inspection, implementation, tests, documentation, and drafting this PR description. The human submitter remains responsible for reviewing every changed line and defending the change.

Related issues

Closes #65692

@zhjwpku
zhjwpku requested review from a team as code owners August 24, 2026 07:10

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a mechanism to bound the history of finished jobs retained in the GCS job table for observability, preventing unbounded memory growth. It adds a configuration maximum_gcs_dead_job_cached_count (defaulting to 100,000) and implements eviction of the oldest finished jobs when this limit is exceeded. Crucially, finished jobs that are still referenced by live actors (such as detached actors) are pinned and exempt from eviction until their references are released. The changes also include documentation updates, a new system metric ray_gcs_finished_job_evictions_total, and comprehensive unit tests. Review feedback suggests a robust fallback for TrackFinishedJob in MarkJobAsFinished to use job_table_data.timestamp() if end_time is 0, ensuring consistency with the restoration logic and preventing premature eviction of jobs with missing end times.

Comment thread src/ray/gcs/gcs_job_manager.cc Outdated
gcs_publisher_.PublishJob(job_id, job_table_data);
runtime_env_manager_.RemoveURIReference(job_id.Hex());
ClearJobInfos(job_table_data);
TrackFinishedJob(job_id, job_table_data.end_time());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

In MarkJobAsFinished, job_table_data.end_time() is passed directly to TrackFinishedJob. However, if end_time is not set or is 0 (e.g., due to client-side behavior or backward compatibility), the job will be tracked with an end time of 0. This would make it the oldest job and highly susceptible to premature eviction.

To make this robust and consistent with the restore logic in RestoreFinishedJobs, we should fall back to job_table_data.timestamp() when end_time is 0.

      const int64_t end_time_ms = job_table_data.end_time() != 0
                                      ? static_cast<int64_t>(job_table_data.end_time())
                                      : job_table_data.timestamp();
      TrackFinishedJob(job_id, end_time_ms);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MarkJobAsFinished overwrites both timestamp and end_time with clock_.NowUnixMillis() immediately before persisting and tracking the job, so this path cannot inherit a zero value from the client or a legacy row. The fallback in RestoreFinishedJobs is only needed for records persisted by older Ray versions.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread src/ray/gcs/gcs_job_manager.cc Resolved
Comment thread src/ray/gcs/gcs_function_manager.h Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 280c59f1d2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/ray/gcs/gcs_job_manager.cc Outdated
Comment on lines +144 to +145
for (const auto &entry : entries_to_evict) {
cached_job_configs_.erase(entry.second);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Recheck references before finalizing an eviction

If an actor registration adds a job reference after TrimFinishedJobs() selects the job but before the asynchronous BatchDelete callback runs, this success path unconditionally erases the cached job config even though the job is now operationally referenced. A detached actor request racing with driver completion can therefore lose both its persisted job row and cached_job_configs_ entry; subsequent GetJobConfig() use can hit its RAY_CHECK. The reference must remain protected for the entire in-flight deletion, rather than being checked only before BatchDelete is issued.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eviction now loads the full JobTableData, rechecks job references immediately before BatchDelete and again in its completion callback, and keeps the cached job config when a reference appears in flight. In that case, it restores the persisted job record before continuing cleanup. TestReferenceAddedDuringEvictionRestoresJobRecord covers this race.

@ray-gardener ray-gardener Bot added core Issues that should be addressed in Ray Core community-contribution Contributed by the community labels Aug 24, 2026
@zhjwpku
zhjwpku force-pushed the gcs-finished-job-retention branch from 280c59f to 6f843d8 Compare August 24, 2026 09:23
@Kunchd Kunchd self-assigned this Aug 31, 2026
@github-actions

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had
any activity for 14 days. It will be closed in another 14 days if no further activity occurs.
Thank you for your contributions.

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.

@github-actions github-actions Bot added the stale The issue is stale. It will be closed within 7 days unless there are further conversation label Sep 15, 2026
dstrodtman added a commit that referenced this pull request Sep 28, 2026
…ervability pages to MyST (#66461)

## Why are these changes needed?

Converts the last non-API-reference RST pages under `ray-core/`,
`data/`, and `rllib/` to MyST Markdown, plus the `train/` and
`ray-observability/` pages that `doc/BUILD.bazel` names by path. The API
reference trees (`*/api/`, `rllib/package_ref/`, and
`ray-core/compiled-graph/compiled-graph-api`) stay RST for now.

Each page gets its own commit, so you can review one file at a time.
Every commit renames the page's literal `.rst` paths in
`doc/BUILD.bazel` to `.md`. These paths are in `exclude` lists and in
the explicit `files` lists of `doctest[data-gpu]` and
`doctest[train-gpu]`, and they don't glob. Without the edit, an excluded
page would silently join its target once it's `.md`, and an included
page would silently drop out of it.

Conversions are format-only: labels, headings, and prose are unchanged.
A final whitespace-only commit soft-wraps the prose. `ray-soft-wrap`'s
`verify.py` confirms non-whitespace bytes, rendered HTML, and
idempotence for all 11 files.

### `rllib/getting-started`: doctest target removed

The first commit deletes `doctest[rllib2]`, the only target over
`rllib/getting-started.rst`, before the page converts. The target is
tagged `manual` with a hang TODO, so no premerge or postmerge step has
run it, and nothing else references it (`git grep rllib2` is empty). Its
15 `testcode` blocks had no `testoutput`, so they asserted nothing. The
12 visible blocks become display-only `python` code blocks. The three
`:hide:` blocks held `.stop()` cleanups that never rendered, so they're
deleted. `doctest[rllib]` still excludes the page. If these examples
should be validated later, a `doc_code/` script is the better route than
reviving the hanging target. cc @elliot-barn, who owns the TODO.

This commit isn't buildable on its own. It turns a `.. testcode::` that
had no blank line before its body into a `.. code-block:: python`, still
with no blank line, and docutils reads the body as extra arguments to
the directive. The later conversion commit fixes it in the `.md`, and a
squash merge never puts the intermediate commit on master.

### Doctest coverage

Docs-only PRs don't run doctests premerge. This PR edits
`doc/BUILD.bazel`, so every library's docs example step runs, but
premerge can't show the conversion kept the same blocks. For that, I
parsed each `.md` and the `.rst` it replaced with Ray's `pytest-sphinx`
fork, the same parser the doctest macro runs, and asserted identical
sections (directive, body, `:options:`, `:skipif:`) and examples.

| Page | BUILD role | Examples before → after |
| --- | --- | --- |
| `ray-core/handling-dependencies` | `doctest[core]` exclude | 17 → 17 |
| `ray-core/tasks/nested-tasks` | `doctest[core]` exclude | 0 → 0
(`literalinclude` of a tested `doc_code/` file) |
| `data/batch-inference` | `doctest_each` exclude, `doctest[data-gpu]`
files | 7 → 7 |
| `data/transforming-data` | `doctest_each` exclude, `doctest[data-gpu]`
files | 24 → 24 |
| `data/contributing/contributing` | `doctest_each` glob | 0 → 0
(toctree only) |
| `rllib/getting-started` | `doctest[rllib]` exclude, `doctest[rllib2]`
removed | 15 → 0, by the removal commit |
| `ray-observability/user-guides/cli-sdk` | top-level exclude | 16 → 16
|
| `ray-observability/user-guides/ray-tracing` | top-level exclude | 3 →
3 |
| `train/horovod` | `doctest[train]` exclude | 2 → 2 |
| `train/user-guides/data-loading-preprocessing` | `doctest[train]`
exclude, `doctest[train-gpu]` files | 6 → 6 |
| `train/user-guides/using-accelerators` | `doctest[train]` exclude,
`doctest[train-gpu]` files | 10 → 10 |

To show the check would catch a broken conversion, I mutated each page
with examples three ways: dropping a `testcode` block, altering a line
in one, and turning one into a four-backtick fence. The last renders
fine but is never collected. The check failed on all 24 mutations.

### Rendering changes

I ran `render_diff.py` on all 11 pages against `/en/master`. Six render
identically: `nested-tasks`, `data/contributing/contributing`,
`cli-sdk`, `ray-tracing`, `horovod`, and `using-accelerators`. Every
difference on the other five is listed here.

- `rllib/getting-started`: on master, one `.. testcode::` line had no
blank line after it. docutils read the block's first six lines, the
`best_result = results.get_best_result(...)` call, as the directive's
argument and dropped them. So master shows code that uses `best_result`
without showing where it comes from. The converted page renders all six
lines. This is the one place the conversion deliberately doesn't
reproduce master.
- `rllib/getting-started`: the "Farama gymnasium" link now has
`https://`. On master it's a relative link to `gymnasium.farama.org`
that 404s.
- `ray-core/handling-dependencies`: MyST drops the apostrophe when it
slugifies the "can't import the packages" heading, so the section id
changes. That heading had no label, so the page adds a target carrying
the old docutils slug, and existing `#...-can-t-import-...` links still
resolve. An auto-numbered span id, which nothing links to, also changes
from `id4` to `id2`.
- `data/batch-inference` and
`train/user-guides/data-loading-preprocessing`: each renders an RST
comment as an HTML comment, which readers never see.
- `data/transforming-data`: the "When using" definition list's `<dl>`
gains the unstyled `myst` class.

The first preview diff also caught three regressions that the green
build didn't. MyST's `replacements` extension turned two `(c)` list
markers into `©` and an `etc..` into `etc…`. The anchor above had
changed too. A follow-up commit fixes all three. A sweep of the 11 pages
found no other text that extension rewrites.

### Dead `doc/BUILD.bazel` excludes

A final commit drops four `exclude` entries that name files that have
moved: two in `doctest[serve]` and two in the serve `doc_code` test. A
glob exclude naming a missing file excludes nothing, so these had
silently stopped applying. This doesn't change what any target runs.
#66462 carries the same commit, along with a lint check that fails on
this class of stale path, so the two PRs merge cleanly in either order.

### Open PRs that edit these files

Each of these open PRs edits one of the converted `.rst` files, so each
will need to move its change to the `.md`: #66279, #66191, #65956,
#65933, and #65830 (`handling-dependencies`), #65693 (`cli-sdk`), and
#66419, #66420, #66422, and #66423 (`data/batch-inference`,
`train/user-guides/data-loading-preprocessing`). #66096, #64053, and
#63881 also edit `doc/BUILD.bazel`, and only #66096 edits nearby lines.

## Related issue number

None. No open PR converts these pages. I checked `gh pr list` for open
PRs touching each file.

## Checks

- [x] I've signed off every commit (`git commit -s`).
- [x] Pre-commit hooks passed on every commit.
- Doctest parity: `python3 doctest_parity.py <the 11 .md files>` with
`pytest==7.4.4` and `pytest-sphinx @
git+https://github.com/ray-project/pytest-sphinx`. All OK, run again
after the soft-wrap commit.
- Static checks on every `.md`: fences balance, no leftover RST roles or
directives, every label from the `.rst` is present, and directive counts
match.
- Read the Docs preview builds green under `fail_on_warning`, and the
render diff against `/en/master` is in Rendering changes. The first
build hit the known autosummary-import segfault and passed on rebuild.
- Local doctest run: not done. The GPU targets need hardware, and the
CPU targets run in this PR's premerge because of the `BUILD.bazel`
change.

AI assistance (Claude Code) was used for the conversion and the
verification scripts.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Signed-off-by: Douglas Strodtman <[email protected]>
Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
@github-actions

Copy link
Copy Markdown

This pull request has been automatically closed because there has been no more activity in the 14 days
since being marked stale.

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!

@github-actions github-actions Bot closed this Sep 29, 2026
@MengjinYan MengjinYan reopened this Sep 29, 2026
@github-actions github-actions Bot added unstale A PR that has been marked unstale. It will not get marked stale again if this label is on it. and removed stale The issue is stale. It will be closed within 7 days unless there are further conversation labels Sep 30, 2026
dstrodtman added a commit that referenced this pull request Oct 5, 2026
…m RST to MyST (#66673)

## Why are these changes needed?

This PR converts the remaining prose pages under `ray-observability/`,
`ray-more-libs/`, `ray-references/`, and `ray-air/` from
reStructuredText to MyST Markdown. It continues the RST-to-MyST
conversion that already landed for `ray-core/` (#66430), `data/`
(#66375), and the doctest-wired pages (#66461). The conversion is format
only: the goal is for each page's rendered HTML to match `/en/master`.

There are five commits:

1. **Conversion.** This commit converts 25 pages, `git rm`s the `.rst`
sources, and adds one `doc/BUILD.bazel` exclude, which commit 5 reverts.
Prose keeps its source line wrapping, so the diff lines up with the
`.rst` line by line.
2. **Soft-wrap.** This commit reflows whitespace only, to one line per
paragraph and list item. `verify.py` from `ray-soft-wrap` confirms that
the non-whitespace bytes and the rendered HTML don't change on all 25
files.
3. **Render fixes.** This commit fixes six regressions that the render
diff against `/en/master` caught, even though the build was green. In
`modin`, two bare-word RST link references (`Modin_`, `documentation_`)
rendered as literal text. In `getting-started`, a bold URL was
autolinked. In `system-metrics`, a URL in a table cell lost its link. In
`dask-on-ray`, `_not_` rendered as italics. In `glossary`, the inline
`.. TODO: RLlib` text, which `/en/master` shows, had become a comment.
The commit also adds compat anchors to five headings with apostrophes
(see below).
4. **Pseudo-lists.** This commit restores three pseudo-lists that the
soft-wrap merged into one line.
5. **Review feedback.** This commit removes the glossary's placeholder
TODO entries, reverts the `doc/BUILD.bazel` change so the PR stays
docs-only, and fixes defects that the review flagged in the `.rst`
sources: a stray definition list in `dask-on-ray`, an unconverted link
in `system-metrics`, an extra parenthesis in `debug-failures`, typos in
`debug-hangs` and `optimize-performance`, a grammar slip in
`ray-debugging`, and em-dash pseudo-list items in `general-debugging`,
which are now a bulleted list.

### Scope

- `ray-air/`: `getting-started` and `deployment`, converted together.
`getting-started` includes `deployment`, and the include now points at
`deployment.md`.
- `ray-observability/`: 14 pages, including `user-guides/debug-apps/`
and `reference/system-metrics`.
- `ray-more-libs/`: 9 pages.
- `ray-references/`: `glossary` and `faq`.

**Left as RST:** `ray-observability/reference/api.rst` (`autosummary`)
and `ray-observability/reference/cli.rst` (`click`). They're API
reference pages, so they stay RST along with the other `*/api/`
reference trees.

### Construct notes for reviewers

- **Glossary.** The glossary is a native MyST `{glossary}` directive,
not RST wrapped in `{eval-rst}`. Sphinx's `glossary` directive parses
each definition with the host parser, so the definitions are Markdown
now. The glossary's placeholder `.. TODO:` entries are removed. Missing
terms can be identified separately.
- **Glossary doctest.** Nothing ran the glossary's `.. doctest::` block
as `.rst`: `pytest-sphinx` doesn't execute `doctest` sections, and
`--doctest-glob='*.md'` doesn't match `.rst`. As `.md`, the stock
doctest parser would start running its five `>>>` prompts, and the
`[[0],[1],...,[3],[4]]` output can't pass without `ELLIPSIS`. Each
prompt now carries `# doctest: +SKIP`, which keeps coverage the same as
master without a `doc/BUILD.bazel` change. Sphinx's default
`trim_doctest_flags` strips the flag from the rendered page, as in
`data/working-with-tensors.md`. If you'd rather fix the expected output
and start testing it, I can do that in a follow-up.
- **FAQ.** `faq.md` includes `_includes/_help-links.md`, the Markdown
copy of `_help.rst` that #66417 added. `_help.rst` stays, because
`cluster/vms/user-guides/community/yarn.rst` and `tune/key-concepts.rst`
still include it.
- **Comparison table.** The grid table in
`ray-collective-custom-backend` is now a native `{list-table}`.
- **Line blocks.** The line blocks in `dask-on-ray`'s version table are
now Markdown hard line breaks. This is an expected render difference:
`<p>` with `<br>` instead of `div.line-block`.

### Dead links fixed on the way

These links were broken on `/en/master` and fail `fail_on_warning` when
they're transcribed into MyST:

- `joblib` and `multiprocessing` linked to relative `actors.html` and
`installation.html`, which resolve under `ray-more-libs/` and return
404. They now link to `{doc}` `/ray-core/actors` and
`/ray-overview/installation`.
- `ray-collective` linked to `#api-reference`, but the heading's anchor
is `#api-references`.

### Open PRs that edit these pages

Each of these PRs needs to move its change onto the `.md` file: #66363
(`ray-event-export`), #65693 and #65583 (`system-metrics`), and #64957
(`joblib`, `multiprocessing`). #65321 edits `reference/cli.rst`, which
this PR doesn't convert.

## Related issue number

None.

## Checks

- [x] I've signed off every commit (`git commit -s`).
- [x] Duplicate check: no open PR converts these pages. I searched open
PRs for MyST, observability, glossary, and more-libs, and for open PRs
that edit these files.
- **Doctest parity:** `doctest_parity.py` (the `pytest-sphinx` parser,
run against `upstream/master`) reports the same sections and examples on
all 25 pages, before and after the soft-wrap: 12 examples before, 12
after.
- **Local doctest:** `pytest --doctest-modules --doctest-glob='*.md' -c
NO_PYTEST_CONFIG -p doctest_pytest_plugin` on the 24 converted pages in
the main target, with Ray nightly `bc900c2` on Python 3.10: 5 passed.
Those are the 5 files with examples. The glossary, now in the target
too, reports 1 skipped: the stock parser finds 5 examples and all 5
carry `+SKIP`.
- **Static checks:** frontmatter parses, fences balance, every label is
preserved, and there's no leftover RST outside fences or directives.
- **RtD preview:** green under `fail_on_warning` on all three commits.
- **Render diff** (`render_diff.py`, preview against `/en/master`,
filtering the two class-only differences every MyST page shows): 11 of
25 pages are identical. Every difference on the other 14 is one of
these:
- RST comments now emit `<!-- ... -->` HTML comments, which readers
don't see. Pages: `ray-air/*`, `ray-more-libs/index`, `ray-collective`,
`getting-started`, `general-debugging`, `glossary`.
- The `dask-on-ray` version table: Markdown hard line breaks (`<p>` with
`<br>`) replace RST line blocks (`div.line-block`).
- The `dask-on-ray` "Why use Dask on Ray?" item keeps its
definition-list structure. MyST adds a `myst` class to the `<dl>`, and
the class has no styling.
- Same-page fragment and `{doc}` links render as `reference internal`
instead of `reference external`. Pages: `ray-collective`, `joblib`,
`multiprocessing`. This list also includes the dead links fixed above.
- Headings with an apostrophe get a new anchor, because MyST drops the
apostrophe where docutils turned it into a hyphen. For example,
`#what-s-the-out-of-memory-error` becomes
`#whats-the-out-of-memory-error`. Five of these headings had no label,
so each gets a compat target with the old slug, which keeps existing
links working. The sixth, in `optimize-performance`, already carries the
`dashboard-cprofile` label.

This PR was written with AI assistance (Claude Code). I reviewed the
changes and ran the checks above.

🤖 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]>
dstrodtman added a commit that referenced this pull request Oct 5, 2026
## 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

#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]>
nadongjun pushed a commit to nadongjun/ray that referenced this pull request Oct 6, 2026
…ervability pages to MyST (ray-project#66461)

## Why are these changes needed?

Converts the last non-API-reference RST pages under `ray-core/`,
`data/`, and `rllib/` to MyST Markdown, plus the `train/` and
`ray-observability/` pages that `doc/BUILD.bazel` names by path. The API
reference trees (`*/api/`, `rllib/package_ref/`, and
`ray-core/compiled-graph/compiled-graph-api`) stay RST for now.

Each page gets its own commit, so you can review one file at a time.
Every commit renames the page's literal `.rst` paths in
`doc/BUILD.bazel` to `.md`. These paths are in `exclude` lists and in
the explicit `files` lists of `doctest[data-gpu]` and
`doctest[train-gpu]`, and they don't glob. Without the edit, an excluded
page would silently join its target once it's `.md`, and an included
page would silently drop out of it.

Conversions are format-only: labels, headings, and prose are unchanged.
A final whitespace-only commit soft-wraps the prose. `ray-soft-wrap`'s
`verify.py` confirms non-whitespace bytes, rendered HTML, and
idempotence for all 11 files.

### `rllib/getting-started`: doctest target removed

The first commit deletes `doctest[rllib2]`, the only target over
`rllib/getting-started.rst`, before the page converts. The target is
tagged `manual` with a hang TODO, so no premerge or postmerge step has
run it, and nothing else references it (`git grep rllib2` is empty). Its
15 `testcode` blocks had no `testoutput`, so they asserted nothing. The
12 visible blocks become display-only `python` code blocks. The three
`:hide:` blocks held `.stop()` cleanups that never rendered, so they're
deleted. `doctest[rllib]` still excludes the page. If these examples
should be validated later, a `doc_code/` script is the better route than
reviving the hanging target. cc @elliot-barn, who owns the TODO.

This commit isn't buildable on its own. It turns a `.. testcode::` that
had no blank line before its body into a `.. code-block:: python`, still
with no blank line, and docutils reads the body as extra arguments to
the directive. The later conversion commit fixes it in the `.md`, and a
squash merge never puts the intermediate commit on master.

### Doctest coverage

Docs-only PRs don't run doctests premerge. This PR edits
`doc/BUILD.bazel`, so every library's docs example step runs, but
premerge can't show the conversion kept the same blocks. For that, I
parsed each `.md` and the `.rst` it replaced with Ray's `pytest-sphinx`
fork, the same parser the doctest macro runs, and asserted identical
sections (directive, body, `:options:`, `:skipif:`) and examples.

| Page | BUILD role | Examples before → after |
| --- | --- | --- |
| `ray-core/handling-dependencies` | `doctest[core]` exclude | 17 → 17 |
| `ray-core/tasks/nested-tasks` | `doctest[core]` exclude | 0 → 0
(`literalinclude` of a tested `doc_code/` file) |
| `data/batch-inference` | `doctest_each` exclude, `doctest[data-gpu]`
files | 7 → 7 |
| `data/transforming-data` | `doctest_each` exclude, `doctest[data-gpu]`
files | 24 → 24 |
| `data/contributing/contributing` | `doctest_each` glob | 0 → 0
(toctree only) |
| `rllib/getting-started` | `doctest[rllib]` exclude, `doctest[rllib2]`
removed | 15 → 0, by the removal commit |
| `ray-observability/user-guides/cli-sdk` | top-level exclude | 16 → 16
|
| `ray-observability/user-guides/ray-tracing` | top-level exclude | 3 →
3 |
| `train/horovod` | `doctest[train]` exclude | 2 → 2 |
| `train/user-guides/data-loading-preprocessing` | `doctest[train]`
exclude, `doctest[train-gpu]` files | 6 → 6 |
| `train/user-guides/using-accelerators` | `doctest[train]` exclude,
`doctest[train-gpu]` files | 10 → 10 |

To show the check would catch a broken conversion, I mutated each page
with examples three ways: dropping a `testcode` block, altering a line
in one, and turning one into a four-backtick fence. The last renders
fine but is never collected. The check failed on all 24 mutations.

### Rendering changes

I ran `render_diff.py` on all 11 pages against `/en/master`. Six render
identically: `nested-tasks`, `data/contributing/contributing`,
`cli-sdk`, `ray-tracing`, `horovod`, and `using-accelerators`. Every
difference on the other five is listed here.

- `rllib/getting-started`: on master, one `.. testcode::` line had no
blank line after it. docutils read the block's first six lines, the
`best_result = results.get_best_result(...)` call, as the directive's
argument and dropped them. So master shows code that uses `best_result`
without showing where it comes from. The converted page renders all six
lines. This is the one place the conversion deliberately doesn't
reproduce master.
- `rllib/getting-started`: the "Farama gymnasium" link now has
`https://`. On master it's a relative link to `gymnasium.farama.org`
that 404s.
- `ray-core/handling-dependencies`: MyST drops the apostrophe when it
slugifies the "can't import the packages" heading, so the section id
changes. That heading had no label, so the page adds a target carrying
the old docutils slug, and existing `#...-can-t-import-...` links still
resolve. An auto-numbered span id, which nothing links to, also changes
from `id4` to `id2`.
- `data/batch-inference` and
`train/user-guides/data-loading-preprocessing`: each renders an RST
comment as an HTML comment, which readers never see.
- `data/transforming-data`: the "When using" definition list's `<dl>`
gains the unstyled `myst` class.

The first preview diff also caught three regressions that the green
build didn't. MyST's `replacements` extension turned two `(c)` list
markers into `©` and an `etc..` into `etc…`. The anchor above had
changed too. A follow-up commit fixes all three. A sweep of the 11 pages
found no other text that extension rewrites.

### Dead `doc/BUILD.bazel` excludes

A final commit drops four `exclude` entries that name files that have
moved: two in `doctest[serve]` and two in the serve `doc_code` test. A
glob exclude naming a missing file excludes nothing, so these had
silently stopped applying. This doesn't change what any target runs.
ray-project#66462 carries the same commit, along with a lint check that fails on
this class of stale path, so the two PRs merge cleanly in either order.

### Open PRs that edit these files

Each of these open PRs edits one of the converted `.rst` files, so each
will need to move its change to the `.md`: ray-project#66279, ray-project#66191, ray-project#65956,
ray-project#65933, and ray-project#65830 (`handling-dependencies`), ray-project#65693 (`cli-sdk`), and
ray-project#66419, ray-project#66420, ray-project#66422, and ray-project#66423 (`data/batch-inference`,
`train/user-guides/data-loading-preprocessing`). ray-project#66096, ray-project#64053, and
ray-project#63881 also edit `doc/BUILD.bazel`, and only ray-project#66096 edits nearby lines.

## Related issue number

None. No open PR converts these pages. I checked `gh pr list` for open
PRs touching each file.

## Checks

- [x] I've signed off every commit (`git commit -s`).
- [x] Pre-commit hooks passed on every commit.
- Doctest parity: `python3 doctest_parity.py <the 11 .md files>` with
`pytest==7.4.4` and `pytest-sphinx @
git+https://github.com/ray-project/pytest-sphinx`. All OK, run again
after the soft-wrap commit.
- Static checks on every `.md`: fences balance, no leftover RST roles or
directives, every label from the `.rst` is present, and directive counts
match.
- Read the Docs preview builds green under `fail_on_warning`, and the
render diff against `/en/master` is in Rendering changes. The first
build hit the known autosummary-import segfault and passed on rebuild.
- Local doctest run: not done. The GPU targets need hardware, and the
CPU targets run in this PR's premerge because of the `BUILD.bazel`
change.

AI assistance (Claude Code) was used for the conversion and the
verification scripts.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Signed-off-by: Douglas Strodtman <[email protected]>
Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
nadongjun pushed a commit to nadongjun/ray that referenced this pull request Oct 6, 2026
…m RST to MyST (ray-project#66673)

## Why are these changes needed?

This PR converts the remaining prose pages under `ray-observability/`,
`ray-more-libs/`, `ray-references/`, and `ray-air/` from
reStructuredText to MyST Markdown. It continues the RST-to-MyST
conversion that already landed for `ray-core/` (ray-project#66430), `data/`
(ray-project#66375), and the doctest-wired pages (ray-project#66461). The conversion is format
only: the goal is for each page's rendered HTML to match `/en/master`.

There are five commits:

1. **Conversion.** This commit converts 25 pages, `git rm`s the `.rst`
sources, and adds one `doc/BUILD.bazel` exclude, which commit 5 reverts.
Prose keeps its source line wrapping, so the diff lines up with the
`.rst` line by line.
2. **Soft-wrap.** This commit reflows whitespace only, to one line per
paragraph and list item. `verify.py` from `ray-soft-wrap` confirms that
the non-whitespace bytes and the rendered HTML don't change on all 25
files.
3. **Render fixes.** This commit fixes six regressions that the render
diff against `/en/master` caught, even though the build was green. In
`modin`, two bare-word RST link references (`Modin_`, `documentation_`)
rendered as literal text. In `getting-started`, a bold URL was
autolinked. In `system-metrics`, a URL in a table cell lost its link. In
`dask-on-ray`, `_not_` rendered as italics. In `glossary`, the inline
`.. TODO: RLlib` text, which `/en/master` shows, had become a comment.
The commit also adds compat anchors to five headings with apostrophes
(see below).
4. **Pseudo-lists.** This commit restores three pseudo-lists that the
soft-wrap merged into one line.
5. **Review feedback.** This commit removes the glossary's placeholder
TODO entries, reverts the `doc/BUILD.bazel` change so the PR stays
docs-only, and fixes defects that the review flagged in the `.rst`
sources: a stray definition list in `dask-on-ray`, an unconverted link
in `system-metrics`, an extra parenthesis in `debug-failures`, typos in
`debug-hangs` and `optimize-performance`, a grammar slip in
`ray-debugging`, and em-dash pseudo-list items in `general-debugging`,
which are now a bulleted list.

### Scope

- `ray-air/`: `getting-started` and `deployment`, converted together.
`getting-started` includes `deployment`, and the include now points at
`deployment.md`.
- `ray-observability/`: 14 pages, including `user-guides/debug-apps/`
and `reference/system-metrics`.
- `ray-more-libs/`: 9 pages.
- `ray-references/`: `glossary` and `faq`.

**Left as RST:** `ray-observability/reference/api.rst` (`autosummary`)
and `ray-observability/reference/cli.rst` (`click`). They're API
reference pages, so they stay RST along with the other `*/api/`
reference trees.

### Construct notes for reviewers

- **Glossary.** The glossary is a native MyST `{glossary}` directive,
not RST wrapped in `{eval-rst}`. Sphinx's `glossary` directive parses
each definition with the host parser, so the definitions are Markdown
now. The glossary's placeholder `.. TODO:` entries are removed. Missing
terms can be identified separately.
- **Glossary doctest.** Nothing ran the glossary's `.. doctest::` block
as `.rst`: `pytest-sphinx` doesn't execute `doctest` sections, and
`--doctest-glob='*.md'` doesn't match `.rst`. As `.md`, the stock
doctest parser would start running its five `>>>` prompts, and the
`[[0],[1],...,[3],[4]]` output can't pass without `ELLIPSIS`. Each
prompt now carries `# doctest: +SKIP`, which keeps coverage the same as
master without a `doc/BUILD.bazel` change. Sphinx's default
`trim_doctest_flags` strips the flag from the rendered page, as in
`data/working-with-tensors.md`. If you'd rather fix the expected output
and start testing it, I can do that in a follow-up.
- **FAQ.** `faq.md` includes `_includes/_help-links.md`, the Markdown
copy of `_help.rst` that ray-project#66417 added. `_help.rst` stays, because
`cluster/vms/user-guides/community/yarn.rst` and `tune/key-concepts.rst`
still include it.
- **Comparison table.** The grid table in
`ray-collective-custom-backend` is now a native `{list-table}`.
- **Line blocks.** The line blocks in `dask-on-ray`'s version table are
now Markdown hard line breaks. This is an expected render difference:
`<p>` with `<br>` instead of `div.line-block`.

### Dead links fixed on the way

These links were broken on `/en/master` and fail `fail_on_warning` when
they're transcribed into MyST:

- `joblib` and `multiprocessing` linked to relative `actors.html` and
`installation.html`, which resolve under `ray-more-libs/` and return
404. They now link to `{doc}` `/ray-core/actors` and
`/ray-overview/installation`.
- `ray-collective` linked to `#api-reference`, but the heading's anchor
is `#api-references`.

### Open PRs that edit these pages

Each of these PRs needs to move its change onto the `.md` file: ray-project#66363
(`ray-event-export`), ray-project#65693 and ray-project#65583 (`system-metrics`), and ray-project#64957
(`joblib`, `multiprocessing`). ray-project#65321 edits `reference/cli.rst`, which
this PR doesn't convert.

## Related issue number

None.

## Checks

- [x] I've signed off every commit (`git commit -s`).
- [x] Duplicate check: no open PR converts these pages. I searched open
PRs for MyST, observability, glossary, and more-libs, and for open PRs
that edit these files.
- **Doctest parity:** `doctest_parity.py` (the `pytest-sphinx` parser,
run against `upstream/master`) reports the same sections and examples on
all 25 pages, before and after the soft-wrap: 12 examples before, 12
after.
- **Local doctest:** `pytest --doctest-modules --doctest-glob='*.md' -c
NO_PYTEST_CONFIG -p doctest_pytest_plugin` on the 24 converted pages in
the main target, with Ray nightly `bc900c2` on Python 3.10: 5 passed.
Those are the 5 files with examples. The glossary, now in the target
too, reports 1 skipped: the stock parser finds 5 examples and all 5
carry `+SKIP`.
- **Static checks:** frontmatter parses, fences balance, every label is
preserved, and there's no leftover RST outside fences or directives.
- **RtD preview:** green under `fail_on_warning` on all three commits.
- **Render diff** (`render_diff.py`, preview against `/en/master`,
filtering the two class-only differences every MyST page shows): 11 of
25 pages are identical. Every difference on the other 14 is one of
these:
- RST comments now emit `<!-- ... -->` HTML comments, which readers
don't see. Pages: `ray-air/*`, `ray-more-libs/index`, `ray-collective`,
`getting-started`, `general-debugging`, `glossary`.
- The `dask-on-ray` version table: Markdown hard line breaks (`<p>` with
`<br>`) replace RST line blocks (`div.line-block`).
- The `dask-on-ray` "Why use Dask on Ray?" item keeps its
definition-list structure. MyST adds a `myst` class to the `<dl>`, and
the class has no styling.
- Same-page fragment and `{doc}` links render as `reference internal`
instead of `reference external`. Pages: `ray-collective`, `joblib`,
`multiprocessing`. This list also includes the dead links fixed above.
- Headings with an apostrophe get a new anchor, because MyST drops the
apostrophe where docutils turned it into a hyphen. For example,
`#what-s-the-out-of-memory-error` becomes
`#whats-the-out-of-memory-error`. Five of these headings had no label,
so each gets a compat target with the old slug, which keeps existing
links working. The sixth, in `optimize-performance`, already carries the
`dashboard-cprofile` label.

This PR was written with AI assistance (Claude Code). I reviewed the
changes and ran the checks above.

🤖 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
## 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]>
Finished JobTableData rows are currently retained indefinitely. On
persistent, high-churn clusters, Redis memory, full-table reads,
and GCS restart loading therefore grow with cluster lifetime instead
of the useful history window.

Add maximum_gcs_dead_job_cached_count with a default of 100,000.
Track finished jobs in deterministic end-time and JobID order,
delete overflow using the existing bounded GCS batch size, and
rebuild the retention index after restart so persisted rows and
lowered limits remain covered. Export a counter for successful
evictions.

A finished driver does not always make its job config
observability-only: detached actors can outlive the driver and still
depend on the originating job config and function metadata. Restore
actor references before rebuilding finished jobs, pin referenced
records, and make them evictable only after the last operational
reference is released.

Ray Jobs API submission metadata remains in its separate InternalKV
storage. Document that this retention policy bounds core State API
driver history without deleting submission history, while driver
details may disappear after core record eviction.

Cover steady-state eviction, deterministic restart ordering, actor
pinning and release, and function-manager callback semantics.

Signed-off-by: Zhao Junwang <[email protected]>
Signed-off-by: Junwang Zhao <[email protected]>
@zhjwpku
zhjwpku force-pushed the gcs-finished-job-retention branch from 6f843d8 to 0ff6727 Compare October 9, 2026 06:43

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 4 potential issues.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit 0ff6727. Configure here.

// consume references held by detached actors.
if (newly_finished) {
function_manager_.RemoveJobReference(job_id);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Job finish retries leak driver refs

Medium Severity

HandleAddJob still increments the job reference on every successful retry, but MarkJobFinished now releases that driver reference only once. When both RPCs are retried, the extra AddJob pin is never dropped, so exported-function cleanup never runs and the finished record stays exempt from retention eviction.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 0ff6727. Configure here.

continue;
}
finished_job_end_times_.erase(entry.job_id);
cached_job_configs_.erase(entry.job_id);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eviction makes GetJobConfig crashable

Medium Severity

Successful eviction removes the job from cached_job_configs_, but GetJobConfig still RAY_CHECKs that the entry exists. Placement-group creation reads that cache by creator_job_id, so a late create from an already-evicted driver can crash GCS instead of failing the RPC.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 0ff6727. Configure here.

}
}
finished_job_cleanup_in_progress_ = false;
return;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Failed eviction never resumes cleanup

Medium Severity

If a finished-job load or BatchDelete fails, candidates are put back and finished_job_cleanup_in_progress_ is cleared, but TrimFinishedJobs is not invoked again. Restart backfill or a transient store error then leaves overflow in place until some later finish or reference release happens to retrigger cleanup.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 0ff6727. Configure here.


/// Rebuild finished-job retention state after all operational job references have
/// been restored, then incrementally trim persisted history to the configured cap.
void RestoreFinishedJobs(const GcsInitData &gcs_init_data);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New APIs lack Doxygen tags

Low Severity

Newly added and modified C++ declarations are missing Doxygen /** ... */ comments with @brief and @param/@return tags. RestoreFinishedJobs, HasJobReference, and SetJobReferenceReleasedCallback have brief /// notes only, and the new private eviction helpers are undocumented.

Additional Locations (2)
Fix in Cursor Fix in Web

Triggered by project rule: Bugbot Rules

Reviewed by Cursor Bugbot for commit 0ff6727. Configure here.

@zhjwpku

zhjwpku commented Oct 22, 2026

Copy link
Copy Markdown
Contributor Author

Closing this for now. Finished driver-job metadata can still be needed by detached actors and recovery paths, and this implementation does not fully protect in-flight creation and GCS failover.

Bounding job history remains worthwhile, but we should clarify the lifecycle of operational metadata before introducing eviction.

@zhjwpku zhjwpku closed this Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contribution Contributed by the community core Issues that should be addressed in Ray Core unstale A PR that has been marked unstale. It will not get marked stale again if this label is on it.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Core][GCS] Add bounded retention for finished driver job metadata

3 participants