Skip to content

Commit 4e0f6e1

Browse files
committed
finishing pe.nodes - unfinished hashfiles
1 parent 1725515 commit 4e0f6e1

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

nipype/pipeline/engine/nodes.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#!/usr/bin/env python
21
# -*- coding: utf-8 -*-
32
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
43
# vi: set ft=python sts=4 ts=4 sw=4 et:
@@ -290,7 +289,9 @@ def hash_exists(self, updatehash=False):
290289

291290
if op.exists(outdir):
292291
# Find previous hashfiles
293-
hashfiles = glob(op.join(outdir, '_0x*.json'))
292+
globhashes = glob(op.join(outdir, '_0x*.json'))
293+
unfinished = [path for path in globhashes if path.endswith('_unfinished.json')]
294+
hashfiles = list(set(globhashes) - set(unfinished))
294295
if len(hashfiles) > 1:
295296
for rmfile in hashfiles:
296297
os.remove(rmfile)
@@ -300,9 +301,6 @@ def hash_exists(self, updatehash=False):
300301
'that the ``base_dir`` for this node went stale. Please re-run the '
301302
'workflow.' % len(hashfiles))
302303

303-
# Find unfinished hashfiles and error if any
304-
unfinished = glob(op.join(outdir, '_0x*_unfinished.json'))
305-
306304
# This should not happen, but clean up and break if so.
307305
if unfinished and updatehash:
308306
for rmfile in unfinished:
@@ -433,7 +431,7 @@ def run(self, updatehash=False):
433431
except OSError:
434432
# Changing back to cwd is probably not necessary
435433
# but this makes sure there's somewhere to change to.
436-
cwd = os.path.split(outdir)[0]
434+
cwd = op.split(outdir)[0]
437435
logger.warning('Current folder "%s" does not exist, changing to "%s" instead.',
438436
os.getenv('PWD', 'unknown'), cwd)
439437

0 commit comments

Comments
 (0)