Skip to content

add EESSIError exception to avoid printing traceback#319

Merged
casparvl merged 6 commits intoEESSI:mainfrom
smoors:error
Mar 9, 2026
Merged

add EESSIError exception to avoid printing traceback#319
casparvl merged 6 commits intoEESSI:mainfrom
smoors:error

Conversation

@smoors
Copy link
Copy Markdown
Collaborator

@smoors smoors commented Jan 31, 2026

changes this:

ERROR: run session stopped: reframe fatal error: Invalid thread_binding value 'nonexisting'. Valid values: 'true', 'compact', or 'false'.
ERROR: Traceback (most recent call last):
  File "/vscmnt/brussel_pixiu_data/_data_brussel/100/vsc10009/reframe/eessitestsuite/venv-reframe/lib64/python3.9/site-packages/reframe/frontend/cli.py", line 1354, in main
    checks_found = loader.load_all(force=True)
  File "/vscmnt/brussel_pixiu_data/_data_brussel/100/vsc10009/reframe/eessitestsuite/venv-reframe/lib64/python3.9/site-packages/reframe/core/logging.py", line 1121, in _fn
    return fn(*args, **kwargs)
  File "/vscmnt/brussel_pixiu_data/_data_brussel/100/vsc10009/reframe/eessitestsuite/venv-reframe/lib64/python3.9/site-packages/reframe/frontend/loader.py", line 244, in load_all
    checks += self.load_from_dir(d, self._recurse, force)
  File "/vscmnt/brussel_pixiu_data/_data_brussel/100/vsc10009/reframe/eessitestsuite/venv-reframe/lib64/python3.9/site-packages/reframe/frontend/loader.py", line 223, in load_from_dir
    checks += self.load_from_file(entry.path, force)
  File "/vscmnt/brussel_pixiu_data/_data_brussel/100/vsc10009/reframe/eessitestsuite/venv-reframe/lib64/python3.9/site-packages/reframe/frontend/loader.py", line 195, in load_from_file
    return self.load_from_module(util.import_module_from_file(
  File "/vscmnt/brussel_pixiu_data/_data_brussel/100/vsc10009/reframe/eessitestsuite/venv-reframe/lib64/python3.9/site-packages/reframe/frontend/loader.py", line 156, in load_from_module
    candidate_tests = registry.instantiate_all(reset_sysenv,
  File "/vscmnt/brussel_pixiu_data/_data_brussel/100/vsc10009/reframe/eessitestsuite/venv-reframe/lib64/python3.9/site-packages/reframe/core/logging.py", line 1121, in _fn
    return fn(*args, **kwargs)
  File "/vscmnt/brussel_pixiu_data/_data_brussel/100/vsc10009/reframe/eessitestsuite/venv-reframe/lib64/python3.9/site-packages/reframe/core/decorators.py", line 105, in instantiate_all
    leaf_tests.append(test(*args, **kwargs))
  File "/vscmnt/brussel_pixiu_data/_data_brussel/100/vsc10009/reframe/eessitestsuite/venv-reframe/lib64/python3.9/site-packages/reframe/core/meta.py", line 497, in __call__
    obj.__init__(*args, **kwargs)
  File "/vscmnt/brussel_pixiu_data/_data_brussel/100/vsc10009/reframe/eessitestsuite/venv-reframe/lib64/python3.9/site-packages/reframe/core/hooks.py", line 111, in _fn
    getattr(obj, h.__name__)()
  File "/vscmnt/brussel_pixiu_data/_data_brussel/100/vsc10009/reframe/eessitestsuite/venv-reframe/lib64/python3.9/site-packages/reframe/core/hooks.py", line 38, in _fn
    func(*args, **kwargs)
  File "/data/brussel/100/vsc10009/reframe/eessitestsuite/test-suite/eessi/testsuite/eessi_mixin.py", line 159, in EESSI_mixin_run_after_init
    raise ReframeFatalError(err_msg)
reframe.core.exceptions.ReframeFatalError: Invalid thread_binding value 'nonexisting'. Valid values: 'true', 'compact', or 'false'.

to this:

ERROR: run session stopped: eessierror: Invalid thread_binding value 'nonexisting'. Valid values: 'true', 'compact', or 'false'.
ERROR: eessi.testsuite.utils.EESSIError: Invalid thread_binding value 'nonexisting'. Valid values: 'true', 'compact', or 'false'.

@casparvl
Copy link
Copy Markdown
Collaborator

Is it really preferable to hide the traceback? I mean, in most cases you just need to respect the suggestion and change it to a valid value. But in some cases, you might want to add support for a new value - and this will essentially provide you a starting point for that.

@smoors
Copy link
Copy Markdown
Collaborator Author

smoors commented Feb 11, 2026

do you have an example in mind?

my idea was that, since the test suite is emitting the error and not ReFrame, the user should not have to see the ugly ReFrame traceback, but we can make exceptions of course.

or we could add an option to increase the traceback limit?

Comment thread pyproject.toml
@@ -1,5 +1,5 @@
[build-system]
requires = ["setuptools>=42", "wheel"]
requires = ["setuptools>=42,<=81.0.0", "wheel"]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please open an issue on this, mention why you had to start doing this (which errors, etc.)

this should be a temporary measure...

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, it's the same issue as easybuild: pkg_resources should be replaced

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, we're actually using it ourselves in here... https://github.com/search?q=repo%3AEESSI%2Ftest-suite%20pkg_resources&type=code

It's been deprecated since setuptools 67.5.0 (March 2023), see also pypa/setuptools#3085

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@casparvl
Copy link
Copy Markdown
Collaborator

Discussed in the test meeting: we could make this optional, based on a parameter set on the command line (-S something). It would be really nice if the message that is printed then provides this suggestion ("to see the full traceback, rerun with -S ")

@smoors
Copy link
Copy Markdown
Collaborator Author

smoors commented Feb 12, 2026

using a ReFrame variable turned out to be a lot of hassle, so i resorted to an environment variable TRACEBACK

Copy link
Copy Markdown
Collaborator

@casparvl casparvl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works like a charm. I inserted some test class that didn't properly define the module_name in time and got:

$ reframe -c test-suite/eessi/testsuite/tests/ -t CI -t 1_8_node --system snellius:rome --list
...
ERROR: run session stopped: eessierror: The variable 'module_name' should be defined in any test class that inherits from EESSI_Mixin before (or in) the init phase, but it wasn't
Rerun with `TRACEBACK=1 reframe ...` to show the full traceback.
ERROR: eessi.testsuite.utils.EESSIError: The variable 'module_name' should be defined in any test class that inherits from EESSI_Mixin before (or in) the init phase, but it wasn't
Rerun with `TRACEBACK=1 reframe ...` to show the full traceback.

Then, with TRACEBACK=1:

$ TRACEBACK=1 reframe -c test-suite/eessi/testsuite/tests/ -t CI -t 1_8_node --system snellius:rome --list
...
ERROR: run session stopped: eessierror: The variable 'module_name' should be defined in any test class that inherits from EESSI_Mixin before (or in) the init phase, but it wasn't
ERROR: Traceback (most recent call last):
  File "/gpfs/home4/casparl/EESSI/reframe/reframe/frontend/cli.py", line 1354, in main
    checks_found = loader.load_all(force=True)
  File "/gpfs/home4/casparl/EESSI/reframe/reframe/core/logging.py", line 1116, in _fn
    return fn(*args, **kwargs)
  File "/gpfs/home4/casparl/EESSI/reframe/reframe/frontend/loader.py", line 244, in load_all
    checks += self.load_from_dir(d, self._recurse, force)
  File "/gpfs/home4/casparl/EESSI/reframe/reframe/frontend/loader.py", line 216, in load_from_dir
    checks += self.load_from_dir(entry.path, recurse, force)
  File "/gpfs/home4/casparl/EESSI/reframe/reframe/frontend/loader.py", line 216, in load_from_dir
    checks += self.load_from_dir(entry.path, recurse, force)
  File "/gpfs/home4/casparl/EESSI/reframe/reframe/frontend/loader.py", line 223, in load_from_dir
    checks += self.load_from_file(entry.path, force)
  File "/gpfs/home4/casparl/EESSI/reframe/reframe/frontend/loader.py", line 195, in load_from_file
    return self.load_from_module(util.import_module_from_file(
  File "/gpfs/home4/casparl/EESSI/reframe/reframe/frontend/loader.py", line 156, in load_from_module
    candidate_tests = registry.instantiate_all(reset_sysenv,
  File "/gpfs/home4/casparl/EESSI/reframe/reframe/core/logging.py", line 1116, in _fn
    return fn(*args, **kwargs)
  File "/gpfs/home4/casparl/EESSI/reframe/reframe/core/decorators.py", line 105, in instantiate_all
    leaf_tests.append(test(*args, **kwargs))
  File "/gpfs/home4/casparl/EESSI/reframe/reframe/core/meta.py", line 497, in __call__
    obj.__init__(*args, **kwargs)
  File "/gpfs/home4/casparl/EESSI/reframe/reframe/core/hooks.py", line 111, in _fn
    getattr(obj, h.__name__)()
  File "/gpfs/home4/casparl/EESSI/reframe/reframe/core/hooks.py", line 38, in _fn
    func(*args, **kwargs)
  File "/gpfs/home4/casparl/EESSI/test-suite/eessi/testsuite/eessi_mixin.py", line 145, in EESSI_mixin_validate_init
    raise EESSIError(msg)
eessi.testsuite.utils.EESSIError: The variable 'module_name' should be defined in any test class that inherits from EESSI_Mixin before (or in) the init phase, but it wasn't

Great!

@casparvl casparvl merged commit 1559cf5 into EESSI:main Mar 9, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants