Skip to content

Commit

Permalink
Merge branch 'develop' into feat/config-option-topology-prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarak authored Nov 13, 2024
2 parents 268f9da + 7d4a7cb commit ca557ec
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 27 deletions.
4 changes: 3 additions & 1 deletion docs/config_reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ System Partition Configuration
:required: No
:default: ``[]``

A list of job scheduler `resource specification <#custom-job-scheduler-resources>`__ objects.
A list of job scheduler :ref:`resource specification <scheduler-resources>` objects.


.. py:attribute:: systems.partitions.processor
Expand Down Expand Up @@ -754,6 +754,8 @@ ReFrame can launch containerized applications, but you need to configure properl
If specified in conjunction with :attr:`~systems.partitions.container_platforms.env_vars`, it will be ignored.


.. _scheduler-resources:

Custom Job Scheduler Resources
==============================

Expand Down
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
11 changes: 9 additions & 2 deletions reframe/core/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,11 +261,18 @@ def pipeline_hooks(cls):
#: of the :attr:`valid_systems` list, in which case an AND operation on
#: these constraints is implied. For example, the test defining the
#: following will be valid for all systems that have define both ``feat1``
#: and ``feat2`` and set ``foo=1``
#: and ``feat2`` and set ``foo=1``:
#:
#: .. code-block:: python
#:
#: valid_systems = ['+feat1 +feat2 %foo=1']
#: valid_systems = [r'+feat1 +feat2 %foo=1']
#:
#: Any partition/environment extra or
#: :ref:`partition resource <scheduler-resources>` can be specified as a
#: feature constraint without having to explicitly state this in the
#: partition's/environment's feature list. For example, if ``key1`` is part
#: of the partition/environment extras list, then ``+key1`` will select
#: that partition or environment.
#:
#: For key/value pairs comparisons, ReFrame will automatically convert the
#: value in the key/value spec to the type of the value of the
Expand Down
11 changes: 7 additions & 4 deletions reframe/core/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,11 +311,13 @@ def _is_valid_part(part, valid_systems):
props[key] = val

have_plus_feats = all(
ft in part.features or ft in part.resources
(ft in part.features or
ft in part.resources or ft in part.extras)
for ft in plus_feats
)
have_minus_feats = any(
ft in part.features or ft in part.resources
(ft in part.features or
ft in part.resources or ft in part.extras)
for ft in minus_feats
)
try:
Expand Down Expand Up @@ -357,8 +359,9 @@ def _is_valid_env(env, valid_prog_environs):
key, val = subspec[1:].split('=')
props[key] = val

have_plus_feats = all(ft in env.features for ft in plus_feats)
have_minus_feats = any(ft in env.features
have_plus_feats = all(ft in env.features or ft in env.extras
for ft in plus_feats)
have_minus_feats = any(ft in env.features or ft in env.extras
for ft in minus_feats)
try:
have_props = True
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
39 changes: 33 additions & 6 deletions unittests/test_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ def _assert_supported(valid_systems, valid_prog_environs,

# Check AND in features and extras
_assert_supported(
valid_systems=['+cuda +mpi %gpu_arch=v100'],
valid_systems=[r'+cuda +mpi %gpu_arch=v100'],
valid_prog_environs=['*'],
expected={}
)
Expand All @@ -566,9 +566,18 @@ def _assert_supported(valid_systems, valid_prog_environs,
expected={}
)

# Check OR in features ad extras
# Check OR in features and extras
_assert_supported(
valid_systems=['+cuda +mpi', '%gpu_arch=v100'],
valid_systems=['+cuda +mpi', r'%gpu_arch=v100'],
valid_prog_environs=['*'],
expected={
'testsys:gpu': ['PrgEnv-gnu', 'builtin']
}
)

# Check that extra keys can used as features
_assert_supported(
valid_systems=['+cuda +mpi', '+gpu_arch'],
valid_prog_environs=['*'],
expected={
'testsys:gpu': ['PrgEnv-gnu', 'builtin']
Expand Down Expand Up @@ -640,23 +649,23 @@ def _assert_supported(valid_systems, valid_prog_environs,
)
_assert_supported(
valid_systems=['*'],
valid_prog_environs=['%bar=x'],
valid_prog_environs=[r'%bar=x'],
expected={
'testsys:gpu': [],
'testsys:login': ['PrgEnv-gnu']
}
)
_assert_supported(
valid_systems=['*'],
valid_prog_environs=['%foo=2'],
valid_prog_environs=[r'%foo=2'],
expected={
'testsys:gpu': ['PrgEnv-gnu'],
'testsys:login': []
}
)
_assert_supported(
valid_systems=['*'],
valid_prog_environs=['%foo=bar'],
valid_prog_environs=[r'%foo=bar'],
expected={
'testsys:gpu': [],
'testsys:login': []
Expand All @@ -671,6 +680,24 @@ def _assert_supported(valid_systems, valid_prog_environs,
}
)

# Check that extra keys can used as features
_assert_supported(
valid_systems=['*'],
valid_prog_environs=['+foo +bar'],
expected={
'testsys:gpu': ['PrgEnv-gnu'],
'testsys:login': ['PrgEnv-gnu']
}
)
_assert_supported(
valid_systems=['*'],
valid_prog_environs=['+foo -bar'],
expected={
'testsys:gpu': [],
'testsys:login': []
}
)

# Check valid_systems / valid_prog_environs combinations
_assert_supported(
valid_systems=['testsys:login'],
Expand Down

0 comments on commit ca557ec

Please sign in to comment.