Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/reframe-hpc/reframe into…
Browse files Browse the repository at this point in the history
… bugfix/autodetection_job_options
  • Loading branch information
ekouts committed Nov 13, 2024
2 parents 9808fba + ae27651 commit 454788f
Show file tree
Hide file tree
Showing 11 changed files with 90 additions and 63 deletions.
10 changes: 3 additions & 7 deletions docs/manpage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1163,19 +1163,15 @@ Miscellaneous options

This option can also be set using the :envvar:`RFM_SYSTEM` environment variable.

.. option:: --table-format=csv|plain|outline|grid
.. option:: --table-format=csv|plain|pretty

Set the formatting of tabular output printed by the options :option:`--performance-compare`, :option:`--performance-report` and the options controlling the stored sessions.

The acceptable values are the following:

- ``csv``: Generate CSV output
- ``grid``: Generate a table with grid lines
- ``outline``: (default) Generate a table with lines outlining the table and the header
- ``plain``: Generate a plain table without any lines

Note that the default ``outline`` format will not render correctly multi-line cells.
In this cases, prefer the ``grid`` or ``plain`` formats.
- ``plain``: Generate a plain table without any vertical lines allowing for easy ``grep``-ing
- ``pretty``: (default) Generate a pretty table

.. versionadded:: 4.7

Expand Down
93 changes: 60 additions & 33 deletions docs/tutorial.rst

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions reframe/core/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

__all__ = ['simple_test']


import inspect
import sys
import traceback
Expand Down Expand Up @@ -171,10 +170,10 @@ def _validate_test(cls):

if (cls.is_abstract()):
getlogger().warning(
f'skipping test {cls.__qualname__!r}: '
f'test has one or more undefined parameters'
f'skipping test {cls.__qualname__!r}: ' +
'the following parameters are undefined: ' +
', '.join(cls.param_space.undefined_params())
)
return False

conditions = [VersionValidator(v) for v in cls._rfm_required_version]
if (cls._rfm_required_version and
Expand Down
9 changes: 2 additions & 7 deletions reframe/core/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,12 +325,6 @@ def uninst_tests(self):
'''Get the uninstantiated tests of this registry'''
return self._registry.keys()

def _filter_valid_partitions(self, candidate_parts):
return [p for p in candidate_parts if p in self._env_by_part]

def _filter_valid_environs(self, part, candidate_environs):
return [e for e in cadidate_environs if e in self._env_by_part[part]]

def _is_registry(self, other):
if not isinstance(other, FixtureRegistry):
raise TypeError('other is not a FixtureRegistry')
Expand Down Expand Up @@ -776,7 +770,8 @@ def __init__(self, cls, *, scope='test', action='fork', variants='all',
# Check that the fixture class is not an abstract test.
if cls.is_abstract():
raise ValueError(
f'class {cls.__qualname__!r} has undefined parameters'
f'fixture {cls.__qualname__!r} has undefined parameters: ' +
', '.join(cls.param_space.undefined_params())
)

# Validate the scope
Expand Down
9 changes: 7 additions & 2 deletions reframe/core/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def update(self, other):
self.values = tuple(filt_vals) + self.values
except TypeError:
raise ReframeSyntaxError(
f"'filter_param' must return an iterable"
"'filter_param' must return an iterable"
) from None

def is_abstract(self):
Expand Down Expand Up @@ -307,7 +307,7 @@ def inject(self, obj, cls=None, params_index=None):
try:
# Get the parameter values for the specified variant
param_values = self.__param_combinations[params_index]
except IndexError as no_params:
except IndexError:
raise RuntimeError(
f'parameter space index out of range for '
f'{obj.__class__.__qualname__}'
Expand All @@ -333,6 +333,11 @@ def defines(self, name):
'''
return name in self.params and not self.params[name].is_abstract()

def undefined_params(self):
'''Return a list of all undefined parameters.'''
return [name for name, param in self.params.items()
if param.is_abstract()]

def __iter__(self):
'''Create a generator object to iterate over the parameter space
Expand Down
2 changes: 1 addition & 1 deletion reframe/frontend/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ def main():
envvar='RFM_SYSTEM'
)
misc_options.add_argument(
'--table-format', choices=['csv', 'plain', 'outline', 'grid'],
'--table-format', choices=['csv', 'pretty', 'plain'],
help='Table formatting',
envvar='RFM_TABLE_FORMAT', configvar='general/table_format'
)
Expand Down
6 changes: 2 additions & 4 deletions reframe/frontend/printer.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,10 +276,8 @@ def table(self, data, **kwargs):

# Map our options to tabulate
if table_format == 'plain':
tablefmt = 'plain'
elif table_format == 'outline':
tablefmt = 'mixed_outline'
elif table_format == 'grid':
tablefmt = 'simple'
elif table_format == 'pretty':
tablefmt = 'mixed_grid'
else:
raise ValueError(f'invalid table format: {table_format}')
Expand Down
7 changes: 5 additions & 2 deletions reframe/frontend/reporting/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -606,9 +606,12 @@ def _group_testcases(testcases, groups, columns):

@time_function
def _aggregate_perf(grouped_testcases, aggr_fn, cols):
if runtime().get_option('general/0/table_format') == 'csv':
# Use a csv friendly delimiter
# Update delimiter for joining unique values based on the table format
table_foramt = runtime().get_option('general/0/table_format')
if table_foramt == 'csv':
delim = '|'
elif table_foramt == 'plain':
delim = ','
else:
delim = '\n'

Expand Down
2 changes: 1 addition & 1 deletion reframe/schemas/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@
"general/report_junit": null,
"general/resolve_module_conflicts": true,
"general/save_log_files": false,
"general/table_format": "outline",
"general/table_format": "pretty",
"general/target_systems": ["*"],
"general/timestamp_dirs": "%Y%m%dT%H%M%S%z",
"general/trap_job_errors": false,
Expand Down
2 changes: 1 addition & 1 deletion unittests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -1257,7 +1257,7 @@ def test_testlib_inherit_fixture_in_different_files(run_reframe):
assert 'FAILED' not in stdout


@pytest.fixture(params=['csv', 'plain', 'grid', 'outline'])
@pytest.fixture(params=['csv', 'plain', 'pretty'])
def table_format(request):
return request.param

Expand Down
6 changes: 5 additions & 1 deletion unittests/test_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import reframe as rfm
from reframe.core.exceptions import ReframeSyntaxError
import reframe.core.decorators as decorators


class NoParams(rfm.RunOnlyRegressionTest):
Expand Down Expand Up @@ -48,10 +49,13 @@ class MyTest(TwoParams):

def test_abstract_param():
class MyTest(Abstract):
pass
# Add another abstract parameter
P2 = parameter()

assert MyTest.param_space['P0'] == ()
assert MyTest.param_space['P1'] == ('b',)
assert MyTest.param_space['P2'] == ()
assert MyTest.param_space.undefined_params() == ['P0', 'P2']


def test_param_override():
Expand Down

0 comments on commit 454788f

Please sign in to comment.