예제 #1
0
def _crash_on_acq_10(node, graph):
    if 'acquisition-10' in node.fullname:
        try:
            raise Acq10Exception
        except Exception as e:
            report_crash(node)
            raise e
예제 #2
0
파일: plugin.py 프로젝트: poldracklab/mriqc
    def _report_crash(self, node, result=None):
        from nipype.pipeline.plugins.tools import report_crash

        tb = None
        if result is not None:
            node._result = result["result"]
            tb = result["traceback"]
            node._traceback = tb
        return report_crash(node, traceback=tb)
예제 #3
0
def test_report_crash():
    with mock.patch('pickle.dump', mock.MagicMock()) as mock_pickle_dump:
        with mock.patch('nipype.pipeline.plugins.tools.format_exception', mock.MagicMock()): # see iss 1517
            mock_pickle_dump.return_value = True
            mock_node = mock.MagicMock(name='mock_node')
            mock_node._id = 'an_id'
            mock_node.config = {
                'execution' : {
                    'crashdump_dir' : '.',
                    'crashfile_format' : 'pklz',
                }
            }

            actual_crashfile = report_crash(mock_node)

            expected_crashfile = re.compile('.*/crash-.*-an_id-[0-9a-f\-]*.pklz')

            assert expected_crashfile.match(actual_crashfile).group() == actual_crashfile
            assert mock_pickle_dump.call_count == 1
예제 #4
0
def test_report_crash():
    with mock.patch("pickle.dump", mock.MagicMock()) as mock_pickle_dump:
        with mock.patch(
            "nipype.pipeline.plugins.tools.format_exception", mock.MagicMock()
        ):  # see iss 1517
            mock_pickle_dump.return_value = True
            mock_node = mock.MagicMock(name="mock_node")
            mock_node._id = "an_id"
            mock_node.config = {
                "execution": {"crashdump_dir": ".", "crashfile_format": "pklz"}
            }

            actual_crashfile = report_crash(mock_node)

            expected_crashfile = re.compile(r".*/crash-.*-an_id-[0-9a-f\-]*.pklz")

            assert (
                expected_crashfile.match(actual_crashfile).group() == actual_crashfile
            )
            assert mock_pickle_dump.call_count == 1
예제 #5
0
def test_report_crash():
    with mock.patch('pickle.dump', mock.MagicMock()) as mock_pickle_dump:
        with mock.patch('nipype.pipeline.plugins.tools.format_exception',
                        mock.MagicMock()):  # see iss 1517
            mock_pickle_dump.return_value = True
            mock_node = mock.MagicMock(name='mock_node')
            mock_node._id = 'an_id'
            mock_node.config = {
                'execution': {
                    'crashdump_dir': '.',
                    'crashfile_format': 'pklz',
                }
            }

            actual_crashfile = report_crash(mock_node)

            expected_crashfile = re.compile(
                '.*/crash-.*-an_id-[0-9a-f\-]*.pklz')

            assert expected_crashfile.match(
                actual_crashfile).group() == actual_crashfile
            assert mock_pickle_dump.call_count == 1