Skip to content

Commit e98726d

Browse files
authored
Cloud Utilities Improvement (vwxyzjn#65)
* cache changes * add dockerfile exmaple * refactor terraform files * support multi-arch * refactor * refactor * fix caching * update Dockerfile * include entrypoint * simplify the process of using wandb key * update docs * update dockerfile * refactor * test * update main.tf * update readme * fix docs * refactor * update files * better instructions * modify docs * add a test case * minor update * fix format * update test cases * update workflow * dummy change
1 parent 1b6d817 commit e98726d

22 files changed

+349
-391
lines changed

.dockerignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
*.mp4
2+
*.pyc
3+
*.pyo
4+
*.log
5+
*.json
6+
**/wandb
7+
**/runs
8+
**/videos
9+
.git
10+
*.tfevents.*

.github/workflows/tests.yaml

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ on:
33
push:
44
paths:
55
- cleanrl/**
6+
- tests/**
67
jobs:
7-
ci:
8+
test-core-envs:
89
strategy:
910
fail-fast: false
1011
matrix:
@@ -28,19 +29,51 @@ jobs:
2829
- name: Run core tests
2930
run: poetry run pytest tests/test_classic_control.py
3031

32+
test-atari-envs:
33+
strategy:
34+
fail-fast: false
35+
matrix:
36+
python-version: [3.8]
37+
poetry-version: [1.1.11]
38+
os: [ubuntu-18.04, macos-latest, windows-latest]
39+
runs-on: ${{ matrix.os }}
40+
steps:
41+
- uses: actions/checkout@v2
42+
- uses: actions/setup-python@v2
43+
with:
44+
python-version: ${{ matrix.python-version }}
45+
- name: Run image
46+
uses: abatilo/[email protected]
47+
with:
48+
poetry-version: ${{ matrix.poetry-version }}
49+
3150
# atari tests
32-
- name: Remove existing poetry environment
33-
run: poetry env remove python
3451
- name: Install core dependencies
3552
run: poetry install -E pytest
3653
- name: Install atari dependencies
3754
run: poetry install -E atari
3855
- name: Run atari tests
3956
run: poetry run pytest tests/test_atari.py
4057

58+
test-pybullet-envs:
59+
strategy:
60+
fail-fast: false
61+
matrix:
62+
python-version: [3.8]
63+
poetry-version: [1.1.11]
64+
os: [ubuntu-18.04, macos-latest, windows-latest]
65+
runs-on: ${{ matrix.os }}
66+
steps:
67+
- uses: actions/checkout@v2
68+
- uses: actions/setup-python@v2
69+
with:
70+
python-version: ${{ matrix.python-version }}
71+
- name: Run image
72+
uses: abatilo/[email protected]
73+
with:
74+
poetry-version: ${{ matrix.poetry-version }}
75+
4176
# pybullet tests
42-
- name: Remove existing poetry environment
43-
run: poetry env remove python
4477
- name: Install core dependencies
4578
run: poetry install -E pytest
4679
- name: Install pybullet dependencies

.github/workflows/utils_test.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: utils_test
2+
on:
3+
push:
4+
paths:
5+
- cleanrl_utils/**
6+
- tests/**
7+
jobs:
8+
ci:
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
python-version: [3.8]
13+
poetry-version: [1.1.11]
14+
os: [ubuntu-18.04]
15+
runs-on: ${{ matrix.os }}
16+
steps:
17+
- uses: actions/checkout@v2
18+
- uses: actions/setup-python@v2
19+
with:
20+
python-version: ${{ matrix.python-version }}
21+
- name: Run image
22+
uses: abatilo/[email protected]
23+
with:
24+
poetry-version: ${{ matrix.poetry-version }}
25+
26+
- name: Install test dependencies
27+
run: poetry install -E pytest
28+
- name: Install cloud dependencies
29+
run: poetry install -E cloud
30+
- name: Run utils tests
31+
run: poetry run pytest tests/test_utils.py

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
debug.sh.docker.sh
2+
docker_cache
13
rl-video-*.mp4
24
rl-video-*.json
35
cleanrl_utils/charts_episode_reward

Dockerfile

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
FROM nvidia/cuda:11.4.2-runtime-ubuntu20.04
2+
3+
# install ubuntu dependencies
4+
ENV DEBIAN_FRONTEND=noninteractive
5+
RUN apt-get update && \
6+
apt-get -y install python3-pip xvfb ffmpeg git build-essential python-opengl
7+
RUN ln -s /usr/bin/python3 /usr/bin/python
8+
9+
# install python dependencies
10+
RUN pip install poetry
11+
COPY pyproject.toml pyproject.toml
12+
COPY poetry.lock poetry.lock
13+
RUN poetry install
14+
RUN poetry install -E atari
15+
RUN poetry install -E pybullet
16+
17+
# install mujoco
18+
RUN apt-get -y install wget unzip software-properties-common \
19+
libgl1-mesa-dev \
20+
libgl1-mesa-glx \
21+
libglew-dev \
22+
libosmesa6-dev patchelf
23+
RUN poetry install -E mujoco
24+
RUN poetry run python -c "import mujoco_py"
25+
26+
COPY entrypoint.sh /usr/local/bin/
27+
RUN chmod 777 /usr/local/bin/entrypoint.sh
28+
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
29+
30+
# copy local files
31+
COPY ./cleanrl /cleanrl

cleanrl_utils/docker_build.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import subprocess
2+
import argparse
3+
4+
parser = argparse.ArgumentParser()
5+
parser.add_argument('--tag', type=str, default="cleanrl:latest",
6+
help='the name of this experiment')
7+
args = parser.parse_args()
8+
9+
subprocess.run(
10+
f"docker build -t {args.tag} .",
11+
shell=True,
12+
check=True,
13+
)
14+

0 commit comments

Comments
 (0)