1
- #!/usr/bin/env python
2
1
# -*- coding: utf-8 -*-
3
2
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
4
3
# vi: set ft=python sts=4 ts=4 sw=4 et:
@@ -290,7 +289,9 @@ def hash_exists(self, updatehash=False):
290
289
291
290
if op .exists (outdir ):
292
291
# 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 ))
294
295
if len (hashfiles ) > 1 :
295
296
for rmfile in hashfiles :
296
297
os .remove (rmfile )
@@ -300,9 +301,6 @@ def hash_exists(self, updatehash=False):
300
301
'that the ``base_dir`` for this node went stale. Please re-run the '
301
302
'workflow.' % len (hashfiles ))
302
303
303
- # Find unfinished hashfiles and error if any
304
- unfinished = glob (op .join (outdir , '_0x*_unfinished.json' ))
305
-
306
304
# This should not happen, but clean up and break if so.
307
305
if unfinished and updatehash :
308
306
for rmfile in unfinished :
@@ -433,7 +431,7 @@ def run(self, updatehash=False):
433
431
except OSError :
434
432
# Changing back to cwd is probably not necessary
435
433
# but this makes sure there's somewhere to change to.
436
- cwd = os . path .split (outdir )[0 ]
434
+ cwd = op .split (outdir )[0 ]
437
435
logger .warning ('Current folder "%s" does not exist, changing to "%s" instead.' ,
438
436
os .getenv ('PWD' , 'unknown' ), cwd )
439
437
0 commit comments