[Doc] Cache executed sphinx-gallery output between doc builds#3983
Open
vmoens wants to merge 1 commit into
Open
[Doc] Cache executed sphinx-gallery output between doc builds#3983vmoens wants to merge 1 commit into
vmoens wants to merge 1 commit into
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/rl/3983
Note: Links to docs will display an error until the docs builds have been completed. ❌ 1 New FailureAs of commit f3a0c52 with merge base a74b478 ( NEW FAILURE - The following job has failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This was referenced Jul 9, 2026
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.
Stack from ghstack (oldest at bottom):
Every docs build re-executes all 28 tutorials even when none changed,
dominating the ~30 minute build. sphinx-gallery already skips a
tutorial when its generated output (including the .md5 checksum of the
source) is present in the gallery dir, so preserving that directory
across builds is enough; the build runs inside test-infra's
linux_job_v2, which does not support actions/cache steps, so the cache
lives in a dedicated docs-gallery-cache branch instead.
to main only: never on schedule (the nightly orchestrator's build is
the daily full rebuild that catches tutorials broken by library
changes), and never on tags/release branches (they build with stable
torch and must not inherit nightly-torch outputs). The cache key
folds in conf.py, docs/requirements.txt and the resolved
torch/sphinx-gallery versions; TORCHRL_DOCS_GALLERY_CACHE=0 disables.
plus the key into the docs artifact; the gh-pages upload job strips
that directory so it never lands on the site.
orphan commit (the branch never grows), serialized by its own
concurrency group since docs.yml's is per-sha on main. The nightly
writer bounds output staleness with respect to torch/tensordict/
torchrl to at most a day.
Verified locally with the pinned sphinx/sphinx-gallery: a second build
with the gallery dir restored skips execution (identical output), and
check_tutorial_time_budget.py parses the 00:00.004 entries a skipped
build writes.
Also fixes the PR-only RUNNER_DOCS_DIR copy, which was written as
[[ ${{ github.event_name == 'pull_request' }} ]] and therefore ran on
every event (both "true" and "false" are truthy in [[ ]]).
Known tradeoff: published pages for unchanged tutorials show outputs
from an older build (bounded by the nightly refresh), and a library
change that breaks an unchanged tutorial surfaces at nightly rather
than on the PR.
Co-Authored-By: Claude Fable 5 noreply@anthropic.com