task_pytorch_tutorial_test.sh 878 Bytes
Newer Older
Minjie Wang's avatar
Minjie Wang committed
1
2
3
#!/bin/bash
# The working directory for this script will be "tests/scripts"

VoVAllen's avatar
VoVAllen committed
4
5
. /opt/conda/etc/profile.d/conda.sh
conda activate pytorch-ci
Minjie Wang's avatar
Minjie Wang committed
6
TUTORIAL_ROOT="./tutorials"
7
NEW_TUTORIAL_ROOT="./new-tutorial"
8

Minjie Wang's avatar
Minjie Wang committed
9
10
11
12
13
function fail {
    echo FAIL: $@
    exit -1
}

Minjie Wang's avatar
Minjie Wang committed
14
15
16
17
18
19
export MPLBACKEND=Agg
export DGLBACKEND=pytorch
export DGL_LIBRARY_PATH=${PWD}/build
export PYTHONPATH=${PWD}/python:$PYTHONPATH
export DGL_DOWNLOAD_DIR=${PWD}

20
21
pushd ${TUTORIAL_ROOT} > /dev/null
# Install requirements
VoVAllen's avatar
VoVAllen committed
22
pip install -r requirements.txt || fail "installing requirements"
Minjie Wang's avatar
Minjie Wang committed
23

24
# Test
25
for f in $(find . -name "*.py" ! -name "*_mx.py")
Minjie Wang's avatar
Minjie Wang committed
26
27
28
29
do
    echo "Running tutorial ${f} ..."
    python3 $f || fail "run ${f}"
done
30

31
32
33
34
35
36
37
38
39
popd > /dev/null

pushd ${NEW_TUTORIAL_ROOT} > /dev/null
for f in $(find . -name "*.py" ! -name "*_mx.py")
do
    echo "Running tutorial ${f} ..."
    python3 $f || fail "run ${f}"
done
popd > /dev/null