Skip to content

Commit 9ef74ac

Browse files
author
Vasileios Karakasis
authored
Merge pull request #1275 from victorusu/bug/RFC3339Formatter
[bugfix] Fix logging crash when increasing verbosity level
2 parents c56cf58 + 0ab966c commit 9ef74ac

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

docs/running.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -862,6 +862,9 @@ All handlers accept the following set of attributes (keys) in their configuratio
862862
In this case, the accuracy depends on the execution policy used.
863863
If tests are executed with the serial execution policy, this is close to the real completion time, but if the asynchronous execution policy is used, it can differ significantly.
864864
If the job completion time cannot be retrieved, ``None`` will be printed.
865+
- ``check_job_completion_time_unix``: *[new in 3.0]* The completion time of the job spawned by this regression test expressed as UNIX time.
866+
This is a raw time field and will not be formatted according to ``datefmt``.
867+
If specific formatting is desired, the ``check_job_completion_time`` should be used instead.
865868
- ``check_name``: Prints the name of the regression test on behalf of which ReFrame is currently executing.
866869
If ReFrame is not in the context of regression test, ``reframe`` will be printed.
867870
- ``check_num_tasks``: The number of tasks assigned to the regression test.

reframe/core/logging.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,8 @@ def formatTime(self, record, datefmt=None):
175175

176176
def format(self, record):
177177
datefmt = self.datefmt or self.default_time_format
178-
if record.check_job_completion_time is not None:
179-
ct = self.converter(record.check_job_completion_time)
178+
if record.check_job_completion_time_unix is not None:
179+
ct = self.converter(record.check_job_completion_time_unix)
180180
record.check_job_completion_time = _format_time_rfc3339(
181181
ct, datefmt
182182
)
@@ -419,6 +419,7 @@ def __init__(self, logger=None, check=None):
419419
'check_name': 'reframe',
420420
'check_jobid': '-1',
421421
'check_job_completion_time': None,
422+
'check_job_completion_time_unix': None,
422423
'check_info': 'reframe',
423424
'check_system': None,
424425
'check_partition': None,
@@ -480,7 +481,7 @@ def _update_check_extras(self):
480481
self.extra['check_jobid'] = self.check.job.jobid
481482
if self.check.job.completion_time:
482483
ct = self.check.job.completion_time
483-
self.extra['check_job_completion_time'] = ct
484+
self.extra['check_job_completion_time_unix'] = ct
484485

485486
def log_performance(self, level, tag, value, ref,
486487
low_thres, upper_thres, unit=None, *, msg=None):

unittests/test_cli.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,16 @@ def test_verbosity(self):
473473
assert 'Traceback' not in stderr
474474
assert 0 == returncode
475475

476+
def test_verbosity_with_check(self):
477+
self.more_options = ['-vvvvv']
478+
self.checkpath = ['unittests/resources/checks/hellocheck.py']
479+
returncode, stdout, stderr = self._run_reframe()
480+
assert '' != stdout
481+
assert '--- Logging error ---' not in stdout
482+
assert 'Traceback' not in stdout
483+
assert 'Traceback' not in stderr
484+
assert 0 == returncode
485+
476486
@fixtures.switch_to_user_runtime
477487
def test_unload_module(self):
478488
# This test is mostly for ensuring coverage. `_run_reframe()` restores

0 commit comments

Comments
 (0)