FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[BUG] redirect-from sphinx extension is not parallel safe · Issue #24058 · matplotlib/matplotlib · GitHub

Repository navigation

[BUG] redirect-from sphinx extension is not parallel safe #24058

Description

Summary

CI builds the docs in parallel since #20718.

This doesn't work correctly with redirects: in #24054 it raises

Traceback (most recent call last):
  File "/home/circleci/.local/lib/python3.8/site-packages/sphinx/cmd/build.py", line 279, in build_main
    app.build(args.force_all, filenames)
  File "/home/circleci/.local/lib/python3.8/site-packages/sphinx/application.py", line 350, in build
    self.builder.build_update()
  File "/home/circleci/.local/lib/python3.8/site-packages/sphinx/builders/__init__.py", line 302, in build_update
    self.build(to_build,
  File "/home/circleci/.local/lib/python3.8/site-packages/sphinx/builders/__init__.py", line 318, in build
    updated_docnames = set(self.read())
  File "/home/circleci/.local/lib/python3.8/site-packages/sphinx/builders/__init__.py", line 423, in read
    self._read_parallel(docnames, nproc=self.app.parallel)
  File "/home/circleci/.local/lib/python3.8/site-packages/sphinx/builders/__init__.py", line 479, in _read_parallel
    tasks.join()
  File "/home/circleci/.local/lib/python3.8/site-packages/sphinx/util/parallel.py", line 105, in join
    if not self._join_one():
  File "/home/circleci/.local/lib/python3.8/site-packages/sphinx/util/parallel.py", line 126, in _join_one
    raise SphinxParallelError(*result)
sphinx.errors.SphinxParallelError: ValueError: gallery/pyplots/dollar_ticks is already noted as redirecting to gallery/ticks/dollar_ticks

Sphinx parallel build error:
ValueError: gallery/pyplots/dollar_ticks is already noted as redirecting to gallery/ticks/dollar_ticks

(see also #21876)

Proposed fix

Revert afef2e6.

Activity

  1. jklymak commented on Sep 30, 2022

    Member

    We should probably figure out why we get the error

    Also note that since we introduced this mechanism, I think there is a proper package that does this. Whether they handle parallel better or not I'm not sure.

    Finally, we don't host on GitPages any longer and could do this with .htaccess now if we chose (I think).

  2. timhoffm commented on Sep 30, 2022

    Member

    It may be that our redirect directive is not thread-safe. Maybe we have to revert #19686 instead. - Either way, we definitively want parallelism for speed, and need to find a different solution.

  3. StefRe commented on Sep 30, 2022

    ContributorAuthor

    Please accept my apology. I included the same redirect in two different files. This error didn't show up for non-parallel builds: the second redirect just overwrites the first one. I fixed this mistake and the docs build in parallel without errors.

  4. timhoffm commented on Dec 19, 2022

    Member

    I'll reopen because the error hit again in a recent CI run.

    I rename the issue to state the problem. Simply not building in parallel cannot be a solution because of the performance impact. The error seems rare enough so that the best temporary solution is continuing as is and restarting Circle CI when the error hits.

    Mid-term, we should either make redirect-from parallel-safe or find a different solution. We cannot afford a sphinx extension that prevents doc builds in parallel.

  5. changed the title [-][MNT]: Docs don't build in parallel[/-] [+]redirect-from sphinx extension is not parallel safe[/+] on Dec 19, 2022
  6. changed the title [-]redirect-from sphinx extension is not parallel safe[/-] [+][BUG] redirect-from sphinx extension is not parallel safe[/+] on Dec 19, 2022
  7. jklymak commented on Dec 19, 2022

    Member

    Do we understand why this directive would not be parallel safe?

  8. oscargus commented on Dec 19, 2022

    Member

    What was the error in that recent run? I think that the original error is not related to parallel execution, but just re-thrown as a SphinxParallelError.

  9. timhoffm commented on Dec 19, 2022

    Member

    In the recent run, the error was exactly the same as above.

    The error is thrown from here

    def run(self):
    redirected_doc, = self.arguments
    env = self.app.env
    domain = env.get_domain('redirect_from')
    current_doc = env.path2doc(self.state.document.current_source)
    redirected_reldoc, _ = env.relfn2path(redirected_doc, current_doc)
    if redirected_reldoc in domain.redirects:
    raise ValueError(
    f"{redirected_reldoc} is already noted as redirecting to "
    f"{domain.redirects[redirected_reldoc]}")
    domain.redirects[redirected_reldoc] = current_doc
    return []

    which should only be run once per .. redirect-from:: directive.

    Maybe it has to do with using the domain for data storage and not handling that correctly on our side? At least https://www.sphinx-doc.org/en/master/development/tutorials/todo.html attaches its data todo_all_todos to the environment, not a domain.
    Edit: No, sphinx-doc/sphinx#9003 (comment) suggests that attaching data to a domain is actually the correct way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL