Repository navigation
[ci][RLlib] Stop forwarding worker logs in the RLlib doctest target - #67834
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates the doctest target in python/ray/rllib/BUILD.bazel to set the environment variable RAY_LOG_TO_DRIVER to "0". This prevents worker logs from being forwarded to the driver, which avoids unexpected stdout capture failures during doctests. There are no review comments to address, and the changes look appropriate.
pseudo-rnd-thoughts
approved these changes
Nov 5, 2026
The APPOConfig and IMPALAConfig examples build an algorithm with one learner, which sets up a Gloo process group in a worker. The worker's "[Gloo] Rank 0 is connected to 0 peer ranks" line reaches driver stdout asynchronously, and doctest counts it as output of the running example, so //python/ray/rllib:doctest fails. Set RAY_LOG_TO_DRIVER=0 for the target, as the Train V2 doctest target does for the same Gloo output. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Douglas Strodtman <[email protected]>
dstrodtman
force-pushed
the
doc-1926-rllib-doctest-worker-logs
branch
from
November 5, 2026 13:28
8d88982 to
53ccc48
Compare
pseudo-rnd-thoughts
pushed a commit
that referenced
this pull request
Nov 17, 2026
…the rllib doctest target (#68242) ## Why are these changes needed? The scheduled postmerge step `:brain: rllib: docs example tests` has failed on every run since #67774 turned the `rllib.algorithms` docstring examples into doctests. The failing target is `//python/ray/rllib:doctest`. #67834 fixed the `APPOConfig` and `IMPALAConfig` failures, but `BCConfig` still fails, and the target runs out of time partway through `PPOConfig`. See, for example, [postmerge 21027](https://buildkite.com/ray-project/postmerge/builds/21027). The second `BCConfig` example deadlocks on CPUs. It runs a `tune.Tuner` with a `grid_search` over two learning rates, so Tune starts both trials at once. On the doctest cluster the two trials take every CPU. Each trial's offline data pipeline, a `MapBatches(OfflinePreLearner)` actor pool, then never gets a CPU to start. After 1800 seconds, Ray Data's no-progress timeout fails both trials with `ExecutionTimeoutError`. That lost half hour is also why the target runs out of time in `PPOConfig`. This PR passes `tune_config=tune.TuneConfig(max_concurrent_trials=1)` to the example's `Tuner`. The `grid_search` still runs both learning rates, one trial after the other, so the example teaches the same thing. ## Testing Run in a `python:3.12-slim` container (linux/aarch64) capped at 4 CPUs with `docker run --cpus 4`. The container installs the master wheel built at 456e286, the base of this branch, plus CPU torch, pytest, Pillow, and tensorboardX. The command matches what the Bazel target runs, with its env (`RAY_LOG_TO_DRIVER=0`, `TF_USE_LEGACY_KERAS=1`) and the default doctest plugin: ```bash python -m pytest --noconftest --doctest-modules -p default_doctest_pytest_plugin \ ray/rllib/algorithms/bc/bc.py ``` - Before this change: `1 failed in 1811.24s`. Both trials raise `ray.data.exceptions.ExecutionTimeoutError: Dataset execution made no progress for at least 1800s`. While it hung, `ray status` showed `4.0/4.0 CPU (2.0 used of 2.0 reserved in placement groups)` with `{'CPU': 1.0}: 4+ pending tasks/actors`. - After this change: `1 passed in 16.52s`. - `ray/rllib/algorithms/ppo/ppo.py` on its own: `1 passed in 12.84s`. `PPOConfig` doesn't hang. On CI it only ran out of time after the 30-minute `BCConfig` stall. Caveats: the 4-CPU cap is an estimate of what one doctest container gets on the `medium` instance with `--parallelism-per-worker 2`. I haven't confirmed CI's exact per-container CPU count. I also haven't run the full `//python/ray/rllib:doctest` target locally. A scheduled postmerge run will confirm the fix. I also tested adding `algo.stop()` after the first example, because that `Algorithm` stays alive until the module's `ray.shutdown()`. It didn't help, and the Tuner example deadlocked the same way, so this PR leaves it out. ## Duplicate check No open PR or issue touches `rllib/algorithms/bc/bc.py` or this target failure. Searched open PRs for `BCConfig`, `bc.py`, and `rllib doctest`. The open `rllib.core` doctest PRs (#67976, #67766) add examples to the same target but don't change `BCConfig`. ## AI assistance AI assistance (Claude Code) helped with diagnosis, the local reproduction, and drafting. I reviewed the change and the test results. 🤖 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 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.
Description
//python/ray/rllib:doctestfails on master in theAPPOConfigandIMPALAConfigexamples. #67774 made these examples runnable. Each one builds an algorithm withlearners(num_learners=1), and the learner worker sets up a Gloo process group and prints this line:Ray forwards worker output to the driver's stdout asynchronously. Stock doctest compares the driver's stdout against each example's expected output, so the line fails
algo = config.build(), which expects nothing. Both bazel attempts failed this way in premerge build 76224 on #67627, which doesn't touch these files. Any RLlib PR that runs the full doctest target without thedocstring-onlylabel hits the same failure. #67774 passed premerge because it ran withdocstring-only, which runs docstring examples in a light image without torch and skips these examples by name.This PR sets
RAY_LOG_TO_DRIVER=0in the target'senv.ray.init()reads that constant when it isn't passedlog_to_driver, and these examples don't pass it. #67831 sets the same variable on the Train V2 doctest target for the same Gloo output fromTorchTrainerworkers. No RLlib docstring example expects worker output: a search ofpython/ray/rlliboutsideexamples/andtests/forpid=and worker-actor prefixes finds none. The examples themselves don't change.Not a duplicate. I searched open PRs for
APPOConfig,IMPALAConfig, doctest, and Gloo. #67775 is the only match. It changes the second, Tune-based example in each of these docstrings and doesn't touch the first example orBUILD.bazel.Testing
pre-commit run --files python/ray/rllib/BUILD.bazel: all hooks pass, including buildifier and buildifier-lint.appo.pyandimpala.py, and Ray's default doctest plugin:pytest -p default_doctest_pytest_plugin --doctest-modules --noconftest ray/rllib/algorithms/appo/appo.py ray/rllib/algorithms/impala/impala.pypasses with and withoutRAY_LOG_TO_DRIVER=0(2 passed each time). The Gloo line doesn't appear on macOS, so this run shows the change doesn't break the examples but doesn't reproduce the failure. This PR's premerge, which runs the full RLlib doctest target on Linux, is the real check.🤖 Generated with Claude Code