Skip to content

Commit

Permalink
Cloud Utilities Improvement (vwxyzjn#65)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
vwxyzjn authored Nov 3, 2021
1 parent 1b6d817 commit e98726d
Show file tree
Hide file tree
Showing 22 changed files with 349 additions and 391 deletions.
10 changes: 10 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
*.mp4
*.pyc
*.pyo
*.log
*.json
**/wandb
**/runs
**/videos
.git
*.tfevents.*
43 changes: 38 additions & 5 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ on:
push:
paths:
- cleanrl/**
- tests/**
jobs:
ci:
test-core-envs:
strategy:
fail-fast: false
matrix:
Expand All @@ -28,19 +29,51 @@ jobs:
- name: Run core tests
run: poetry run pytest tests/test_classic_control.py

test-atari-envs:
strategy:
fail-fast: false
matrix:
python-version: [3.8]
poetry-version: [1.1.11]
os: [ubuntu-18.04, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Run image
uses: abatilo/actions-poetry@v2.0.0
with:
poetry-version: ${{ matrix.poetry-version }}

# atari tests
- name: Remove existing poetry environment
run: poetry env remove python
- name: Install core dependencies
run: poetry install -E pytest
- name: Install atari dependencies
run: poetry install -E atari
- name: Run atari tests
run: poetry run pytest tests/test_atari.py

test-pybullet-envs:
strategy:
fail-fast: false
matrix:
python-version: [3.8]
poetry-version: [1.1.11]
os: [ubuntu-18.04, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Run image
uses: abatilo/actions-poetry@v2.0.0
with:
poetry-version: ${{ matrix.poetry-version }}

# pybullet tests
- name: Remove existing poetry environment
run: poetry env remove python
- name: Install core dependencies
run: poetry install -E pytest
- name: Install pybullet dependencies
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/utils_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: utils_test
on:
push:
paths:
- cleanrl_utils/**
- tests/**
jobs:
ci:
strategy:
fail-fast: false
matrix:
python-version: [3.8]
poetry-version: [1.1.11]
os: [ubuntu-18.04]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Run image
uses: abatilo/actions-poetry@v2.0.0
with:
poetry-version: ${{ matrix.poetry-version }}

- name: Install test dependencies
run: poetry install -E pytest
- name: Install cloud dependencies
run: poetry install -E cloud
- name: Run utils tests
run: poetry run pytest tests/test_utils.py
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
debug.sh.docker.sh
docker_cache
rl-video-*.mp4
rl-video-*.json
cleanrl_utils/charts_episode_reward
Expand Down
31 changes: 31 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM nvidia/cuda:11.4.2-runtime-ubuntu20.04

# install ubuntu dependencies
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get -y install python3-pip xvfb ffmpeg git build-essential python-opengl
RUN ln -s /usr/bin/python3 /usr/bin/python

# install python dependencies
RUN pip install poetry
COPY pyproject.toml pyproject.toml
COPY poetry.lock poetry.lock
RUN poetry install
RUN poetry install -E atari
RUN poetry install -E pybullet

# install mujoco
RUN apt-get -y install wget unzip software-properties-common \
libgl1-mesa-dev \
libgl1-mesa-glx \
libglew-dev \
libosmesa6-dev patchelf
RUN poetry install -E mujoco
RUN poetry run python -c "import mujoco_py"

COPY entrypoint.sh /usr/local/bin/
RUN chmod 777 /usr/local/bin/entrypoint.sh
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]

# copy local files
COPY ./cleanrl /cleanrl
14 changes: 14 additions & 0 deletions cleanrl_utils/docker_build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import subprocess
import argparse

parser = argparse.ArgumentParser()
parser.add_argument('--tag', type=str, default="cleanrl:latest",
help='the name of this experiment')
args = parser.parse_args()

subprocess.run(
f"docker build -t {args.tag} .",
shell=True,
check=True,
)

Loading

0 comments on commit e98726d

Please sign in to comment.