Skip to content

Commit 6ef1e81

Browse files
author
y-p
committed
Merge pull request #6218 from y-p/ironcache
BLD: Cut Travis-CI build times by 30-50%
2 parents a134eb6 + 213593c commit 6ef1e81

File tree

6 files changed

+137
-12
lines changed

6 files changed

+137
-12
lines changed

.travis.yml

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
language: python
22

3-
python:
4-
- 2.6
3+
env:
4+
global:
5+
# scatterci API key
6+
- secure: "Bx5umgo6WjuGY+5XFa004xjCiX/vq0CyMZ/ETzcs7EIBI1BE/0fIDXOoWhoxbY9HPfdPGlDnDgB9nGqr5wArO2s+BavyKBWg6osZ3dmkfuJPMOWeyCa92EeP+sfKw8e5HSU5MizW9e319wHWOF/xkzdHR7T67Qd5erhv91x4DnQ="
7+
# ironcache API key
8+
- secure: "TWGKPL4FGtWjCQ427QrSffaQBSCPy1QzPdhtYKAW9AlDo/agdp9RyZRQr8WTlyZ5AOG18X8MDdi0EcpFnyfDNd4thCLyZOntxwltlVV2yNNvnird3XRKUV1F2DD42L64wna04M2KYxpCKhEQ84gEnCH1DGD4g1NnR6fYuEYNSTU="
9+
- secure: "NvgIWe14pv4SJ5BQhw6J0zIpCTFH4fVpzr9pRzM2tD8yf/3cspX3uyXTt4owiqtjoQ3aQGNnhWtVlmSwlgJrwu7KUaE9IPtlsENYDniAj2oJgejjx02d367pHtMB/9e3+4b2fWUsFNJgWw0ordiIT0p1lzHRdQ9ut4l/Yn/lkJs="
10+
- secure: "D3ASNRu32pV79lv/Nl0dBm2ldZiTgbb6boOrN0SzIKsQU3yBwedpqX6EI6KjpVg17lGhhhFXGzL2Gz1qjU3/+m6aMvekxHgpfuc0AlEFCEqenWPxIdDDrUkdfJoCvfQQPd5oxChfHgqaEDLjuqHy1ZEgnJ2/L/6dwZ4fUt62hMk="
511

612
matrix:
713
include:
@@ -10,39 +16,33 @@ matrix:
1016
- NOSE_ARGS="not slow and not network"
1117
- CLIPBOARD=xclip
1218
- LOCALE_OVERRIDE="it_IT.UTF-8"
13-
- secure: "Bx5umgo6WjuGY+5XFa004xjCiX/vq0CyMZ/ETzcs7EIBI1BE/0fIDXOoWhoxbY9HPfdPGlDnDgB9nGqr5wArO2s+BavyKBWg6osZ3dmkfuJPMOWeyCa92EeP+sfKw8e5HSU5MizW9e319wHWOF/xkzdHR7T67Qd5erhv91x4DnQ="
1419
- JOB_NAME: "26_nslow_nnet" # ScatterCI Build name, 20 chars max
1520
- python: 2.7
1621
env:
1722
- NOSE_ARGS="slow and not network"
1823
- LOCALE_OVERRIDE="zh_CN.GB18030"
1924
- FULL_DEPS=true
2025
- JOB_TAG=_LOCALE
21-
- secure: "Bx5umgo6WjuGY+5XFa004xjCiX/vq0CyMZ/ETzcs7EIBI1BE/0fIDXOoWhoxbY9HPfdPGlDnDgB9nGqr5wArO2s+BavyKBWg6osZ3dmkfuJPMOWeyCa92EeP+sfKw8e5HSU5MizW9e319wHWOF/xkzdHR7T67Qd5erhv91x4DnQ="
2226
- JOB_NAME: "27_slow_nnet_LOCALE" # ScatterCI Build name, 20 chars max
2327
- python: 2.7
2428
env:
2529
- NOSE_ARGS="not slow"
2630
- FULL_DEPS=true
2731
- CLIPBOARD_GUI=gtk2
28-
- secure: "Bx5umgo6WjuGY+5XFa004xjCiX/vq0CyMZ/ETzcs7EIBI1BE/0fIDXOoWhoxbY9HPfdPGlDnDgB9nGqr5wArO2s+BavyKBWg6osZ3dmkfuJPMOWeyCa92EeP+sfKw8e5HSU5MizW9e319wHWOF/xkzdHR7T67Qd5erhv91x4DnQ="
2932
- JOB_NAME: "27_nslow" # ScatterCI Build name, 20 chars max
3033
- python: 3.2
3134
env:
3235
- NOSE_ARGS="not slow"
3336
- FULL_DEPS=true
3437
- CLIPBOARD_GUI=qt4
35-
- secure: "Bx5umgo6WjuGY+5XFa004xjCiX/vq0CyMZ/ETzcs7EIBI1BE/0fIDXOoWhoxbY9HPfdPGlDnDgB9nGqr5wArO2s+BavyKBWg6osZ3dmkfuJPMOWeyCa92EeP+sfKw8e5HSU5MizW9e319wHWOF/xkzdHR7T67Qd5erhv91x4DnQ="
3638
- JOB_NAME: "32_nslow" # ScatterCI Build name, 20 chars max
3739
- python: 3.3
3840
env:
3941
- NOSE_ARGS="not slow"
4042
- FULL_DEPS=true
4143
- CLIPBOARD=xsel
42-
- secure: "Bx5umgo6WjuGY+5XFa004xjCiX/vq0CyMZ/ETzcs7EIBI1BE/0fIDXOoWhoxbY9HPfdPGlDnDgB9nGqr5wArO2s+BavyKBWg6osZ3dmkfuJPMOWeyCa92EeP+sfKw8e5HSU5MizW9e319wHWOF/xkzdHR7T67Qd5erhv91x4DnQ="
4344
- JOB_NAME: "33_nslow" # ScatterCI Build name, 20 chars max
44-
exclude:
45-
- python: 2.6
45+
4646

