Skip to content

[FIX] immunize shutil.rmtree to node non-existence for remove_node_di… #3135

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 52 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
1c98d4d
[BUG] immunize shutil.rmtree to node non-existence for remove_node_di…
Jan 3, 2020
28b8b8a
DOC: Deduplicate code for Sphinx's APIdoc generation
oesteban Dec 20, 2019
722bd64
DOC: Deep revision of documentation building
oesteban Dec 21, 2019
c68e3b9
fix: last release changelog
oesteban Dec 21, 2019
48f78d0
enh: accept a milestone number in the ``update_changes.sh`` script
oesteban Dec 21, 2019
0ce15de
fix: remove unnecessary line [skip ci]
oesteban Dec 21, 2019
a51b95a
DOC: Documentation overhaul
oesteban Dec 21, 2019
204c0bd
fix: circle.yml file
oesteban Dec 29, 2019
6de90c5
fix: add modified specs
oesteban Dec 30, 2019
f763008
sty: black
oesteban Dec 30, 2019
1e55bc6
fix: make specs after black
oesteban Dec 30, 2019
f5f7314
maint: remove unused ``build_docs.py`` script
oesteban Dec 30, 2019
9967f25
fix: small typos, pep8 errors, etc.
oesteban Dec 30, 2019
45a6bfc
Update .zenodo.json - added Hrvoje Stojic
hstojic Dec 23, 2019
7c90bd8
MNT: Update mailmap
effigies Dec 30, 2019
d7bef76
change ANTS number_of_time_steps from Float to Int
Dec 20, 2019
218a63d
Apply suggestions from code review
oesteban Jan 1, 2020
9224a6f
Apply suggestions from code review
oesteban Jan 1, 2020
be8d9a9
fix: minimal fixes in ordering and links
oesteban Jan 1, 2020
be900d1
fix: links to interface bases when showing inheritance
oesteban Jan 1, 2020
8b5dab1
Apply suggestions from code review
oesteban Jan 1, 2020
46d8f2b
Apply suggestions from code review
oesteban Jan 1, 2020
022dea5
Apply suggestions from code review
oesteban Jan 1, 2020
ff7dd7d
Update doc/interfaces.rst
oesteban Jan 1, 2020
da67d71
fix: typos and links in fmri auditory example
oesteban Jan 1, 2020
5bdaaf2
fix: updates to ``make_examples.py``
oesteban Jan 1, 2020
9f99aaf
fix: miscellaneous improvements and fixes
oesteban Jan 1, 2020
879c556
fix: documentation build at readthedocs
oesteban Jan 1, 2020
3335c1b
doc: fix sphinx's latex build
oesteban Jan 2, 2020
21ecd6a
fix: strings too long
oesteban Jan 2, 2020
9ef8c95
fix: codacy issues
oesteban Jan 2, 2020
3e2e89f
DOC: Bring examples generation back to ``doc/conf.py``
oesteban Jan 2, 2020
d8b89aa
DOC: Revise generation of examples to work in RTD
oesteban Jan 2, 2020
4b8d467
FIX: Repair aftermath of docs refactor
oesteban Jan 2, 2020
d576418
fix: revise some r-strings in SPM's EstimateContrast
oesteban Jan 2, 2020
aaf677a
sty: black
oesteban Jan 2, 2020
3b8f228
FIX: Can't seem to import workflows from niflows in CircleCI
oesteban Jan 2, 2020
5bc2777
fix: update imports nipype.workflows -> niflow.nipyp1.workflows
oesteban Jan 2, 2020
f122323
pin: new niflows version 0.4.0
oesteban Jan 2, 2020
414fa39
fix: mapnode to generate result file when crashes in single node mode
satra Jan 5, 2020
6df7842
enh: simplify test further
satra Jan 5, 2020
4953418
DOC: Update changelog to include backported PRs
effigies Jan 6, 2020
7dd3b37
Merge pull request #3146 from effigies/bp/1.4.x/cherrypicking
effigies Jan 6, 2020
fcc544b
fix: documentation build at readthedocs
oesteban Jan 1, 2020
38354a3
fix: mapnode to generate result file when crashes in single node mode
satra Jan 5, 2020
333fd8a
enh: simplify test further
satra Jan 5, 2020
84bc62f
DOC: Update changelog to include backported PRs
effigies Jan 6, 2020
5003415
Merge branch 'maint/1.4.x' of https://github.com/nipy/nipype into mai…
Jan 6, 2020
4e4b2a2
[FIX] immunize shutil.rmtree to node non-existence for remove_node_di…
Jan 6, 2020
572bf37
[FIX] immunize shutil.rmtree to node non-existence for remove_node_di…
Jan 6, 2020
9501a27
Merge branch 'maint/1.4.x' of https://github.com/dPys/nipype into mai…
Jan 6, 2020
75030b2
Merge branch 'master' of https://github.com/dPys/nipype
Jan 6, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions doc/changelog/1.X.X-changelog.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
1.4.1 (To Be Determined)
========================
(`Full changelog <https://github.com/nipy/nipype/milestone/1.4.1?closed=1>`__)

