Commit 377c55a4 authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Added processing errors to elastic search.

parent ee0e7b55
Pipeline #92632 passed with stages
in 35 minutes and 18 seconds
......@@ -415,6 +415,10 @@ class EntryMetadata(metainfo.MSection):
categories=[MongoMetadata],
a_search=Search())
processing_errors = metainfo.Quantity(
type=str, shape=['*'], description='Errors that occured during processing',
a_search=Search(many_and='append'))
nomad_version = metainfo.Quantity(
type=str,
description='The NOMAD version used for the last processing',
......
......@@ -268,6 +268,11 @@ class Calc(Proc):
dump_dict.update(level=method_name.upper())
self._calc_proc_logs.append(dump_dict)
if method_name == 'error':
error = event_dict.get('event', None)
if error is not None:
self._entry_metadata.processing_errors.append(error)
except Exception:
# Exceptions here will cause indefinite loop
pass
......@@ -333,6 +338,7 @@ class Calc(Proc):
self._entry_metadata.nomad_version = config.meta.version
self._entry_metadata.nomad_commit = config.meta.commit
self._entry_metadata.last_processing = datetime.utcnow()
self._entry_metadata.processing_errors = []
self._entry_metadata.files = self.upload_files.calc_files(self.mainfile)
self.parsing()
......@@ -351,6 +357,7 @@ class Calc(Proc):
self._entry_metadata = self.create_metadata()
self._entry_metadata.calc_hash = self.upload_files.calc_hash(self.mainfile)
self._entry_metadata.last_processing = datetime.utcnow()
self._entry_metadata.processing_errors = []
self._entry_metadata.files = self.upload_files.calc_files(self.mainfile)
self._entry_metadata.parser_name = self.parser
......
......@@ -121,6 +121,7 @@ def assert_processing(upload: Upload, published: bool = False):
# check some domain metadata
assert entry_metadata.n_atoms > 0
assert len(entry_metadata.atoms) > 0
assert len(entry_metadata.processing_errors) == 0
assert upload.get_calc(calc.calc_id) is not None
......@@ -532,6 +533,8 @@ def test_task_failure(monkeypatch, uploaded, task, proc_infra, test_user, with_e
assert 'section_metadata' in calc_archive
assert calc_archive['section_metadata']['dft']['code_name'] not in [
config.services.unavailable_value, config.services.not_processed_value]
if task != 'cleanup':
assert len(calc_archive['section_metadata']['processing_errors']) > 0
assert 'processing_logs' in calc_archive
if task != 'parsing':
assert 'section_run' in calc_archive
......
Supports Markdown
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