4747
# allow importing from site-packages,
4848
# so apt-get python-x works for system pythons
@@ -55,25 +55,28 @@ before_install:
5555
- echo $VIRTUAL_ENV
5656
- df -h
5757
- date
58+
- pwd
5859
- uname -a
59-
- ci/before_install.sh
6060
- python -V
61+
- ci/before_install.sh
6162
# Xvfb stuff for clipboard functionality; see the travis-ci documentation
6263
- export DISPLAY=:99.0
6364
- sh -e /etc/init.d/xvfb start
6465

6566
install:
6667
- echo "install"
68+
- ci/prep_ccache.sh
6769
- ci/install.sh
6870

6971
before_script:
7072
- mysql -e 'create database pandas_nosetest;'
7173

7274
script:
7375
- echo "script"
74-
- ci/script.sh
76+
# - ci/script.sh
7577

7678
after_script:
7779
- ci/print_versions.py
7880
- ci/print_skipped.py /tmp/nosetests.xml
79-
- ci/after_script.sh
81+
- ci/after_script.sh
82+
- ci/submit_ccache.sh

ci/install.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,12 @@ fi
9393
# build and install pandas
9494
time python setup.py sdist
9595
pip uninstall cython -y
96+
97+
cat pandas/version.py
98+
99+
export PATH=/usr/lib/ccache:/usr/lib64/ccache:$PATH
100+
which gcc
101+
ccache -z # reset stats
96102
time pip install $(find dist | grep gz | head -n 1)
97103

98104
true

ci/ironcache/get.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
4+
import sys
5+
import re
6+
import os
7+
import time
8+
import json
9+
import base64
10+
11+
from iron_cache import *
12+
13+
key='KEY'+os.environ.get('JOB_NAME','')+"."
14+
15+
b = b''
16+
cache = IronCache()
17+
for i in range(20):
18+
print("getting %s" % key+str(i))
19+
try:
20+
item = cache.get(cache="travis", key=key+str(i))
21+
b += bytes(base64.b64decode(item.value))
22+
except:
23+
break
24+
25+
with open(os.path.join(os.environ.get('HOME',''),"ccache.7z"),'wb') as f:
26+
f.write(b)

ci/ironcache/put.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
4+
import sys
5+
import re
6+
import os
7+
import time
8+
import json
9+
import base64
10+
11+
from iron_cache import *
12+
13+
key='KEY'+os.environ.get('JOB_NAME','')+"."
14+
os.chdir(os.environ.get('HOME'))
15+
16+
cache = IronCache()
17+
18+
i=0
19+
20+
for i, fname in enumerate(sorted([x for x in os.listdir('.') if re.match("ccache.\d+$",x)])):
21+
print("Putting %s" % key+str(i))
22+
with open(fname,"rb") as f:
23+
s= f.read()
24+
value=base64.b64encode(s)
25+
if isinstance(value, bytes):
26+
value = value.decode('ascii')
27+
item = cache.put(cache="travis", key=key+str(i), value=value,options=dict(expires_in=24*60*60))
28+
29+
# print("foo")
30+
for i in range(i+1,20):
31+
32+
try:
33+
item = cache.delete(key+str(i),cache='travis')
34+
print("Deleted %s" % key+str(i))
35+
except:
36+
break
37+
pass

ci/prep_ccache.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
3+
if [ "$IRON_TOKEN" ]; then
4+
sudo apt-get $APT_ARGS install ccache p7zip-full
5+
# iron_cache, pending py3 fixes upstream
6+
pip install -I --allow-external --allow-insecure git+https://github.com/y-p/iron_cache_python.git
7+
8+
9+
python ci/ironcache/get.py
10+
ccache -C
11+
if [ -f ~/ccache.7z ]; then
12+
echo "Cache retrieved"
13+
cd $HOME
14+
7za e $HOME/ccache.7z
15+
# ls -l $HOME
16+
cd /
17+
tar xvf $HOME/ccache
18+
rm -rf $HOME/ccache.7z
19+
rm -rf $HOME/ccache
20+
21+
fi
22+
fi
23+
24+
exit 0

ci/submit_ccache.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash
2+
3+
ccache -s
4+
5+
if [ "$IRON_TOKEN" ]; then
6+
rm -rf ~/ccache.7z
7+
8+
tar cf - $HOME/.ccache \
9+
| 7za a -si ~/ccache.7z
10+
11+
# Caching the cython files could be be made to work.
12+
# There's a timestamp issue to be handled (http://stackoverflow.com/questions/1964470)
13+
# but you could get the build to reuse them.
14+
# However, there's a race condition between travis cythonizing
15+
# and a new commit being made on a GH server somewhere.
16+
# and there's convenient causal link between the two we can
17+
# take advantage of.
18+
# Let's just wait another 60 seconds.
19+
# "$TRAVIS_BUILD_DIR"/pandas/{index,algos,lib,tslib,parser,hashtable}.c \
20+
# "$TRAVIS_BUILD_DIR"/pandas/src/{sparse,testing}.c \
21+
# "$TRAVIS_BUILD_DIR"/pandas/msgpack.cpp \
22+
# | 7za a -si ~/ccache.7z
23+
24+
split -b 500000 -d ~/ccache.7z ~/ccache.
25+
26+
python ci/ironcache/put.py
27+
fi;
28+
29+
exit 0

0 commit comments

Comments
 (0)