Skip to content

Commit 4d2ed1c

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

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

nipype/pipeline/engine/utils.py

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

262263

263264
def load_resultfile(path, name, resolve=True):
@@ -313,8 +314,8 @@ def load_resultfile(path, name, resolve=True):
313314

314315
logger.debug('Resolving paths in outputs loaded from results file.')
315316
for trait_name, old in list(outputs.items()):
316-
value = resolve_path_traits(result.outputs.trait(trait_name), old, path)
317-
if value != old: # Workaround #2968: Reset only changed values
317+
if isdefined(old):
318+
value = resolve_path_traits(result.outputs.trait(trait_name), old, path)
318319
setattr(result.outputs, trait_name, value)
319320

320321
return result, aggregate, attribute_error

0 commit comments

Comments
 (0)