Skip to content

JoinNode bug appears only on a different computer #1752

@bpinsard

Description

@bpinsard

Summary

I have a simple code that have an iterable connected to a join node.

    subjects_info = pe.Node(
        utility.IdentityInterface(fields=['sub']),
        run_without_submitting=True,
        name='subjects_info')
    subjects_info.iterables = [('sub', subject_ids)]


    template_args = dict(
        t1 = [['sub','ses','anat/sub-*_ses-SSV*_acq-MEMPRAGE_T1w.nii.gz']],
        t2 = [['sub','ses','anat/sub-*_ses-SSV*_T2w.nii.gz']],
        fmri = [['sub','ses','func/*.nii.gz']],
        fieldmap_mag=[['sub','ses','fmap/*phasediff.nii.gz']], # names are swapped !!                                         
        fieldmap_field=[['sub','ses','fmap/*magnitude1.nii.gz']],) # names are swapped !!                                     
    sessions_info = pe.Node(
        nio.DataGrabber(infields=['sub', 'ses'],
                        outfields=template_args.keys(),
			sort_filelist = True,
			raise_on_empty = False,
                        base_directory = mri_data_dir,
                        template=''),
	run_without_submitting=True,
        name='sessions_info')
    sessions_info.inputs.template = 'sub-%07d/ses-SSV%d/%s'
    sessions_info.inputs.template_args = template_args

    sessions_info.iterables = [('ses',range(1,15))]

    all_sessions = pe.JoinNode(
	utility.IdentityInterface(fields=template_args.keys()),
	joinsource = 'sessions_info',
        run_without_submitting=True,
        unique=False,
        name='all_sessions')
    w = pe.Workflow(name='moco_multiband')
    w.base_dir = proc_dir

    w.connect([
        (subjects_info, sessions_info,[('sub',)*2]),
        (sessions_info, all_sessions, [(k,k) for k in template_args.keys()])
    ])

I tried to install nipype (master branch) on a HPC, and use the same pipeline as before, but when I try to run I get the following error:

Actual behavior

AttributeError                            Traceback (most recent call last)
<ipython-input-5-b9a5896f20e5> in <module>()
----> 1 w.run()

/home/bpinsard/.conda/envs/prod/lib/python2.7/site-packages/nipype-0.13.0_gff36588.dev-py2.7.egg/nipype/pipeline/engine/workfl
ows.pyc in run(self, plugin, plugin_args, updatehash)
    566         logger.info('Workflow %s settings: %s', self.name, to_str(sorted(self.config)))
    567         self._set_needed_outputs(flatgraph)
--> 568         execgraph = generate_expanded_graph(deepcopy(flatgraph))
    569         for index, node in enumerate(execgraph.nodes()):
    570             node.config = merge_dict(deepcopy(self.config), node.config)

/home/bpinsard/.conda/envs/prod/lib/python2.7/site-packages/nipype-0.13.0_gff36588.dev-py2.7.egg/nipype/pipeline/engine/utils.
pyc in generate_expanded_graph(graph_in)
    786         graph_in = _merge_graphs(graph_in, subnodes,
    787                                  subgraph, inode._hierarchy + inode._id,
--> 788                                  iterables, iterable_prefix, inode.synchronize)
    789 
    790         # reconnect the join nodes

/home/bpinsard/.conda/envs/prod/lib/python2.7/site-packages/nipype-0.13.0_gff36588.dev-py2.7.egg/nipype/pipeline/engine/utils.
pyc in _merge_graphs(supergraph, nodes, subgraph, nodeid, iterables, prefix, synchronize)
    513     # Copy the iterable subgraphs
    514     for i, params in enumerate(iterable_params):
--> 515         Gc = deepcopy(subgraph)
    516         ids = [n._hierarchy + n._id for n in Gc.nodes()]
    517         nodeidx = ids.index(nodeid)

.
.
.
here goes all deepcopy machinery
.
.
.
.
/home/bpinsard/.conda/envs/prod/lib/python2.7/copy.pyc in deepcopy(x, memo, _nil)
    172             copier = getattr(x, "__deepcopy__", None)
    173             if copier:
--> 174                 y = copier(memo)
    175             else:
    176                 reductor = dispatch_table.get(cls)

/home/bpinsard/.conda/envs/prod/lib/python2.7/site-packages/nipype-0.13.0_gff36588.dev-py2.7.egg/nipype/interfaces/base.pyc in __deepcopy__(self, memo)
    645         # access all keys
    646         for key in self.copyable_trait_names():
--> 647             _ = getattr(self, key)
    648         # clone once
    649         dup = self.clone_traits(memo=memo)

AttributeError: 'DynamicTraitedSpec' object has no attribute 'fieldmap_magJ14'

So it seems that all iterate fields are listed in copyable_trait_names while it is not on my desktop with the exact same code, this is crazy. Any idea ?

Expected behavior

works perfectly on my desktop.

How to replicate the behavior

I don't know, this seems platform specific.

Platform details:

{'nibabel_version': '2.1.0', 'networkx_version': '1.11', 'numpy_version': '1.11.2', 'sys_platform': 'linux2', 'sys_version': '2.7.12 |Continuum Analytics, Inc.| (default, Jul 2 2016, 17:42:40) \n[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)]', 'commit_source': u'installation', 'commit_hash': u'ff36588', 'pkg_path': '/home/bpinsard/.conda/envs/prod/lib/python2.7/site-packages/nipype-0.13.0_gff36588.dev-py2.7.egg/nipype', 'sys_executable': '/home/bpinsard/.conda/envs/prod/bin/python', 'traits_version': '4.6.0', 'scipy_version': '0.18.1'}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions