Commit 5db1495d authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Added more context information to task failures.

parent b803a9d3
Pipeline #37522 passed with stages
in 5 minutes and 58 seconds
......@@ -187,14 +187,14 @@ class Proc(Document, metaclass=ProcMetaclass):
for error in errors:
if isinstance(error, Exception):
failed_with_exception = True
Proc.log(logger, log_level, 'task failed with exception', exc_info=error, **kwargs)
Proc.log(logger, log_level, 'task failed with exception', exc_info=error)
self.errors = [str(error) for error in errors]
self.complete_time = datetime.now()
if not failed_with_exception:
errors_str = "; ".join([str(error) for error in errors])
Proc.log(logger, log_level, 'task failed', errors=errors_str, **kwargs)
Proc.log(logger, log_level, 'task failed', errors=errors_str)
logger.info('process failed')
......
......@@ -183,7 +183,8 @@ class Calc(Proc):
@task
def parsing(self):
logger = self.get_calc_logger(parser=self.parser, step=self.parser)
context = dict(parser=self.parser, step=self.parser)
logger = self.get_calc_logger(**context)
parser = parser_dict[self.parser]
with utils.timer(logger, 'parser executed', input_size=self.mainfile_file.size):
......@@ -192,13 +193,14 @@ class Calc(Proc):
if self._parser_backend.status[0] != 'ParseSuccess':
logger.error(self._parser_backend.status[1])
error = self._parser_backend.status[1]
self.fail(error, level=logging.DEBUG)
self.fail(error, level=logging.DEBUG, **context)
@task
def normalizing(self):
for normalizer in normalizers:
normalizer_name = normalizer.__name__
logger = self.get_calc_logger(normalizer=normalizer_name, step=normalizer_name)
context = dict(normalizer=normalizer_name, step=normalizer_name)
logger = self.get_calc_logger(**context)
with utils.timer(
logger, 'normalizer executed', input_size=self.mainfile_file.size):
......@@ -207,7 +209,7 @@ class Calc(Proc):
if self._parser_backend.status[0] != 'ParseSuccess':
logger.error(self._parser_backend.status[1])
error = self._parser_backend.status[1]
self.fail(error, normalizer=normalizer_name, level=logging.WARNING)
self.fail(error, level=logging.WARNING, **context)
return
logger.debug(
'completed normalizer successfully', normalizer=normalizer_name)
......
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