-
Notifications
You must be signed in to change notification settings - Fork 136
Building notebooks in parallel does not work (on Windows) #801
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This is a bug. I have no idea why it doesn't work, though. I can reproduce the problem with your example, but I also tried a different example (https://github.com/AudioSceneDescriptionFormat/splines) where parallelization worked fine! That's really strange ... |
I tried to build the docs of the splines package on a fresh virtual enviroment. I got an error in the compilation of the documentation at about 70%. I guess the versions of the packages I have used do not work with it. During the compilation I did not have the impression that it is running in parallel.
|
This should be enough to see whether it is reading (and executing) the notebooks in parallel. When I run it with There is also a change in the terminal output:
Note that when reading in parallel, a range of notebooks is is shown instead of a single one. If you want to try a project with fewer dependencies, you can try this: https://github.com/AudioSceneDescriptionFormat/asdf
Conveniently, this currently raises an error, which even mentions that it is doing a parallel build! |
Hi, I tried it again.
Could you please send me your package versions, so that I can try it with these. Maybe there is some differen in the OS. Do you use windows or linux? |
I also tried it again and I found out why your minimal example didn't work in parallel for me: apparently Sphinx only does parallel processing if there are more than 5 source files: https://github.com/sphinx-doc/sphinx/blob/d56cf30ecb2d68651c75b454f0aeae74304285dd/sphinx/builders/__init__.py#L431. I have reported this surprising behavior in sphinx-doc/sphinx#12796. I guess your example still doesn't run in parallel when you add two more notebooks? For me, it took 17 seconds. I would like to check if this really is related to I tried it with this example setup:
import time
def source_read(app, docname, content):
time.sleep(10)
def setup(app):
app.connect('source-read', source_read)
Test
====
.. toctree::
test1
test2
test3
test4
test5
Test Page
========= When running this, I get:
Does that work for you? |
I was using the latest Git versions of Sphinx and SymPy, I guess.
Linux |
Hi I tested your example without nbsphinx, and in fact no multiprocessing is active. I Looked through github and found an old issue sphinx-doc/sphinx#8296 stating that sphinx does not run parallel on windows. Further searching revealed that the parallel execution of sphinx does still only work on systems allowing "fork". This can be checked in the source code of sphinx under "sphinx/sphinx/util/parallel.py" (https://github.com/sphinx-doc/sphinx/tree/v8.0.2/sphinx/util):
I already feared that this would be OS dependant. Interestingly, there is no remark in the documenation of Sphinx for that. |
Thanks for tracking this down!
Would you like to create a PR at https://github.com/sphinx-doc/sphinx/pulls for this? |
Hello,
I have noticed that the parallel execution of jupyter notebooks does not work (for me). See below or use the zip (source.zip) for a minimal example of the problem. Executing
sphinx-build source build -j4 -b html
does not show any performance increase as compared tosphinx-build source build -j1 -b html
. Both take about 38 seconds on my machine. Each notebook waits for 10 sconds, thus there is no parallel execution of the notebooks. On my main project, .rst files are build parallel as expected but the notebooks always slowdown the build process.From the documentation https://nbsphinx.readthedocs.io/en/0.9.3/usage.html#Running-Sphinx I would expect that the parallelization works without much set up. Is this a bug or the expected behaviour?
I am using:
This is the complete list in the newly set up virtaul env after installing the above packages:
Setup of the minimal example
source
-- conf.py
-- index.rst
-- test1.ipynb
-- test2.ipynb
-- test3.ipynb
The conf.py file:
The index.rst file:
The test1.ipynb, etc. files have two cells, one markdown, one python cell:
The text was updated successfully, but these errors were encountered: