Skip to content

Commit 059e314

Browse files
committed
maint(ci): mechanism to run eddy only w/tag in commit message
1 parent f1b758d commit 059e314

File tree

3 files changed

+46
-37
lines changed

3 files changed

+46
-37
lines changed

.circleci/config.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,10 @@ jobs:
300300
name: Run full diffusion workflow on ds000206
301301
no_output_timeout: 4h
302302
command: |
303+
eddy="--ignore eddy"
304+
if [[ "$( git log --format=oneline -n 1 $CIRCLE_SHA1 | grep -i -E '\[run[ _]?eddy\]' )" != "" ]]; then
305+
eddy=""
306+
fi
303307
mkdir -p /tmp/ds000206/work /tmp/ds000206/derivatives
304308
docker run -e FS_LICENSE=$FS_LICENSE --rm \
305309
-v /tmp/data/ds000206:/data \
@@ -309,7 +313,7 @@ jobs:
309313
-v /tmp/templateflow:/home/dmriprep/.cache/templateflow \
310314
-v /tmp/ds000206/work:/work \
311315
--user $(id -u):$(id -g) \
312-
nipreps/dmriprep:latest /data /out participant -vv \
316+
nipreps/dmriprep:latest /data /out participant -vv $eddy \
313317
--fs-subjects-dir /data/derivatives/freesurfer-6.0.1 --sloppy \
314318
--notrack --skip-bids-validation -w /work --omp-nthreads 2 --nprocs 2
315319
- store_artifacts:
@@ -381,6 +385,10 @@ jobs:
381385
name: Run full diffusion workflow on ds001771
382386
no_output_timeout: 4h
383387
command: |
388+
eddy="--ignore eddy"
389+
if [[ "$( git log --format=oneline -n 1 $CIRCLE_SHA1 | grep -i -E '\[run[ _]?eddy\]' )" != "" ]]; then
390+
eddy=""
391+
fi
384392
mkdir -p /tmp/ds001771/work /tmp/ds001771/derivatives
385393
docker run -e FS_LICENSE=$FS_LICENSE --rm \
386394
-v /tmp/data/ds001771:/data \
@@ -390,7 +398,7 @@ jobs:
390398
-v /tmp/config/nipype.cfg:/home/dmriprep/.nipype/nipype.cfg \
391399
-v /tmp/ds001771/work:/work \
392400
--user $(id -u):$(id -g) \
393-
nipreps/dmriprep:latest /data /out participant -vv \
401+
nipreps/dmriprep:latest /data /out participant -vv $eddy \
394402
-w /work --omp-nthreads 2 --nprocs 2 \
395403
--notrack --skip-bids-validation --sloppy \
396404
--fs-subjects-dir /data/derivatives/freesurfer-6.0.1 \

dmriprep/cli/parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ def _bids_filter(value):
191191
action="store",
192192
nargs="+",
193193
default=[],
194-
choices=["fieldmaps", "sbref"],
194+
choices=["fieldmaps", "sbref", "eddy"],
195195
help="ignore selected aspects of the input dataset to disable corresponding "
196196
"parts of the workflow (a space delimited list)",
197197
)

dmriprep/workflows/dwi/base.py

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -203,42 +203,43 @@ def _bold_reg_suffix(fallback):
203203
])
204204
# fmt: on
205205

206-
# Eddy distortion correction
207-
eddy_wf = init_eddy_wf(debug=config.execution.debug)
208-
eddy_wf.inputs.inputnode.metadata = layout.get_metadata(str(dwi_file))
209-
210-
ds_report_eddy = pe.Node(
211-
DerivativesDataSink(
212-
base_directory=str(config.execution.output_dir),
213-
desc="eddy",
214-
datatype="figures",
215-
),
216-
name="ds_report_eddy",
217-
run_without_submitting=True,
218-
)
206+
if "eddy" not in config.workflow.ignore:
207+
# Eddy distortion correction
208+
eddy_wf = init_eddy_wf(debug=config.execution.debug)
209+
eddy_wf.inputs.inputnode.metadata = layout.get_metadata(str(dwi_file))
219210

220-
eddy_report = pe.Node(
221-
SimpleBeforeAfter(before_label="Distorted", after_label="Eddy Corrected",),
222-
name="eddy_report",
223-
mem_gb=0.1,
224-
)
211+
ds_report_eddy = pe.Node(
212+
DerivativesDataSink(
213+
base_directory=str(config.execution.output_dir),
214+
desc="eddy",
215+
datatype="figures",
216+
),
217+
name="ds_report_eddy",
218+
run_without_submitting=True,
219+
)
225220

226-
# fmt:off
227-
workflow.connect([
228-
(dwi_reference_wf, eddy_wf, [
229-
("outputnode.dwi_file", "inputnode.dwi_file"),
230-
("outputnode.dwi_mask", "inputnode.dwi_mask"),
231-
]),
232-
(inputnode, eddy_wf, [
233-
("in_bvec", "inputnode.in_bvec"),
234-
("in_bval", "inputnode.in_bval")
235-
]),
236-
(dwi_reference_wf, eddy_report, [("outputnode.ref_image", "before")]),
237-
(eddy_wf, eddy_report, [('outputnode.eddy_ref_image', 'after')]),
238-
(dwi_reference_wf, ds_report_eddy, [("outputnode.dwi_file", "source_file")]),
239-
(eddy_report, ds_report_eddy, [("out_report", "in_file")]),
240-
])
241-
# fmt:on
221+
eddy_report = pe.Node(
222+
SimpleBeforeAfter(before_label="Distorted", after_label="Eddy Corrected",),
223+
name="eddy_report",
224+
mem_gb=0.1,
225+
)
226+
227+
# fmt:off
228+
workflow.connect([
229+
(dwi_reference_wf, eddy_wf, [
230+
("outputnode.dwi_file", "inputnode.dwi_file"),
231+
("outputnode.dwi_mask", "inputnode.dwi_mask"),
232+
]),
233+
(inputnode, eddy_wf, [
234+
("in_bvec", "inputnode.in_bvec"),
235+
("in_bval", "inputnode.in_bval")
236+
]),
237+
(dwi_reference_wf, eddy_report, [("outputnode.ref_image", "before")]),
238+
(eddy_wf, eddy_report, [('outputnode.eddy_ref_image', 'after')]),
239+
(dwi_reference_wf, ds_report_eddy, [("outputnode.dwi_file", "source_file")]),
240+
(eddy_report, ds_report_eddy, [("out_report", "in_file")]),
241+
])
242+
# fmt:on
242243

243244
# REPORTING ############################################################
244245
reportlets_wf = init_reportlets_wf(

0 commit comments

Comments
 (0)