Skip to content

Commit 192256e

Browse files
committed
fix: granular freesurfer cache
1 parent 2b45086 commit 192256e

File tree

2 files changed

+37
-25
lines changed

2 files changed

+37
-25
lines changed

.circleci/config.yml

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,10 @@ jobs:
5555
- run:
5656
name: Setup git-annex
5757
command: |
58-
mkdir -p /tmp/cache
59-
if [[ ! -e "/tmp/cache/git-annex-standalone.tar.gz" ]]; then
58+
if [[ ! -d /usr/lib/git-annex.linux ]]; then
6059
wget -O- http://neuro.debian.net/lists/trusty.us-ca.full | sudo tee /etc/apt/sources.list.d/neurodebian.sources.list
6160
apt-key adv --recv-keys --keyserver hkp://pool.sks-keyservers.net:80 0xA5D32F012649A5A9
6261
apt update && sudo apt-get install -y --no-install-recommends git-annex-standalone
63-
mkdir -p /tmp/cache
64-
tar czvf /tmp/cache/git-annex-standalone.tar.gz /usr/bin/git-annex /usr/bin/git-annex-shell /usr/lib/git-annex.linux
65-
else
66-
tar xzfv /tmp/cache/git-annex-standalone.tar.gz -C /
6762
fi
6863
git config --global user.name 'CRN'
6964
git config --global user.email '[email protected]'
@@ -77,6 +72,16 @@ jobs:
7772
python -c "from templateflow import api as tfapi; \
7873
tfapi.get('MNI152NLin2009cAsym', resolution=2, desc='brain', suffix='mask'); \
7974
tfapi.get('MNI152NLin2009cAsym', resolution=2, desc='fMRIPrep', suffix='boldref');"
75+
76+
- save_cache:
77+
key: env-v1-{{ .Branch }}-{{ .BuildNum }}
78+
paths:
79+
- /tmp/cache/git-annex-standalone.tar.gz
80+
- /usr/local/lib/python3.7/site-packages
81+
- /usr/bin/git-annex
82+
- /usr/bin/git-annex-shell
83+
- /usr/lib/git-annex.linux
84+
8085
- run:
8186
name: Install ds001600
8287
command: |
@@ -91,7 +96,17 @@ jobs:
9196
-O testdata.zip "https://files.osf.io/v1/resources/9sy2a/providers/osfstorage/5d44b940bcd6d900198ed6be/?zip="
9297
unzip testdata.zip -d /tmp/data/testdata
9398
fi
99+
- save_cache:
100+
key: data-v2-{{ .Branch }}-{{ .BuildNum }}
101+
paths:
102+
- /tmp/data
103+
- /tmp/templateflow
94104

105+
- restore_cache:
106+
keys:
107+
- freesurfer-v1-{{ .Branch }}-
108+
- freesurfer-v1-master-
109+
- freesurfer-v1-
95110
- run:
96111
name: Pull FreeSurfer down
97112
command: |
@@ -115,23 +130,12 @@ jobs:
115130
--exclude='freesurfer/subjects/sample-*.mgz' \
116131
--exclude='freesurfer/subjects/V1_average' \
117132
--exclude='freesurfer/trctrain'
133+
echo "b2VzdGViYW5Ac3RhbmZvcmQuZWR1CjMwNzU2CiAqQ1MzYkJ5VXMxdTVNCiBGU2kvUGJsejJxR1V3Cg==" | base64 -d > /tmp/freesurfer/license.txt
118134
fi
119-
- run:
120-
name: Store FreeSurfer license file
121-
command: |
122-
echo "b2VzdGViYW5Ac3RhbmZvcmQuZWR1CjMwNzU2CiAqQ1MzYkJ5VXMxdTVNCiBGU2kvUGJsejJxR1V3Cg==" | base64 -d > /tmp/freesurfer/license.txt
123-
124135
- save_cache:
125-
key: env-v1-{{ .Branch }}-{{ .BuildNum }}
136+
key: freesurfer-v1-{{ .Branch }}-{{ .BuildNum }}
126137
paths:
127-
- /tmp/cache/git-annex-standalone.tar.gz
128-
129-
- save_cache:
130-
key: data-v2-{{ .Branch }}-{{ .BuildNum }}
131-
paths:
132-
- /tmp/data
133138
- /tmp/freesurfer
134-
- /tmp/templateflow
135139

136140
build_n_pytest:
137141
machine:
@@ -217,6 +221,11 @@ jobs:
217221
paths:
218222
- /tmp/docker
219223

224+
- restore_cache:
225+
keys:
226+
- freesurfer-v1-{{ .Branch }}-
227+
- freesurfer-v1-master-
228+
- freesurfer-v1-
220229
- restore_cache:
221230
keys:
222231
- data-v2-{{ .Branch }}-

Dockerfile

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@ FROM ubuntu:xenial-20191010
44
# Pre-cache neurodebian key
55
COPY .docker/files/neurodebian.gpg /usr/local/etc/neurodebian.gpg
66

7-
# Installing Neurodebian packages (FSL, AFNI, git)
8-
RUN curl -sSL "http://neuro.debian.net/lists/$( lsb_release -c | cut -f2 ).us-ca.full" >> /etc/apt/sources.list.d/neurodebian.sources.list && \
9-
apt-key add /usr/local/etc/neurodebian.gpg && \
10-
(apt-key adv --refresh-keys --keyserver hkp://ha.pool.sks-keyservers.net 0xA5D32F012649A5A9 || true)
11-
127
# Prepare environment
138
RUN apt-get update && \
149
apt-get install -y --no-install-recommends \
@@ -21,7 +16,15 @@ RUN apt-get update && \
2116
autoconf \
2217
libtool \
2318
pkg-config \
24-
git \
19+
git && \
20+
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
21+
22+
# Installing Neurodebian packages (FSL, AFNI, git)
23+
RUN curl -sSL "http://neuro.debian.net/lists/$( lsb_release -c | cut -f2 ).us-ca.full" >> /etc/apt/sources.list.d/neurodebian.sources.list && \
24+
apt-key add /usr/local/etc/neurodebian.gpg && \
25+
(apt-key adv --refresh-keys --keyserver hkp://ha.pool.sks-keyservers.net 0xA5D32F012649A5A9 || true) && \
26+
apt-get update && \
27+
apt-get install -y --no-install-recommends \
2528
fsl-core=5.0.9-5~nd16.04+1 \
2629
afni=16.2.07~dfsg.1-5~nd16.04+1 \
2730
convert3d \

0 commit comments

Comments
 (0)