Skip to content

Commit

Permalink
travis build and test failure fixes (openai#1031)
Browse files Browse the repository at this point in the history
* build test image from scratch from ubuntu:16.04

* removed pulling old image from .travis.yml

* try installing keyboard-configuration on docker on travis

* trying install keyboard-configuration before rest of the packages

* upgrading dockerfile and entrypoint to work with ubuntu16.04

* fixing dummy display config wip

* install keyboard-properties first in dockerfile

* pass mujoco_key in .travis.yml

* skipsdist in tox.ini

* removed unpacking of the mujoco bundle in entrypoint

* using xvfb for fake display

* comment out self.viewer.close

* install ffmpeg

* squash run commands in dockerfile

* fixed typo in dockerfile

* fixed typo in dockerfile

* fixed typo in dockerfile

* use self.np_random in robotics/hand/manipulate

* some cleanups in .travis.yml

* cleaning up accidental changes

* cleaning up accidental changes

* inject mujoco key on runtime (instead of container buildtime)

* remove webhooks section from .travis.yml
  • Loading branch information
pzhokhov authored May 15, 2018
1 parent 0ccb08d commit 74229c8
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 72 deletions.
16 changes: 2 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,12 @@ language: python
services:
- docker
before_install:
# Prime the cache. We currently manually keep this synced.
- docker pull quay.io/openai/gym:test
# - docker build -f test.dockerfile -t quay.io/openai/gym:test .
# ^^^ commented out by joschu 2017/9/3
# build command fails due to apt issue "The following packages have unmet dependencies:"
- docker build -f test.dockerfile -t gym-test .
install: "" # so travis doesn't do pip install requirements.txt
script:
# In a pull request, there are no secrets, and hence no MuJoCo:
# https://docs.travis-ci.com/user/pull-requests#Security-Restrictions-when-testing-Pull-Requests.
- docker run -e MUJOCO_KEY_BUNDLE="${MUJOCO_KEY_BUNDLE:-}" quay.io/openai/gym:test tox
- docker run -e MUJOCO_KEY=$MUJOCO_KEY gym-test tox

notifications:
slack:
secure: h/Mxm8K+avH/2W0818zCHmLloRPMFN4NJL01+VShvAkH80/acfjeq/+mMdWXXPL/oOB6kSHDk+GDhwR6+s03ZcPMn5INTFvFYqUc6UWmT+NXtOPxGTN0xda6MdYUkWQUKaMyjFrweZQOMOASFBIzPOq4XeVbM5aB8s4EJhnfAcYZhp/idwKbToVihN4KZgxlvZIFc8iEp1o9uSl5qrsaeYYYXRkb6mauacAwOo4/Chu+cOnoLUOnvhBFE3rV3doDNrbnoalO8XiExtgx5CIAYWrlMni7r2Q+LlzgwdyTH19ZtybPxJTZIIWSBQ2UtcoYdIEDcc36GcUwz1VUGg32mLJJnY2xw80CWR4ixFPpLwwP5Y99WTn8v094B4nmFTWOwNWXp3EkqtTN9XcJoRBqXB5ArucIPqrx57dOCljSKx22gL6WaF2p3stSAxIGFektGyGnisaELrFZG1C63aHoUPicj3gUlijmAoUmYaDRf6P1wnpXqBpKDAWWhAMSatvx1ekmEJgR7OQklQnnfjx9kENDUygNUWS4IQwN2qYieuzHFL3of7/30mTM43+Vt/vWN8GI7j01BXu6FNGGloHxjH1pt3bLP/+uj5BJsT2HWF+Z8XR4VE6cyVuKsQAFgCXwOkoDHALbcwsspONDIt/9ixkesgh1oFt4CzU3UuU5wYs=
on_success: change
webhooks:
urls:
- https://hooks.zapier.com/hooks/catch/1711022/6ztmzh/
- https://hooks.zapier.com/hooks/catch/1711022/6zhc8p/
on_success: always
on_failure: always
5 changes: 1 addition & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
# A Dockerfile that sets up a full Gym install
FROM ubuntu:14.04
FROM ubuntu:16.04

RUN apt-get update \
&& apt-get install -y libav-tools \
python-numpy \
python-scipy \
python-pyglet \
python-setuptools \
libpq-dev \
libjpeg-dev \
Expand Down
13 changes: 5 additions & 8 deletions bin/docker_entrypoint
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
#!/bin/sh

# This script is the entrypoint for our Docker image.

set -e

path=$(cd $(dirname "$0") && pwd)

[ -z "${MUJOCO_KEY_BUNDLE}" ] || ( mkdir -p ~/.mujoco && curl https://openai-public.s3-us-west-2.amazonaws.com/mujoco/$MUJOCO_KEY_BUNDLE.tar.gz | tar xz -C ~/.mujoco )
# Inject the mujoco license key (if planning to publish image, this step has to be runtime)
echo $MUJOCO_KEY | base64 --decode > /root/.mujoco/mjkey.txt

# Set up display; otherwise rendering will fail
rm -f /tmp/.X12-lock
"$path/../vendor/Xdummy" :12 &
export DISPLAY=:12
Xvfb -screen 0 1024x768x24 &
export DISPLAY=:0

# Wait for the file to come up
display=12
display=0
file="/tmp/.X11-unix/X$display"
for i in $(seq 1 10); do
if [ -e "$file" ]; then
Expand Down
2 changes: 1 addition & 1 deletion gym/envs/mujoco/mujoco_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def render(self, mode='human'):

def close(self):
if self.viewer is not None:
self.viewer.finish()
# self.viewer.finish()
self.viewer = None

def _get_viewer(self):
Expand Down
4 changes: 2 additions & 2 deletions gym/envs/robotics/hand/manipulate.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def _reset_sim(self):
initial_quat = rotations.quat_mul(initial_quat, offset_quat)
elif self.target_rotation in ['xyz', 'ignore']:
angle = self.np_random.uniform(-np.pi, np.pi)
axis = np.random.uniform(-1., 1., size=3)
axis = self.np_random.uniform(-1., 1., size=3)
offset_quat = quat_from_angle_and_axis(angle, axis)
initial_quat = rotations.quat_mul(initial_quat, offset_quat)
elif self.target_rotation == 'fixed':
Expand Down Expand Up @@ -223,7 +223,7 @@ def _sample_goal(self):
target_quat = rotations.quat_mul(target_quat, parallel_quat)
elif self.target_rotation == 'xyz':
angle = self.np_random.uniform(-np.pi, np.pi)
axis = np.random.uniform(-1., 1., size=3)
axis = self.np_random.uniform(-1., 1., size=3)
target_quat = quat_from_angle_and_axis(angle, axis)
elif self.target_rotation in ['ignore', 'fixed']:
target_quat = self.sim.data.get_joint_qpos('object:joint')
Expand Down
2 changes: 1 addition & 1 deletion gym/envs/robotics/robot_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def reset(self):

def close(self):
if self.viewer is not None:
self.viewer.finish()
# self.viewer.finish()
self.viewer = None

def render(self, mode='human'):
Expand Down
96 changes: 57 additions & 39 deletions test.dockerfile
Original file line number Diff line number Diff line change
@@ -1,44 +1,62 @@
# A Dockerfile that sets up a full Gym install
FROM quay.io/openai/gym:base

RUN apt-get update \
&& apt-get install -y libav-tools \
python-numpy \
python-scipy \
python-pyglet \
python-setuptools \
libpq-dev \
libjpeg-dev \
curl \
cmake \
swig \
python-opengl \
libboost-all-dev \
libsdl2-dev \
wget \
unzip \
git \
xpra \
libav-tools \
python3-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& easy_install pip
# A Dockerfile that sets up a full Gym install with test dependencies
FROM ubuntu:16.04

WORKDIR /usr/local/gym/
RUN mkdir -p gym && touch gym/__init__.py
COPY ./gym/version.py ./gym/
COPY ./requirements.txt ./
COPY ./setup.py ./
COPY ./tox.ini ./

RUN pip install tox
# Install the relevant dependencies. Keep printing so Travis knows we're alive.
RUN ["bash", "-c", "( while true; do echo '.'; sleep 60; done ) & tox --notest"]

# Finally, clean cached code (including dot files) and upload our actual code!
RUN mv .tox /tmp/.tox && rm -rf .??* * && mv /tmp/.tox .tox
# Install keyboard-configuration separately to avoid travis hanging waiting for keyboard selection
RUN \
apt-get -y update && \
apt-get install -y keyboard-configuration && \

# Maybe Install python3.6 on ubuntu 16.04 ?
# apt-get install -y software-properties-common && \
# add-apt-repository -y ppa:jonathonf/python-3.6 && \
# apt-get -y update && \
# apt-get -y install python3.6 python3.6-distutils python3.6-dev

apt-get install -y \
python-setuptools \
python-pip \
libpq-dev \
zlib1g-dev \
libjpeg-dev \
curl \
cmake \
swig \
python-opengl \
python-numpy \
python-pyglet \
python3-opengl \
libboost-all-dev \
libsdl2-dev \
libosmesa6-dev \
patchelf \
wget \
unzip \
git \
vim \
xvfb \
ffmpeg \
python3-dev && \

apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
pip install tox && \

# Download mujoco
mkdir /root/.mujoco && \
cd /root/.mujoco && \
wget https://www.roboti.us/download/mjpro150_linux.zip && \
unzip mjpro150_linux.zip && \

# setup vim to be humane and compatible with codebase standards
echo "set expandtab number shiftwidth=4 tabstop=4" > /root/.vimrc

ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/root/.mujoco/mjpro150/bin

# install dependencies
COPY . /usr/local/gym/
RUN cd /usr/local/gym && \
tox --notest

WORKDIR /usr/local/gym/
ENTRYPOINT ["/usr/local/gym/bin/docker_entrypoint"]
CMD ["tox"]
6 changes: 3 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
# and then run "tox" from this directory.

[tox]
envlist = py27, py34
envlist = py35

[testenv:py34]
[testenv:py35]
whitelist_externals=make
passenv=DISPLAY TRAVIS*
deps =
Expand All @@ -18,7 +18,7 @@ deps =
pachi-py>=0.0.19
box2d-py
doom_py>=0.0.11
mujoco_py<1.0.0,>=0.4.3
mujoco_py>=1.50.1,<1.50.2
keras
theano
numpy>=1.10.4
Expand Down

0 comments on commit 74229c8

Please sign in to comment.