Commit df367ebd authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Store backend if available on calc proc failure. More tests.

parent b0acf249
Pipeline #71820 passed with stages
in 14 minutes
......@@ -463,7 +463,8 @@ class EntryMetadata(metainfo.MSection):
if domain_section is None:
domain_section = self.m_create(domain_section_def.section_cls)
if backend is not None:
class EntryArchive(metainfo.MSection):
......@@ -169,7 +169,7 @@ class DFTMetadata(MSection):
spacegroup = Quantity(
type=int, default='not processed',
type=int, default=-1,
description='The spacegroup of the simulated system as number.',
......@@ -328,6 +328,11 @@ class Calc(Proc):
self._entry_metadata.processed = False
if self._parser_backend and self._parser_backend.resource:
backend = self._parser_backend
backend = None
except Exception as e:
......@@ -123,6 +123,12 @@ def test_processing(processed, no_warn, mails, monkeypatch):
assert'Processing completed', mails.messages[0].data.decode('utf-8')) is not None
def test_processing_two_runs(test_user, proc_infra):
processed = run_processing(
('test_upload_id', 'tests/data/proc/',), test_user)
def test_processing_with_large_dir(test_user, proc_infra):
upload_path = 'tests/data/proc/'
upload_id = upload_path[:-4]
......@@ -207,6 +213,7 @@ def test_process_non_existing(proc_infra, test_user, with_error):
assert upload.tasks_status == FAILURE
assert len(upload.errors) > 0
@pytest.mark.parametrize('with_failure', [None, 'before', 'after', 'not-matched'])
def test_re_processing(published: Upload, internal_example_user_metadata, monkeypatch, with_failure):
......@@ -369,6 +376,7 @@ def mock_failure(cls, task, monkeypatch):
@pytest.mark.parametrize('task', ['extracting', 'parse_all', 'cleanup', 'parsing'])
def test_task_failure(monkeypatch, uploaded, task, proc_infra, test_user, with_error):
upload_id, _ = uploaded
# mock the task method to through exceptions
if hasattr(Upload, task):
cls = Upload
......@@ -400,6 +408,15 @@ def test_task_failure(monkeypatch, uploaded, task, proc_infra, test_user, with_e
assert calc.current_task == 'parsing'
assert len(calc.errors) > 0
calc = Calc.objects(upload_id=upload_id).first()
if calc is not None:
with upload.upload_files.read_archive(calc.calc_id) as archive:
calc_archive = archive[calc.calc_id]
assert 'section_metadata' in calc_archive
assert 'processing_logs' in calc_archive
if task != 'parsing':
assert 'section_run' in calc_archive
# TODO timeout
# consume_ram, segfault, and exit are not testable with the celery test worker
@pytest.mark.parametrize('failure', ['exception'])
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment