@@ -249,12 +249,13 @@ def save_resultfile(result, cwd, name, rebase=True):
249
249
try :
250
250
with indirectory (cwd ):
251
251
# All the magic to fix #2944 resides here:
252
- for key , val in list (outputs .items ()):
253
- val = rebase_path_traits (result .outputs .trait (key ), val , cwd )
254
- setattr (result .outputs , key , val )
252
+ 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
255
+ setattr (result .outputs , key , val )
255
256
savepkl (resultsfile , result )
256
257
finally :
257
- # Reset resolved paths from the outputs dict no matter what
258
+ # Restore resolved paths from the outputs dict no matter what
258
259
for key , val in list (outputs .items ()):
259
260
setattr (result .outputs , key , val )
260
261
@@ -304,16 +305,17 @@ def load_resultfile(path, name, resolve=True):
304
305
finally :
305
306
pkl_file .close ()
306
307
307
- if resolve and result .outputs :
308
- try :
309
- outputs = result .outputs .get ()
310
- except TypeError : # This is a Bunch
311
- return result , aggregate , attribute_error
312
-
313
- logger .debug ('Resolving paths in outputs loaded from results file.' )
314
- for trait_name , old_value in list (outputs .items ()):
315
- value = resolve_path_traits (result .outputs .trait (trait_name ), old_value , path )
316
- setattr (result .outputs , trait_name , value )
308
+ if resolve and result .outputs :
309
+ try :
310
+ outputs = result .outputs .get ()
311
+ except TypeError : # This is a Bunch
312
+ return result , aggregate , attribute_error
313
+
314
+ logger .debug ('Resolving paths in outputs loaded from results file.' )
315
+ 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
318
+ setattr (result .outputs , trait_name , value )
317
319
318
320
return result , aggregate , attribute_error
319
321
0 commit comments