Skip to content

Commit 57a8db2

Browse files
committed
maint: add relevant code comment + minimal stylistic changes [skip ci]
1 parent 686aef9 commit 57a8db2

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

nipype/pipeline/engine/nodes.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -389,17 +389,17 @@ def hash_exists(self, updatehash=False):
389389
return cached, self._hashvalue, hashfile, self._hashed_inputs
390390

391391
def run(self, updatehash=False):
392-
"""Execute the node in its directory.
392+
"""
393+
Execute the node in its directory.
393394
394395
Parameters
395396
----------
396-
397397
updatehash: boolean
398398
When the hash stored in the output directory as a result of a previous run
399399
does not match that calculated for this execution, updatehash=True only
400400
updates the hash without re-running.
401-
"""
402401
402+
"""
403403
if self.config is None:
404404
self.config = {}
405405
self.config = merge_dict(deepcopy(config._sections), self.config)
@@ -443,6 +443,10 @@ def run(self, updatehash=False):
443443
for outdatedhash in glob(op.join(self.output_dir(), '_0x*.json')):
444444
os.remove(outdatedhash)
445445

446+
# _get_hashval needs to be called before running. When there is a valid (or seemingly
447+
# valid cache), the is_cached() member updates the hashval via _get_hashval.
448+
# However, if this node's folder doesn't exist or the result file is not found, then
449+
# the hashval needs to be generated here. See #3026 for a larger context.
446450
self._get_hashval()
447451
# Hashfile while running
448452
hashfile_unfinished = op.join(

0 commit comments

Comments
 (0)