FMRIPREP doesn't use the working directory?

docker run --rm \
    -v /Volumes/Passport/bids/Nifti:/data:ro \
    -v /Volumes/Passport/bids/dockerout:/out \
    -v /Volumes/Passport/bids/license.txt:/opt/freesurfer/license.txt \
    -v /Volumes/Passport/bids/scratch:/scratch \
    -w /Volumes/Passport/bids/scratch \
    poldracklab/fmriprep:latest \
    /data /out/out \
    participant \
    -w /out/work/

There is a working directory with files in /out/work. My script crashed midway through because my external hard drive came unplugged. So I’m trying to resume the processing, but it looks on my terminal that everything is restarting from the very beginning? Is there something I need to do to let fmriprep know to resume, using the specified work directory?

What does /Volumes/Passport/bids/dockerout/work look like? It should have a fmriprep_wf directory in it, and if so, fMRIPrep will go through the workflow nodes, one by one, and check to see if any of its inputs changed since last run. If they haven’t, it will reuse the outputs of those nodes instead of re-running.

Do you have an excerpt of the logs for a portion you thought should be re-run? It might be that you’re just seeing the reporting on checking the cache.

1 Like

Thanks for the quick reply, you may be right that I am misinterpreting the output? Here is what my /dockerout/work folder looks like:

Some of the terminal output that made me think it was redoing steps:


Also, I am thinking I may have my commands wrong because my /scratch folder has always been empty throughout this entire process – do you know if I need either of these commands from the docker run I pasted in my first post?

-v /Volumes/Passport/bids/scratch:/scratch \
-w /Volumes/Passport/bids/scratch \

So the output that you’re seeing there is output produced during construction of the workflow, before it’s even run. At runtime, it will check for whether portions of it are already complete.

You can drop your lines regarding /scratch, as they will have no effect on any outputs, as your command is written. (They will mount /Volumes/Passport/bids/scratch into /scratch in the container, and set that as your current working directory, but no output is put into the CWD.)

If you want your scratch directory (currently /out/work) to be in /Volumes/Passport/bids/scratch, you can use the following command:

docker run --rm \
    -v /Volumes/Passport/bids/Nifti:/data:ro \
    -v /Volumes/Passport/bids/dockerout:/out \
    -v /Volumes/Passport/bids/license.txt:/opt/freesurfer/license.txt \
    -v /Volumes/Passport/bids/scratch:/scratch \
    poldracklab/fmriprep:latest \
    /data /out/out \
    participant \
    -w /scratch

(Note that this definitely would restart the whole workflow, since the scratch directory would have changed.)

1 Like

I see. Sorry for my naive confusion!!! Thanks so much for your help!

No worries. Just so you know, there’s also a helper tool fmriprep-docker, which @franklin posted a tutorial using, just yesterday: fMRIPrep tutorial: Running the docker image. You might find that helpful.