-
Notifications
You must be signed in to change notification settings - Fork 931
/
Copy pathtest_notebooks.sh
executable file
·69 lines (54 loc) · 2.19 KB
/
test_notebooks.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/bash
# Copyright (c) 2020-2025, NVIDIA CORPORATION.
set -euo pipefail
. /opt/conda/etc/profile.d/conda.sh
RAPIDS_VERSION="$(rapids-version)"
rapids-logger "Generate notebook testing dependencies"
ENV_YAML_DIR="$(mktemp -d)"
rapids-dependency-file-generator \
--output conda \
--file-key test_notebooks \
--matrix "cuda=${RAPIDS_CUDA_VERSION%.*};arch=$(arch);py=${RAPIDS_PY_VERSION}" | tee "${ENV_YAML_DIR}/env.yaml"
rapids-mamba-retry env create --yes -f "${ENV_YAML_DIR}/env.yaml" -n test
# Temporarily allow unbound variables for conda activation.
set +u
conda activate test
set -u
rapids-print-env
rapids-logger "Downloading artifacts from previous jobs"
CPP_CHANNEL=$(rapids-download-conda-from-s3 cpp)
PYTHON_CHANNEL=$(rapids-download-conda-from-s3 python)
rapids-mamba-retry install \
--channel "${CPP_CHANNEL}" \
--channel "${PYTHON_CHANNEL}" \
"cudf=${RAPIDS_VERSION}" \
"libcudf=${RAPIDS_VERSION}"
NBTEST="$(realpath "$(dirname "$0")/utils/nbtest.sh")"
pushd notebooks
# Add notebooks that should be skipped here
# (space-separated list of filenames without paths)
SKIPNBS="performance-comparisons.ipynb"
EXITCODE=0
trap "EXITCODE=1" ERR
set +e
# Loops over `find` are fragile but this seems to be working
# shellcheck disable=SC2044
for nb in $(find . -name "*.ipynb"); do
nbBasename=$(basename "${nb}")
# Skip all notebooks that use dask (in the code or even in their name)
if (echo "${nb}" | grep -qi dask) || \
(grep -q dask "${nb}"); then
echo "--------------------------------------------------------------------------------"
echo "SKIPPING: ${nb} (suspected Dask usage, not currently automatable)"
echo "--------------------------------------------------------------------------------"
elif (echo " ${SKIPNBS} " | grep -q " ${nbBasename} "); then
echo "--------------------------------------------------------------------------------"
echo "SKIPPING: ${nb} (listed in skip list)"
echo "--------------------------------------------------------------------------------"
else
nvidia-smi
${NBTEST} "${nbBasename}"
fi
done
rapids-logger "Test script exiting with value: $EXITCODE"
exit ${EXITCODE}