Skip to content

Commit a7a0235

Browse files
rohitnigvmoens
andauthored
[CI] pytest should not skip tests for dependencies (#1048)
Co-authored-by: vmoens <vincentmoens@gmail.com>
1 parent 42cbc85 commit a7a0235

File tree

30 files changed

+245
-178
lines changed

30 files changed

+245
-178
lines changed

.circleci/config.yml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -850,7 +850,7 @@ jobs:
850850
image: ubuntu-2004-cuda-11.4:202110-01
851851
resource_class: gpu.nvidia.medium
852852
environment:
853-
image_name: "pytorch/manylinux-cuda117"
853+
image_name: "nvidia/cudagl:11.4.0-base"
854854
TAR_OPTIONS: --no-same-owner
855855
PYTHON_VERSION: << parameters.python_version >>
856856
CU_VERSION: << parameters.cu_version >>
@@ -875,8 +875,7 @@ jobs:
875875
- env
876876
- run:
877877
name: Install torchrl, run tests
878-
command: |
879-
docker run -t --env=CUDA_VISIBLE_DEVICES="" --gpus all -v $PWD:$PWD -w $PWD -e UPLOAD_CHANNEL -e CU_VERSION "${image_name}" .circleci/unittest/linux_libs/scripts_gym/batch_scripts.sh
878+
command: docker run -e PYTHON_VERSION -t --gpus all -v $PWD:$PWD -w $PWD "${image_name}" .circleci/unittest/linux_libs/scripts_gym/batch_scripts.sh
880879
- run:
881880
name: Codecov upload
882881
command: |
@@ -895,7 +894,7 @@ jobs:
895894
image: ubuntu-2004-cuda-11.4:202110-01
896895
resource_class: gpu.nvidia.medium
897896
environment:
898-
image_name: "pytorch/manylinux-cuda117"
897+
image_name: "nvidia/cudagl:11.4.0-base"
899898
TAR_OPTIONS: --no-same-owner
900899
PYTHON_VERSION: << parameters.python_version >>
901900
CU_VERSION: << parameters.cu_version >>
@@ -936,7 +935,7 @@ jobs:
936935
command: docker run -t --gpus all -v $PWD:$PWD -w $PWD -e UPLOAD_CHANNEL -e CU_VERSION "${image_name}" .circleci/unittest/linux_optdeps/scripts/install.sh
937936
- run:
938937
name: Run tests
939-
command: bash .circleci/unittest/linux_optdeps/scripts/run_test.sh
938+
command: docker run -t --gpus all -v $PWD:$PWD -w $PWD -e UPLOAD_CHANNEL -e CU_VERSION "${image_name}" .circleci/unittest/linux_optdeps/scripts/run_test.sh
940939
# command: docker run --env-file ./env.list -t --gpus all -v $PWD:$PWD -w $PWD "${image_name}" .circleci/unittest/linux/scripts/run_test.sh
941940
- run:
942941
name: Codecov upload
@@ -1070,7 +1069,7 @@ jobs:
10701069
image: ubuntu-2004-cuda-11.4:202110-01
10711070
resource_class: gpu.nvidia.medium
10721071
environment:
1073-
image_name: "pytorch/manylinux-cuda116"
1072+
image_name: "nvidia/cudagl:11.4.0-base"
10741073
TAR_OPTIONS: --no-same-owner
10751074
PYTHON_VERSION: << parameters.python_version >>
10761075
CU_VERSION: << parameters.cu_version >>
@@ -1096,8 +1095,7 @@ jobs:
10961095
- run:
10971096
name: Install torchrl, run tests
10981097
command: |
1099-
docker run -t --env=CUDA_VISIBLE_DEVICES="" --gpus all -v $PWD:$PWD -w $PWD -e UPLOAD_CHANNEL -e CU_VERSION "${image_name}" .circleci/unittest/linux_olddeps/scripts_gym_0_13/batch_scripts.sh
1100-
# docker run -t --gpus all -v $PWD:$PWD -w $PWD -e UPLOAD_CHANNEL -e CU_VERSION "${image_name}" .circleci/unittest/linux_olddeps/scripts_gym_0_13/batch_scripts.sh
1098+
docker run -e PYTHON_VERSION -t --gpus all -v $PWD:$PWD -w $PWD "${image_name}" .circleci/unittest/linux_olddeps/scripts_gym_0_13/batch_scripts.sh
11011099
- run:
11021100
name: Codecov upload
11031101
command: |
@@ -1106,7 +1104,7 @@ jobs:
11061104
./codecov -t ${CODECOV_TOKEN} -s ./ -Z -F olddeps-gpu
11071105
- run:
11081106
name: Post process
1109-
command: docker run -t --gpus all -v $PWD:$PWD -w $PWD -e UPLOAD_CHANNEL -e CU_VERSION "${image_name}" .circleci/unittest/linux_olddeps/scripts_gym_0_13/post_process.sh
1107+
command: docker run -e PYTHON_VERSION -t --gpus all -v $PWD:$PWD -w $PWD "${image_name}" .circleci/unittest/linux_olddeps/scripts_gym_0_13/post_process.sh
11101108
- store_test_results:
11111109
path: test-results
11121110

.circleci/unittest/linux_libs/scripts_brax/environment.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ dependencies:
1212
- pytest-mock
1313
- pytest-instafail
1414
- pytest-rerunfailures
15+
- pytest-error-for-skips
1516
- expecttest
1617
- pyyaml
1718
- scipy

.circleci/unittest/linux_libs/scripts_brax/run_test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ export MAGNUM_LOG=verbose MAGNUM_GPU_VALIDATION=ON
2828
# this workflow only tests the libs
2929
python -c "import brax"
3030

31-
python .circleci/unittest/helpers/coverage_run_parallel.py -m pytest test/test_libs.py --instafail -v --durations 20 --capture no -k TestBrax
31+
python .circleci/unittest/helpers/coverage_run_parallel.py -m pytest test/test_libs.py --instafail -v --durations 20 --capture no -k TestBrax --error-for-skips
3232
coverage combine
3333
coverage xml -i

.circleci/unittest/linux_libs/scripts_d4rl/environment.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ dependencies:
1212
- pytest-mock
1313
- pytest-instafail
1414
- pytest-rerunfailures
15+
- pytest-error-for-skips
1516
- expecttest
1617
- pyyaml
1718
- scipy

.circleci/unittest/linux_libs/scripts_d4rl/run_test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@ conda deactivate && conda activate ./env
3737
# this workflow only tests the libs
3838
python -c "import gym, d4rl"
3939

40-
python .circleci/unittest/helpers/coverage_run_parallel.py -m pytest test/test_libs.py --instafail -v --durations 20 --capture no -k TestD4RL
40+
python .circleci/unittest/helpers/coverage_run_parallel.py -m pytest test/test_libs.py --instafail -v --durations 20 --capture no -k TestD4RL --error-for-skips
4141
coverage combine
4242
coverage xml -i

.circleci/unittest/linux_libs/scripts_gym/batch_scripts.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ conda activate ./env
1414
$DIR/install.sh
1515

1616
# Extracted from run_test.sh to run once.
17-
yum makecache && yum install libglvnd-devel zlib-devel mesa-libGL mesa-libGL-devel mesa-libEGL mesa-libEGL-devel glfw mesa-libOSMesa-devel glew glew-devel egl-utils freeglut xorg-x11-server-Xvfb -y
18-
#yum makecache && yum install libglvnd-devel glew xorg-x11-server-Xvfb zlib-devel egl-utils freeglut mesa-libEGL -y
19-
17+
apt-get update && apt-get install -y git wget libglew-dev libx11-dev x11proto-dev g++
2018

2119
# This version is installed initially (see environment.yml)
2220
for GYM_VERSION in '0.13'

.circleci/unittest/linux_libs/scripts_gym/environment.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,10 @@ dependencies:
1818
- pytest-mock
1919
- pytest-instafail
2020
- pytest-rerunfailures
21+
- pytest-error-for-skips
2122
- expecttest
2223
- pyyaml
2324
- scipy
2425
- hydra-core
25-
- dm_control -e git+https://github.com/deepmind/dm_control.git@c053360edea6170acfd9c8f65446703307d9d352#egg={dm_control}
2626
- patchelf
27-
- pyopengl==3.1.4
28-
- ray
27+
- pyopengl==3.1.0

.circleci/unittest/linux_libs/scripts_gym/install.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ unset PYTORCH_VERSION
44
# For unittest, nightly PyTorch is used as the following section,
55
# so no need to set PYTORCH_VERSION.
66
# In fact, keeping PYTORCH_VERSION forces us to hardcode PyTorch version in config.
7+
apt-get update && apt-get install -y git wget gcc g++
78

89
set -e
910

.circleci/unittest/linux_libs/scripts_gym/run_test.sh

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ set -e
55
eval "$(./conda/bin/conda shell.bash hook)"
66
conda activate ./env
77

8-
#yum makecache && yum install libglvnd-devel mesa-libGL mesa-libGL-devel mesa-libEGL mesa-libEGL-devel glfw mesa-libOSMesa-devel glew glew-devel egl-utils freeglut xorg-x11-server-Xvfb -y
9-
#yum makecache && yum install glew -y
10-
118
export PYTORCH_TEST_WITH_SLOW='1'
129
python -m torch.utils.collect_env
1310
# Avoid error: "fatal: unsafe repository"
@@ -17,12 +14,14 @@ root_dir="$(git rev-parse --show-toplevel)"
1714
env_dir="${root_dir}/env"
1815
lib_dir="${env_dir}/lib"
1916

20-
# solves ImportError: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found
2117
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$lib_dir
2218
export MKL_THREADING_LAYER=GNU
2319

2420
python .circleci/unittest/helpers/coverage_run_parallel.py -m pytest test/smoke_test.py -v --durations 20
25-
python .circleci/unittest/helpers/coverage_run_parallel.py -m pytest test/smoke_test_deps.py -v --durations 20 -k 'test_gym or test_dm_control_pixels or test_dm_control'
26-
MUJOCO_GL=egl python .circleci/unittest/helpers/coverage_run_parallel.py -m pytest --instafail -v --durations 20 -k 'test_libs'
21+
python .circleci/unittest/helpers/coverage_run_parallel.py -m pytest test/smoke_test_deps.py -v --durations 20 -k 'test_gym'
22+
23+
export DISPLAY=':99.0'
24+
Xvfb :99 -screen 0 1400x900x24 > /dev/null 2>&1 &
25+
python .circleci/unittest/helpers/coverage_run_parallel.py -m pytest test/test_libs.py --instafail -v --durations 20 -k "gym" --error-for-skips
2726
coverage combine
2827
coverage xml -i

.circleci/unittest/linux_libs/scripts_gym/setup_env.sh

Lines changed: 35 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ set -e
99

1010
this_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
1111
# Avoid error: "fatal: unsafe repository"
12+
apt-get update && apt-get install -y git wget gcc g++
13+
1214
git config --global --add safe.directory '*'
1315
root_dir="$(git rev-parse --show-toplevel)"
1416
conda_dir="${root_dir}/conda"
@@ -38,45 +40,48 @@ if [ ! -d "${env_dir}" ]; then
3840
fi
3941
conda activate "${env_dir}"
4042

41-
# 3. Install mujoco
42-
printf "* Installing mujoco and related\n"
43-
mkdir -p $root_dir/.mujoco
44-
cd $root_dir/.mujoco/
45-
#wget https://github.com/deepmind/mujoco/releases/download/2.1.1/mujoco-2.1.1-linux-x86_64.tar.gz
46-
#tar -xf mujoco-2.1.1-linux-x86_64.tar.gz
47-
#wget https://mujoco.org/download/mujoco210-linux-x86_64.tar.gz
48-
wget https://www.roboti.us/download/mujoco200_linux.zip
49-
unzip mujoco200_linux.zip
50-
wget https://www.roboti.us/file/mjkey.txt
51-
cp mjkey.txt ./mujoco200_linux/bin/
52-
# install mujoco-py locally
43+
## 3. Install mujoco
44+
#printf "* Installing mujoco and related\n"
45+
#mkdir -p $root_dir/.mujoco
46+
#cd $root_dir/.mujoco/
47+
##wget https://github.com/deepmind/mujoco/releases/download/2.1.1/mujoco-2.1.1-linux-x86_64.tar.gz
48+
##tar -xf mujoco-2.1.1-linux-x86_64.tar.gz
49+
##wget https://mujoco.org/download/mujoco210-linux-x86_64.tar.gz
50+
#wget https://www.roboti.us/download/mujoco200_linux.zip
51+
#unzip mujoco200_linux.zip
52+
## install mujoco-py locally
5353
git clone https://github.com/vmoens/mujoco-py.git
54-
cd $this_dir
54+
cd mujoco-py
55+
git checkout aws_fix2
56+
mkdir -p mujoco_py/binaries/linux \
57+
&& wget https://mujoco.org/download/mujoco210-linux-x86_64.tar.gz -O mujoco.tar.gz \
58+
&& tar -xf mujoco.tar.gz -C mujoco_py/binaries/linux \
59+
&& rm mujoco.tar.gz
60+
wget https://www.roboti.us/file/mjkey.txt
61+
cp mjkey.txt mujoco_py/binaries/
62+
pip install -e .
63+
cd ..
64+
65+
#cd $this_dir
5566

5667
# 4. Install Conda dependencies
5768
printf "* Installing dependencies (except PyTorch)\n"
5869
echo " - python=${PYTHON_VERSION}" >> "${this_dir}/environment.yml"
5970
cat "${this_dir}/environment.yml"
6071

61-
62-
if [[ $OSTYPE == 'darwin'* ]]; then
63-
PRIVATE_MUJOCO_GL=glfw
64-
elif [ "${CU_VERSION:-}" == cpu ]; then
65-
PRIVATE_MUJOCO_GL=osmesa
66-
else
67-
PRIVATE_MUJOCO_GL=osmesa
68-
fi
69-
70-
export MUJOCO_GL=$PRIVATE_MUJOCO_GL
72+
export MUJOCO_GL=egl
7173
conda env config vars set \
72-
MUJOCO_PY_MUJOCO_PATH=$root_dir/.mujoco/mujoco200_linux \
73-
DISPLAY=unix:0.0 \
74-
MJLIB_PATH=$root_dir/.mujoco/mujoco200_linux/bin/libmujoco200.so \
75-
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$root_dir/.mujoco/mujoco200_linux/bin \
76-
MUJOCO_PY_MJKEY_PATH=$root_dir/.mujoco/mjkey.txt \
74+
MUJOCO_GL=egl \
7775
SDL_VIDEODRIVER=dummy \
78-
MUJOCO_GL=$PRIVATE_MUJOCO_GL \
79-
PYOPENGL_PLATFORM=$PRIVATE_MUJOCO_GL
76+
DISPLAY=unix:0.0 \
77+
PYOPENGL_PLATFORM=egl \
78+
LD_PRELOAD=$glew_path \
79+
NVIDIA_PATH=/usr/src/nvidia-470.63.01 \
80+
MUJOCO_PY_MJKEY_PATH=${root_dir}/mujoco-py/mujoco_py/binaries/mjkey.txt \
81+
MUJOCO_PY_MUJOCO_PATH=${root_dir}/mujoco-py/mujoco_py/binaries/linux/mujoco210 \
82+
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/circleci/project/mujoco-py/mujoco_py/binaries/linux/mujoco210/bin
83+
84+
# LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/src/nvidia-470.63.01 \
8085

8186
# make env variables apparent
8287
conda deactivate && conda activate "${env_dir}"
@@ -93,12 +98,3 @@ mkdir Roms
9398
wget http://www.atarimania.com/roms/Roms.rar
9499
./rar/unrar e Roms.rar ./Roms -y
95100
python -m atari_py.import_roms Roms
96-
97-
#yum makecache && yum install libglvnd-devel mesa-libGL mesa-libGL-devel mesa-libEGL glfw mesa-libOSMesa-devel glew egl-utils freeglut -y
98-
yum makecache && yum install libglvnd-devel glew zlib-devel -y
99-
100-
# install mujoco-py locally
101-
cd ${root_dir}/.mujoco/mujoco-py
102-
git checkout aws_fix
103-
pip install -e .
104-
cd $this_dir

0 commit comments

Comments
 (0)