Skip to content

Rename dropping outputs in wrong directory #2687

Closed
@effigies

Description

@effigies

Summary

Upstreaming nipreps/fmriprep#1261.

In an fMRIPrep workflow, we have a Rename interface that is run by a MapNode, tagged run_without_submitting. In the most recent release of fMRIPrep (which includes nipype 1.1.2), this produces the output error:

traits.trait_errors.TraitError: The 'out_file' trait of a RenameOutputSpec instance must be a file name, but a value of '/home/ds366/linux/fsaverage5.nii' <class 'str'> was specified.

The location should have been /mnt/Analyses/fMRIPrep/scratch-03/fmriprep_wf/single_subject_03_wf/func_preproc_task_rest_wf/bold_surf_wf/rename_src/mapflow/_rename_src0/fsaverage5.nii, which suggests that setting the working directory has regressed.

Unfortunately, I'm unable to reproduce the behavior locally, so testing is going to be very difficult.

cc @sundelinustc

Actual behavior

Creates (or falsely reports creating) symlink in original working directory, not node WD.

Expected behavior

Create and report symlink in node WD.

How to replicate the behavior

Unknown.

Script/Workflow details

import os
import numpy as np
import nibabel as nb
from nipype.pipeline import engine as pe
from nipype.interfaces import utility as niu

# needed values
DEFAULT_MEMORY_MIN_GB = 0.01
spaces = ['fsaverage5']
nb.Nifti1Image(np.zeros((5,5,5,5), dtype=np.uint8),
               np.eye(4)).to_filename('img.nii')

# Failing node
rename_src = pe.MapNode(niu.Rename(format_string='%(subject)s', keep_ext=True),
                        iterfield='subject', name='rename_src', run_without_submitting=True,
                        mem_gb=DEFAULT_MEMORY_MIN_GB)
rename_src.inputs.subject = spaces

rename_src.inputs.in_file = os.path.abspath('img.nii')

# Trivial workflow
workflow = pe.Workflow(name='bold_surf_wf')
workflow.add_nodes([rename_src])

workflow.run(plugin='MultiProc')

Platform details:

[ds366@blade17 Predator]$ /usr/local/packages/singularity/bin/singularity run /usr/local/packages/singularity/images/fmriprep.simg --version
fmriprep v1.1.4
[ds366@blade17 Predator]$ /usr/local/packages/singularity/bin/singularity exec /usr/local/packages/singularity/images/fmriprep.simg python -c 'import nipype; print(nipype.version)'
1.1.2

Execution environment

Choose one

  • Singularity

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions