|
27 | 27 | from ...utils.filemanip import (md5, FileNotFoundError, ensure_list,
|
28 | 28 | simplify_list, copyfiles, fnames_presuffix,
|
29 | 29 | loadpkl, split_filename, load_json, makedirs,
|
30 |
| - emptydirs, savepkl, to_str, indirectory) |
| 30 | + emptydirs, savepkl, to_str, indirectory, silentrm) |
31 | 31 |
|
32 | 32 | from ...interfaces.base import (traits, InputMultiPath, CommandLine, Undefined,
|
33 | 33 | DynamicTraitedSpec, Bunch, InterfaceResult,
|
@@ -440,7 +440,6 @@ def run(self, updatehash=False):
|
440 | 440 | for outdatedhash in glob(op.join(self.output_dir(), '_0x*.json')):
|
441 | 441 | os.remove(outdatedhash)
|
442 | 442 |
|
443 |
| - |
444 | 443 | # Hashfile while running
|
445 | 444 | hashfile_unfinished = op.join(
|
446 | 445 | outdir, '_0x%s_unfinished.json' % self._hashvalue)
|
@@ -474,7 +473,11 @@ def run(self, updatehash=False):
|
474 | 473 | except Exception:
|
475 | 474 | logger.warning('[Node] Error on "%s" (%s)', self.fullname, outdir)
|
476 | 475 | # Tear-up after error
|
477 |
| - os.remove(hashfile_unfinished) |
| 476 | + if not silentrm(hashfile_unfinished): |
| 477 | + logger.warning("""\ |
| 478 | +Interface finished unexpectedly and the corresponding unfinished hashfile %s \ |
| 479 | +does not exist. Another nipype instance may be running against the same work \ |
| 480 | +directory. Please ensure no other concurrent workflows are racing""", hashfile_unfinished) |
478 | 481 | raise
|
479 | 482 |
|
480 | 483 | # Tear-up after success
|
|
0 commit comments