-
Notifications
You must be signed in to change notification settings - Fork 535
FIX: load_resultfile crashes if open resultsfile from crashed job #3182
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
Merged
Merged
Changes from 4 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
c100772
FIX: check if result has an attribute outputs before accessing it
75ce23d
Update nipype/pipeline/engine/utils.py
daniel-ge 7b1a2f4
First attempt of a SGE test
daniel-ge 9c8f322
FIX: add missing argument to is_pending mock function
daniel-ge 57ab108
Update nipype/pipeline/plugins/tests/test_sgelike.py
daniel-ge 269ac56
Update nipype/pipeline/plugins/tests/test_sgelike.py
daniel-ge 98aeca1
Update nipype/pipeline/plugins/tests/test_sgelike.py
daniel-ge 33befb1
Update nipype/pipeline/plugins/tests/test_sgelike.py
daniel-ge ce22e36
Update nipype/pipeline/plugins/tests/test_sgelike.py
daniel-ge ef739f0
Update nipype/pipeline/plugins/tests/test_sgelike.py
daniel-ge 27a2472
Update nipype/pipeline/plugins/tests/test_sgelike.py
daniel-ge 02991da
FIX: get length of generator + STY: Black
daniel-ge 4a6d6b8
TEST: Cleanup imports
effigies File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
from nipype.pipeline.plugins.base import SGELikeBatchManagerBase | ||
from nipype.interfaces.utility import Function | ||
import nipype.pipeline.engine as pe | ||
from os.path import join | ||
import os | ||
from glob import glob | ||
import pytest | ||
from mock import patch | ||
from tempfile import TemporaryDirectory | ||
import subprocess | ||
|
||
|
||
def crasher(): | ||
raise ValueError() | ||
|
||
|
||
def submit_batchtask(self, scriptfile, node): | ||
self._pending[1] = node.output_dir() | ||
subprocess.call(["bash", scriptfile]) | ||
return 1 | ||
|
||
|
||
def is_pending(self, taskid): | ||
return False | ||
|
||
|
||
@patch.object(SGELikeBatchManagerBase, '_submit_batchtask', new=submit_batchtask) | ||
@patch.object(SGELikeBatchManagerBase, '_is_pending', new=is_pending) | ||
def test_crashfile_creation(): | ||
daniel-ge marked this conversation as resolved.
Show resolved
Hide resolved
|
||
cur_dir = os.getcwd() | ||
with TemporaryDirectory(prefix="test_engine_", dir=cur_dir) as tmpdirname: | ||
daniel-ge marked this conversation as resolved.
Show resolved
Hide resolved
|
||
pipe = pe.Workflow(name="pipe", base_dir=tmpdirname) | ||
daniel-ge marked this conversation as resolved.
Show resolved
Hide resolved
|
||
pipe.config["execution"]["crashdump_dir"] = tmpdirname | ||
daniel-ge marked this conversation as resolved.
Show resolved
Hide resolved
|
||
pipe.add_nodes([pe.Node(interface=Function(function=crasher), | ||
name="crasher")]) | ||
sgelike_plugin = SGELikeBatchManagerBase("") | ||
with pytest.raises(RuntimeError) as e: | ||
assert pipe.run(plugin=sgelike_plugin) | ||
assert (str(e.value) == | ||
"Workflow did not execute cleanly. Check log for details") | ||
|
||
crashfiles = glob(join(tmpdirname,"crash*crasher*.pklz")) | ||
daniel-ge marked this conversation as resolved.
Show resolved
Hide resolved
|
||
assert len(crashfiles) == 1 | ||
os.chdir(cur_dir) | ||
daniel-ge marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.