Skip to content

Commit

Permalink
Merge pull request #3292 from vkarak/feat/expose-fail-phase
Browse files Browse the repository at this point in the history
[feat] Add a `check_fail_phase` log formatting specifier
  • Loading branch information
vkarak authored Oct 29, 2024
2 parents 2a41433 + b03329a commit 9605a3b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 2 additions & 1 deletion docs/config_reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1145,6 +1145,7 @@ All logging handlers share the following set of common attributes:
``%(check_executable)s``, The value of the :attr:`~reframe.core.pipeline.RegressionTest.executable` attribute.
``%(check_executable_opts)s``, The value of the :attr:`~reframe.core.pipeline.RegressionTest.executable_opts` attribute.
``%(check_extra_resources)s``, The value of the :attr:`~reframe.core.pipeline.RegressionTest.extra_resources` attribute.
``%(check_fail_phase)s``, The phase where the test has failed.
``%(check_fail_reason)s``, The failure reason if the test has failed.
``%(check_hashcode)s``, The unique hash associated with this test.
``%(check_info)s``, Various information about this test; essentially the return value of the test's :func:`~reframe.core.pipeline.RegressionTest.info` function.
Expand Down Expand Up @@ -1219,7 +1220,7 @@ All logging handlers share the following set of common attributes:
The ``%(check_#ALL)s`` special specifier is added.

.. versionadded:: 4.7
The ``%(check_fail_reason)s`` specifier is added.
The ``%(check_fail_phase)s`` and ``%(check_fail_reason)s`` specifiers are added.


.. py:attribute:: logging.handlers.format_perfvars
Expand Down
9 changes: 7 additions & 2 deletions reframe/core/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -866,8 +866,13 @@ def log_performance(self, level, task, msg=None, multiline=False):
self.extra['check_partition'] = part.name
self.extra['check_environ'] = env.name
self.extra['check_result'] = task.result
fail_reason = what(*task.exc_info) if not task.succeeded else None
self.extra['check_fail_reason'] = fail_reason
if not task.succeeded:
self.extra['check_fail_phase'] = task.failed_stage
self.extra['check_fail_reason'] = what(*task.exc_info)
else:
self.extra['check_fail_phase'] = None
self.extra['check_fail_reason'] = None

if msg is None:
msg = 'sent by ' + self.extra['osuser']

Expand Down

0 comments on commit 9605a3b

Please sign in to comment.