Skip to content

Commit 4d13d18

Browse files
committed
fix: do not set Undefined values - fixes join nodes with remove_needed_outputs=true
1 parent 43f4a16 commit 4d13d18

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

nipype/pipeline/engine/utils.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -308,14 +308,15 @@ def save_resultfile(result, cwd, name, rebase=True):
308308
with indirectory(cwd):
309309
# All the magic to fix #2944 resides here:
310310
for key, old in list(outputs.items()):
311-
val = rebase_path_traits(result.outputs.trait(key), old, cwd)
312-
if old != val: # Workaround #2968: Reset only changed values
311+
if isdefined(old):
312+
val = rebase_path_traits(result.outputs.trait(key), old, cwd)
313313
setattr(result.outputs, key, val)
314314
savepkl(resultsfile, result)
315315
finally:
316316
# Restore resolved paths from the outputs dict no matter what
317317
for key, val in list(outputs.items()):
318-
setattr(result.outputs, key, val)
318+
if isdefined(val):
319+
setattr(result.outputs, key, val)
319320

320321

321322
def load_resultfile(path, name, resolve=True):
@@ -371,8 +372,8 @@ def load_resultfile(path, name, resolve=True):
371372

372373
logger.debug('Resolving paths in outputs loaded from results file.')
373374
for trait_name, old in list(outputs.items()):
374-
value = resolve_path_traits(result.outputs.trait(trait_name), old, path)
375-
if value != old: # Workaround #2968: Reset only changed values
375+
if isdefined(old):
376+
value = resolve_path_traits(result.outputs.trait(trait_name), old, path)
376377
setattr(result.outputs, trait_name, value)
377378

378379
return result, aggregate, attribute_error

0 commit comments

Comments
 (0)