From 32e6bca32cfb807de36bf31fde365b5a8c59a769 Mon Sep 17 00:00:00 2001 From: Eirini Koutsaniti Date: Wed, 8 Jan 2025 09:10:05 +0100 Subject: [PATCH] Add warning for logging errors --- reframe/frontend/executors/__init__.py | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/reframe/frontend/executors/__init__.py b/reframe/frontend/executors/__init__.py index 68d2d223c..8199369c8 100644 --- a/reframe/frontend/executors/__init__.py +++ b/reframe/frontend/executors/__init__.py @@ -20,9 +20,10 @@ import reframe.utility.jsonext as jsonext import reframe.utility.typecheck as typ from reframe.core.exceptions import (AbortTaskError, - JobNotStartedError, FailureLimitError, ForceExitError, + JobNotStartedError, + LoggingError, RunSessionTimeout, SkipTestError, StatisticsError, @@ -480,8 +481,13 @@ def finalize(self): self._current_stage = 'finalize' self._notify_listeners('on_task_success') - self._perflogger.log_performance(logging.INFO, self, - multiline=self._perflog_compat) + try: + self._perflogger.log_performance(logging.INFO, self, + multiline=self._perflog_compat) + except LoggingError as e: + logging.getlogger().warning( + f'could not log performance data for {self.testcase}: {e}' + ) @logging.time_function def cleanup(self, *args, **kwargs): @@ -491,8 +497,13 @@ def fail(self, exc_info=None, callback='on_task_failure'): self._failed_stage = self._current_stage self._exc_info = exc_info or sys.exc_info() self._notify_listeners(callback) - self._perflogger.log_performance(logging.INFO, self, - multiline=self._perflog_compat) + try: + self._perflogger.log_performance(logging.INFO, self, + multiline=self._perflog_compat) + except LoggingError as e: + logging.getlogger().warning( + f'could not log performance data for {self.testcase}: {e}' + ) def skip(self, exc_info=None): self._skipped = True