10000 MNT speed-up html-noplot build (#26245) · scikit-learn/scikit-learn@701537e · GitHub
[go: up one dir, main page]

Skip to content

Commit 701537e

Browse files
lestevethomasjpfan
andauthored
MNT speed-up html-noplot build (#26245)
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
1 parent 3b7c435 commit 701537e

File tree

2 files changed

+23
-11
lines changed

2 files changed

+23
-11
lines changed

.circleci/config.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ jobs:
2424
- OPENBLAS_NUM_THREADS: 2
2525
- CONDA_ENV_NAME: testenv
2626
- LOCK_FILE: build_tools/circle/doc_min_dependencies_linux-64_conda.lock
27-
# Sphinx race condition in doc-min-dependencies is causing job to stall
28-
# Here we run the job serially
29-
- SPHINX_NUMJOBS: 1
3027
steps:
3128
- checkout
3229
- run: ./build_tools/circle/checkout_merge_commit.sh
@@ -61,8 +58,6 @@ jobs:
6158
- OPENBLAS_NUM_THREADS: 2
6259
- CONDA_ENV_NAME: testenv
6360
- LOCK_FILE: build_tools/circle/doc_linux-64_conda.lock
64-
# Disable sphinx parallelism to avoid EOFError or job stalling in CircleCI
65-
- SPHINX_NUMJOBS: 1
6661
steps:
6762
- checkout
6863
- run: ./build_tools/circle/checkout_merge_commit.sh

doc/Makefile

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,25 @@ SPHINXBUILD ?= sphinx-build
77
PAPER =
88
BUILDDIR = _build
99

10-
# Run sequential by default, unless SPHINX_NUMJOBS is set.
11-
SPHINX_NUMJOBS ?= 1
12-
1310
ifneq ($(EXAMPLES_PATTERN),)
1411
EXAMPLES_PATTERN_OPTS := -D sphinx_gallery_conf.filename_pattern="$(EXAMPLES_PATTERN)"
1512
endif
1613

14+
ifeq ($(CI), true)
15+
# On CircleCI using -j2 does not seem to speed up the html-noplot build
16+
SPHINX_NUMJOBS_NOPLOT_DEFAULT=1
17+
else ($(shell uname), Darwin)
18+
# Avoid stalling issues on MacOS
19+
SPHINX_NUMJOBS_NOPLOT_DEFAULT=1
20+
else
21+
SPHINX_NUMJOBS_NOPLOT_DEFAULT=auto
22+
endif
23+
1724
# Internal variables.
1825
PAPEROPT_a4 = -D latex_paper_size=a4
1926
PAPEROPT_letter = -D latex_paper_size=letter
2027
ALLSPHINXOPTS = -T -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS)\
21-
-j$(SPHINX_NUMJOBS) $(EXAMPLES_PATTERN_OPTS) .
28+
$(EXAMPLES_PATTERN_OPTS) .
2229

2330

2431
.PHONY: help clean html dirhtml ziphtml pickle json latex latexpdf changes linkcheck doctest optipng
@@ -44,17 +51,27 @@ clean:
4451
-rm -rf generated/*
4552
-rm -rf modules/generated/
4653

54+
# Default to SPHINX_NUMJOBS=1 for full documentation build. Using
55+
# SPHINX_NUMJOBS!=1 may actually slow down the build, or cause weird issues in
56+
# the CI (job stalling or EOFError), see
57+
# https://github.com/scikit-learn/scikit-learn/pull/25836 or
58+
# https://github.com/scikit-learn/scikit-learn/pull/25809
59+
html: SPHINX_NUMJOBS ?= 1
4760
html:
4861
# These two lines make the build a bit more lengthy, and the
4962
# the embedding of images more robust
5063
rm -rf $(BUILDDIR)/html/_images
5164
#rm -rf _build/doctrees/
52-
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html/stable
65+
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) -j$(SPHINX_NUMJOBS) $(BUILDDIR)/html/stable
5366
@echo
5467
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html/stable"
5568

69+
# Default to SPHINX_NUMJOBS=auto (except on MacOS and CI) since this makes
70+
# html-noplot build faster
71+
html-noplot: SPHINX_NUMJOBS ?= $(SPHINX_NUMJOBS_NOPLOT_DEFAULT)
5672
html-noplot:
57-
$(SPHINXBUILD) -D plot_gallery=0 -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html/stable
73+
$(SPHINXBUILD) -D plot_gallery=0 -b html $(ALLSPHINXOPTS) -j$(SPHINX_NUMJOBS) \
74+
$(BUILDDIR)/html/stable
5875
@echo
5976
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html/stable."
6077

0 commit comments

Comments
 (0)
0