Skip to content

Commit 4c81304

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

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

nipype/pipeline/engine/utils.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -249,14 +249,15 @@ def save_resultfile(result, cwd, name, rebase=True):
249249
with indirectory(cwd):
250250
# All the magic to fix #2944 resides here:
251251
for key, old in list(outputs.items()):
252-
val = rebase_path_traits(result.outputs.trait(key), old, cwd)
253-
if old != val: # Workaround #2968: Reset only changed values
252+
if isdefined(old):
253+
val = rebase_path_traits(result.outputs.trait(key), old, cwd)
254254
setattr(result.outputs, key, val)
255255
savepkl(resultsfile, result)
256256
finally:
257257
# Restore resolved paths from the outputs dict no matter what
258258
for key, val in list(outputs.items()):
259-
setattr(result.outputs, key, val)
259+
if isdefined(val):
260+
setattr(result.outputs, key, val)
260261

261262

262263
def load_resultfile(results_file, resolve=True):
@@ -306,9 +307,9 @@ def load_resultfile(results_file, resolve=True):
306307

307308
logger.debug('Resolving paths in outputs loaded from results file.')
308309
for trait_name, old in list(outputs.items()):
309-
value = resolve_path_traits(result.outputs.trait(trait_name), old,
310-
results_file.parent)
311-
if value != old: # Workaround #2968: Reset only changed values
310+
if isdefined(old):
311+
value = resolve_path_traits(result.outputs.trait(trait_name), old,
312+
results_file.parent)
312313
setattr(result.outputs, trait_name, value)
313314

314315
return result, aggregate, attribute_error

0 commit comments

Comments
 (0)