Skip to content

Commit

Permalink
Fix caching by using TRAVIS_CACHE and moving it from .cache to .travi…
Browse files Browse the repository at this point in the history
…s_cache
  • Loading branch information
bolkedebruin committed Oct 30, 2015
1 parent 9f19a21 commit 2856b3a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ python:
- "3.4"
env:
global:
- CACHE=$HOME/.cache/
- TRAVIS_CACHE=$HOME/.travis_cache/
matrix:
- TOX_ENV=py27-cdh
- TOX_ENV=py27-hdp
Expand All @@ -28,12 +28,12 @@ matrix:
cache:
directories:
- $HOME/.wheelhouse/
- $HOME/.cache/
- $HOME/.travis_cache/
install:
- pip install --upgrade pip
- pip install tox
before_script:
- mysql -e 'create database airflow'
- mysql -e 'drop database if exists airflow; create database airflow' -u root
- psql -c 'create database airflow;' -U postgres
script:
- pip --version
Expand Down
4 changes: 4 additions & 0 deletions airflow/www/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from flask import Flask
from flask.ext.admin import Admin, base
from flask.ext.cache import Cache

from airflow import login
from airflow import models
Expand All @@ -19,6 +20,9 @@ def create_app(config=None):
#app.config = config
login.login_manager.init_app(app)

cache = Cache(
app=app, config={'CACHE_TYPE': 'filesystem', 'CACHE_DIR': '/tmp'})

app.register_blueprint(ck, url_prefix='/ck')
app.register_blueprint(routes)
app.jinja_env.add_extension("chartkick.ext.charts")
Expand Down
8 changes: 4 additions & 4 deletions scripts/ci/setup_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ if $ONLY_DOWNLOAD && $ONLY_EXTRACT; then
fi

mkdir -p ${HADOOP_HOME}
mkdir -p ${CACHE}/${HADOOP_DISTRO}
mkdir -p ${TRAVIS_CACHE}/${HADOOP_DISTRO}

if [ $HADOOP_DISTRO = "cdh" ]; then
URL="http://archive.cloudera.com/cdh5/cdh/5/hadoop-latest.tar.gz"
Expand All @@ -63,8 +63,8 @@ else
fi

if ! $ONLY_EXTRACT; then
echo "Downloading Hadoop from $URL to ${CACHE}/${HADOOP_DISTRO}/hadoop.tar.gz"
curl -z ${CACHE}/${HADOOP_DISTRO}/hadoop.tar.gz -o ${CACHE}/${HADOOP_DISTRO}/hadoop.tar.gz -L $URL
echo "Downloading Hadoop from $URL to ${TRAVIS_CACHE}/${HADOOP_DISTRO}/hadoop.tar.gz"
curl -z ${TRAVIS_CACHE}/${HADOOP_DISTRO}/hadoop.tar.gz -o ${TRAVIS_CACHE}/${HADOOP_DISTRO}/hadoop.tar.gz -L $URL

if [ $? != 0 ]; then
echo "Failed to download Hadoop from $URL - abort" >&2
Expand All @@ -77,7 +77,7 @@ if $ONLY_DOWNLOAD; then
fi

echo "Extracting ${HADOOP_HOME}/hadoop.tar.gz into $HADOOP_HOME"
tar zxf ${CACHE}/${HADOOP_DISTRO}/hadoop.tar.gz --strip-components 1 -C $HADOOP_HOME
tar zxf ${TRAVIS_CACHE}/${HADOOP_DISTRO}/hadoop.tar.gz --strip-components 1 -C $HADOOP_HOME

if [ $? != 0 ]; then
echo "Failed to extract Hadoop from ${HADOOP_HOME}/hadoop.tar.gz to ${HADOOP_HOME} - abort" >&2
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ passenv =
TRAVIS_BUILD_DIR
TRAVIS_JOB_ID
USER
CACHE
TRAVIS_CACHE
commands =
pip wheel -w {homedir}/.wheelhouse -f {homedir}/.wheelhouse -r requirements.txt
pip install --find-links={homedir}/.wheelhouse --no-index -rrequirements.txt
Expand Down

0 comments on commit 2856b3a

Please sign in to comment.