* FIX: mapnode to generate result file when crashes in single node mode (https://github.com/nipy/nipype/pull/3143)
* FIX: Can't seem to import workflows from niflows in CircleCI (https://github.com/nipy/nipype/pull/3134)
* FIX: Repair aftermath of docs refactor (https://github.com/nipy/nipype/pull/3133)
* FIX: change ANTS number_of_time_steps from Float to Int (https://github.com/nipy/nipype/pull/3118)
* DOC: Revise generation of examples to work in RTD (https://github.com/nipy/nipype/pull/3132)
* DOC: Bring examples generation back to ``doc/conf.py`` (https://github.com/nipy/nipype/pull/3131)
* DOC: Documentation overhaul (https://github.com/nipy/nipype/pull/3124)
* DOC: Deep revision of documentation building (https://github.com/nipy/nipype/pull/3120)
* DOC: Deduplicate code for Sphinx's APIdoc generation (https://github.com/nipy/nipype/pull/3119)

1.4.0 (December 20, 2019)
=========================
(`Full changelog <https://github.com/nipy/nipype/milestone/37?closed=1>`__)
Expand Down
21 changes: 20 additions & 1 deletion doc/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,27 @@
configparser
dipy
funcsigs
future>=0.16.0
ipython
matplotlib
mock
nbsphinx
networkx>=1.9
neurdflib
nibabel>=2.1.0
numpy>=1.9.0
numpydoc
packaging
prov>=1.5.2
psutil
pydot>=1.2.3
pydotplus
pytest>=3.0
python-dateutil>=2.2
scipy>=0.14
simplejson>=3.8.0
sphinx-argparse
sphinx>=2.1.2
sphinxcontrib-apidoc
sphinxcontrib-napoleon
sphinxcontrib-napoleon
traits>=4.6
10 changes: 9 additions & 1 deletion nipype/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,15 @@ def get_nipype_gitversion():
# https://github.com/nipy/nipype/pull/2961#issuecomment-512035484
REQUIRES += ["neurdflib"]

TESTS_REQUIRES = ["codecov", "coverage<5", "mock", "pytest", "pytest-cov", "pytest-env"]
TESTS_REQUIRES = [
"codecov",
"coverage<5",
"mock",
"pytest",
"pytest-cov",
"pytest-env",
"pytest-timeout",
]

EXTRA_REQUIRES = {
"data": ["datalad"],
Expand Down
38 changes: 32 additions & 6 deletions nipype/pipeline/engine/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1366,13 +1366,39 @@ def _run_interface(self, execute=True, updatehash=False):
nodenames = [nnametpl.format(i) for i in range(nitems)]

# Run mapnode
result = self._collate_results(
_node_runner(
self._make_nodes(cwd),
updatehash=updatehash,
stop_first=str2bool(self.config["execution"]["stop_on_first_crash"]),
)
outdir = self.output_dir()
result = InterfaceResult(
interface=self._interface.__class__,
runtime=Bunch(
cwd=outdir,
returncode=1,
environ=dict(os.environ),
hostname=socket.gethostname(),
),
inputs=self._interface.inputs.get_traitsfree(),
)
try:
result = self._collate_results(
_node_runner(
self._make_nodes(cwd),
updatehash=updatehash,
stop_first=str2bool(
self.config["execution"]["stop_on_first_crash"]
),
)
)
except Exception as msg:
result.runtime.stderr = "%s\n\n%s".format(
getattr(result.runtime, "stderr", ""), msg
)
_save_resultfile(
result,
outdir,
self.name,
rebase=str2bool(self.config["execution"]["use_relative_paths"]),
)
raise

# And store results
_save_resultfile(result, cwd, self.name, rebase=False)
# remove any node directories no longer required
Expand Down
20 changes: 20 additions & 0 deletions nipype/pipeline/engine/tests/test_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,3 +314,23 @@ def test_outputmultipath_collapse(tmpdir):
assert ifres.outputs.out == [4]
assert ndres.outputs.out == [4]
assert select_nd.result.outputs.out == [4]


@pytest.mark.timeout(30)
def test_mapnode_single(tmpdir):
tmpdir.chdir()

def _producer(num=1, deadly_num=7):
if num == deadly_num:
raise RuntimeError("Got the deadly num (%d)." % num)
return num + 1

pnode = pe.MapNode(
niu.Function(function=_producer), name="ProducerNode", iterfield=["num"]
)
pnode.inputs.num = [7]
wf = pe.Workflow(name="PC_Workflow")
wf.add_nodes([pnode])
wf.base_dir = os.path.abspath("./test_output")
with pytest.raises(RuntimeError):
wf.run(plugin="MultiProc")
2 changes: 1 addition & 1 deletion nipype/pipeline/plugins/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ def _remove_node_dirs(self):
)
% (self.procs[idx]._id, outdir)
)
shutil.rmtree(outdir)
shutil.rmtree(outdir, ignore_errors=True)


class SGELikeBatchManagerBase(DistributedPluginBase):
Expand Down