Skip to content

Conversation

@vkarak
Copy link
Contributor

@vkarak vkarak commented Mar 24, 2024

I hit this subtle and nasty bug while working on the new tutorial. It is exposed more easily now that the variables and parameters are by default loggable. The problem is the following:

When a series of tests that define different variables is set, ReFrame's logging will crash with an error like this:

--- Logging error ---
Traceback (most recent call last):
  File "/usr/lib/python3.10/logging/__init__.py", line 1100, in emit
    msg = self.format(record)
  File "/usr/lib/python3.10/logging/__init__.py", line 943, in format
    return fmt.format(record)
  File "/usr/lib/python3.10/logging/__init__.py", line 681, in format
    s = self.formatMessage(record)
  File "/usr/local/share/reframe/reframe/core/logging.py", line 366, in formatMessage
    return self.__fmt % record_proxy
KeyError: 'check_nthr'
...

The problem was that the message's format was calculated once from the check_#ALL special placeholder, so when trying to format the message from another test with different variables, it would cause this crash. I have added a unit test that reproduces this error exactly.

This PR fixes this problem by keeping the expanded format strings for each test. Also, it fixes a similar problem that was causing ReFrame to generate wrong perflog headers for subsequent tests.

@vkarak vkarak added this to the ReFrame 4.6 milestone Mar 24, 2024
@vkarak vkarak requested review from ekouts and teojgo March 24, 2024 23:44
@vkarak vkarak self-assigned this Mar 24, 2024
@vkarak vkarak force-pushed the bugfix/logging-check-all branch from c941dd5 to 34c5887 Compare March 24, 2024 23:45
@codecov
Copy link

codecov bot commented Mar 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.63%. Comparing base (3932f25) to head (bd0e2aa).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3142   +/-   ##
=======================================
  Coverage   86.63%   86.63%           
=======================================
  Files          61       61           
  Lines       12042    12049    +7     
=======================================
+ Hits        10432    10439    +7     
  Misses       1610     1610           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@vkarak vkarak merged commit 895f1a4 into reframe-hpc:master Mar 26, 2024
@vkarak vkarak deleted the bugfix/logging-check-all branch March 26, 2024 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants