Skip to content

Commit 065a2c4

Browse files
committed
fix(ci): update cached worked directory for pepolar [refresh cache]
1 parent 636174a commit 065a2c4

File tree

6 files changed

+34
-25
lines changed

6 files changed

+34
-25
lines changed

.circleci/config.yml

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,9 @@ jobs:
128128
steps:
129129
- restore_cache:
130130
keys:
131-
- data-v1-{{ .Branch }}-
132-
- data-v1-master-
133-
- data-v1-
131+
- data-v2-{{ .Branch }}-
132+
- data-v2-master-
133+
- data-v2-
134134
- run:
135135
name: Setup git-annex
136136
command: |
@@ -169,30 +169,14 @@ jobs:
169169
unzip testdata.zip -d /tmp/data/testdata
170170
fi
171171
172-
- run:
173-
name: Get clean copy of workdir
174-
command: |
175-
if [[ ! -f /tmp/data/workdir.tar.gz ]]; then
176-
wget --retry-connrefused --waitretry=5 --read-timeout=20 --timeout=15 -t 0 -q \
177-
-O workdir.tar.gz "https://files.osf.io/v1/resources/9sy2a/providers/osfstorage/5dcabd60a1cd9e000c751b3c"
178-
fi
179-
180172
- run:
181173
name: Store FreeSurfer license file
182174
command: |
183175
mkdir -p /tmp/data/
184176
echo "b2VzdGViYW5Ac3RhbmZvcmQuZWR1CjMwNzU2CiAqQ1MzYkJ5VXMxdTVNCiBGU2kvUGJsejJxR1V3Cg==" | base64 -d > /tmp/data/fslicense.txt
185177
186-
- run:
187-
name: Create Nipype config files
188-
command: |
189-
printf "[execution]\nstop_on_first_crash = true\n" > /tmp/data/nipype.cfg
190-
echo "poll_sleep_duration = 0.01" >> /tmp/data/nipype.cfg
191-
echo "hash_method = content" >> /tmp/data/nipype.cfg
192-
echo "crashfile_format = txt" >> /tmp/data/nipype.cfg
193-
194178
- save_cache:
195-
key: data-v1-{{ .Branch }}-{{ .BuildNum }}
179+
key: data-v2-{{ .Branch }}-{{ .BuildNum }}
196180
paths:
197181
- "/opt/circleci/.pyenv/versions/3.5.2"
198182
- /tmp/data
@@ -229,15 +213,18 @@ jobs:
229213
cd /tmp/src/sdcflows
230214
COMMIT_MSG=$( git log --format=oneline -n 1 $CIRCLE_SHA1 )
231215
set +e
232-
do_refresh="$( echo "${COMMIT_MSG}" | grep -i -E '\[fresh[ _]?workdir\]' )"
216+
do_refresh="$( echo "${COMMIT_MSG}" | grep -i -E '\[refresh[ _]?cache\]' )"
233217
set -e
234218
if [[ "x${do_refresh}" = "x" ]]; then
235219
echo "Did not refresh the workdir."
236220
else
221+
wget --retry-connrefused --waitretry=5 --read-timeout=20 --timeout=15 -t 0 -q \
222+
-O /tmp/data/workdir.tar.gz "https://files.osf.io/v1/resources/9sy2a/providers/osfstorage/5dcabd60a1cd9e000c751b3c"
237223
rm -rf /tmp/work
238224
mkdir -p /tmp/work
239-
cd /tmp/work
240-
tar xzfv /tmp/data/workdir.tar.gz
225+
pushd /tmp/work
226+
tar xzfv /tmp/data/workdir.tar.gz --strip 1
227+
popd
241228
fi
242229
243230
wipe_dir=$( echo "${COMMIT_MSG}" | sed -n 's/.*\[wipe \([a-zA-Z0-9_\*]*\)\].*/\1/p' )
@@ -264,7 +251,6 @@ jobs:
264251
docker run -it --rm -e TEST_DATA_HOME=/data/ -e TEST_OUTPUT_DIR=/out \
265252
-v /tmp/data/fslicense.txt:/opt/freesurfer/license.txt:ro -e FS_LICENSE=/opt/freesurfer/license.txt \
266253
-v /tmp/work:/work -e TEST_WORK_DIR=/work \
267-
-v /tmp/data/nipype.cfg:/home/sdcflows/.nipype/nipype.cfg \
268254
-v /tmp/data:/data:ro -v /tmp/src:/src -v /tmp/tests:/out \
269255
-w /work poldracklab/sdcflows:latest \
270256
pytest -v --junit-xml=/out/pytest.xml /src/sdcflows/sdcflows

.docker/files/nipype.cfg

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[execution]
2+
poll_sleep_duration = 0.01
3+
remove_unnecessary_outputs = true
4+
crashfile_format = txt
5+
profile_runtime = false
6+
use_relative_paths = false

Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,18 @@ RUN useradd -m -s /bin/bash -G users sdcflows
135135
WORKDIR /home/sdcflows
136136
ENV HOME="/home/sdcflows"
137137

138+
# Precaching atlases
139+
COPY setup.cfg setup.cfg
140+
RUN pip install --no-cache-dir "$( grep templateflow setup.cfg | xargs )" && \
141+
python -c "from templateflow import api as tfapi; \
142+
tfapi.get('MNI152NLin2009cAsym', resolution=2, desc='brain', suffix='mask'); \
143+
tfapi.get('MNI152NLin2009cAsym', resolution=2, desc='fMRIPrep', suffix='boldref');" && \
144+
rm setup.cfg && \
145+
find $HOME/.cache/templateflow -type d -exec chmod go=u {} + && \
146+
find $HOME/.cache/templateflow -type f -exec chmod go=u {} +
147+
148+
COPY .docker/files/nipype.cfg $HOME/.nipype/nipype.cfg
149+
138150
# Installing dev requirements (packages that are not in pypi)
139151
WORKDIR /src/sdcflows
140152

sdcflows/workflows/tests/test_pepolar.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ def test_pepolar_wf1(bids_layouts, output_path, dataset, workdir):
158158
wf.inputs.inputnode.in_reference = boldref.path
159159

160160
rep = pe.Node(FieldmapReportlet(), 'simple_report')
161+
rep.interface._always_run = True
161162
dsink = pe.Node(DerivativesDataSink(
162163
base_directory=str(output_path), keep_dtype=True,
163164
desc='pepolar'), name='dsink')

sdcflows/workflows/tests/test_phdiff.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ def test_workflow(bids_layouts, tmpdir, output_path, dataset, workdir):
3232
if output_path:
3333
from ...interfaces.reportlets import FieldmapReportlet
3434
rep = pe.Node(FieldmapReportlet(), 'simple_report')
35+
rep.interface._always_run = True
3536

3637
dsink = pe.Node(DerivativesDataSink(
3738
base_directory=str(output_path), keep_dtype=True), name='dsink')

setup.cfg

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,12 @@ putty-ignore =
9494

9595
[tool:pytest]
9696
norecursedirs = .git
97-
addopts = -svx --doctest-modules
97+
addopts = -vsx --doctest-modules
9898
doctest_optionflags = ALLOW_UNICODE NORMALIZE_WHITESPACE
9999
env =
100100
PYTHONHASHSEED=0
101101
filterwarnings =
102102
ignore::DeprecationWarning
103+
ignore::PendingDeprecationWarning
104+
ignore:cmp not installed:UserWarning
105+
ignore:This has not been fully tested:UserWarning

0 commit comments

Comments
 (0)