-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Use ci.py explicitly in docs building instructions #9971
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
Changes from all commits
5fa529c
07b2299
997fd29
1c87911
d1ed23a
5f528e8
6ebcff3
c12013f
2bb5f58
d35a262
63b80e3
07177cc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,15 +16,13 @@ | |
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| set -e | ||
| set -u | ||
| set -o pipefail | ||
| set -euo pipefail | ||
|
|
||
| source tests/scripts/setup-pytest-env.sh | ||
|
|
||
| # to avoid CI CPU thread throttling. | ||
| export TVM_BIND_THREADS=0 | ||
| export OMP_NUM_THREADS=4 | ||
| export OMP_NUM_THREADS=1 | ||
| IS_LOCAL=${IS_LOCAL:-0} | ||
| PYTHON_DOCS_ONLY=${PYTHON_DOCS_ONLY:-0} | ||
|
|
||
|
|
@@ -34,14 +32,82 @@ cleanup() | |
| } | ||
| trap cleanup 0 | ||
|
|
||
| # cleanup old states | ||
| rm -rf docs/_build | ||
| rm -rf docs/_staging | ||
| mkdir -p docs/_build/html | ||
| mkdir -p docs/_staging/html | ||
| rm -rf docs/gen_modules | ||
| rm -rf docs/doxygen | ||
| clean_files() { | ||
| # cleanup old states | ||
| rm -rf docs/_build | ||
| rm -rf docs/_staging | ||
| mkdir -p docs/_build/html | ||
| mkdir -p docs/_staging/html | ||
| rm -rf docs/gen_modules | ||
| rm -rf docs/doxygen | ||
| find . -type f -path "*.pyc" | xargs rm -f | ||
| } | ||
|
|
||
| sphinx_precheck() { | ||
| clean_files | ||
| echo "PreCheck sphinx doc generation WARNINGS.." | ||
| make cython3 | ||
|
|
||
| pushd docs | ||
| make clean | ||
| TVM_TUTORIAL_EXEC_PATTERN=none make html 2>&1 | tee /tmp/$$.log.txt | ||
| check_sphinx_warnings "docs" | ||
| popd | ||
| } | ||
|
|
||
|
|
||
| function join_by { local IFS="$1"; shift; echo "$*"; } | ||
|
|
||
| # These warnings are produced during the docs build for various reasons and are | ||
| # known to not signficantly affect the output. Don't add anything new to this | ||
| # list without special consideration of its effects, and don't add anything with | ||
| # a '|' character. | ||
| IGNORED_WARNINGS=( | ||
| '__mro__' | ||
| 'UserWarning' | ||
| 'FutureWarning' | ||
| 'tensorflow' | ||
| 'Keras' | ||
| 'pytorch' | ||
| 'TensorFlow' | ||
| 'coremltools' | ||
| '403' | ||
| 'git describe' | ||
| 'scikit-learn version' | ||
| 'doing serial write' | ||
| 'gen_gallery extension is not safe for parallel' | ||
| 'strategy:conv2d NHWC layout is not optimized for x86 with autotvm.' | ||
| 'strategy:depthwise_conv2d NHWC layout is not optimized for x86 with autotvm.' | ||
| 'autotvm:Cannot find config for target=llvm -keys=cpu -link-params=0' | ||
| 'autotvm:One or more operators have not been tuned. Please tune your model for better performance. Use DEBUG logging level to see more details.' | ||
| 'autotvm:Cannot find config for target=cuda -keys=cuda,gpu' | ||
| ) | ||
|
|
||
| JOINED_WARNINGS=$(join_by '|' "${IGNORED_WARNINGS[@]}") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is a little perilous as they aren't escaped. wdyt about doing this in python and then we could add tests?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ideally the entire CI would be mostly Python and minimal bash instead of the opposite which we have right now. but to keep this PR simple since it does re-arrange a bunch of stuff I think we should leave it as is for now and leave migrating to Python for a follow up |
||
|
|
||
| check_sphinx_warnings() { | ||
| grep -v -E "$JOINED_WARNINGS" < /tmp/$$.log.txt > /tmp/$$.logclean.txt || true | ||
| if grep --quiet -E "WARN" < /tmp/$$.logclean.txt; then | ||
| echo "Lines with 'WARNING' found in the log, please fix them:" | ||
| grep -E "WARN" < /tmp/$$.logclean.txt | ||
| echo "You can reproduce locally by running 'python tests/scripts/ci.py $1'" | ||
| exit 1 | ||
| fi | ||
| echo "No WARNINGS to be fixed." | ||
| } | ||
|
|
||
| # run precheck step first to fast-fail if there are problems with the docs | ||
| if [ "$IS_LOCAL" != "1" ]; then | ||
| echo "Running precheck" | ||
| sphinx_precheck | ||
| else | ||
| # skip the precheck when doing local builds since it would add overhead to | ||
| # re-runs (and tutorials are usually not enabled anyways) | ||
| echo "Skipping precheck" | ||
| fi | ||
|
|
||
|
|
||
| clean_files | ||
| # prepare auto scheduler tutorials | ||
| rm -rf gallery/how_to/tune_with_auto_scheduler/*.json | ||
| rm -rf gallery/tutorial/*.json | ||
|
|
@@ -55,11 +121,14 @@ find . -type f -path "*.pyc" | xargs rm -f | |
| make cython3 | ||
|
|
||
| cd docs | ||
| PYTHONPATH=`pwd`/../python make html SPHINXOPTS='-j auto' |& tee /tmp/$$.log.txt | ||
| PYTHONPATH=$(pwd)/../python make html SPHINXOPTS='-j auto' |& tee /tmp/$$.log.txt | ||
| if grep -E "failed to execute|Segmentation fault" < /tmp/$$.log.txt; then | ||
| echo "Some of sphinx-gallery item example failed to execute." | ||
| exit 1 | ||
| fi | ||
|
|
||
| check_sphinx_warnings "docs --tutorial-pattern=.*" | ||
|
|
||
| cd .. | ||
|
|
||
| if [ "$IS_LOCAL" == "1" ] && [ "$PYTHON_DOCS_ONLY" == "1" ]; then | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you add a comment explaining why these are ignored, and which piece of the warning string these match? i.e if I want to add one here, what do i do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a comment, generally people shouldn't be adding new warnings here unless there are infra problems (i.e. we had to ignore some stuff when bumping up the PyTorch version). Most of these aren't new and were being ignored before, just not in the actual docs build (where they weren't checked at all) and only on the precheck.