Skip to content

Commit f2a2326

Browse files
authored
Merge pull request reframe-hpc#3108 from vkarak/feat/implicit-partition-features
[feat] Include scheduler and launcher as default partition extras
2 parents 4f6b8c9 + 22d9312 commit f2a2326

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

docs/config_reference.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,7 @@ System Partition Configuration
596596
:default: ``[]``
597597

598598
User defined features of the partition.
599+
599600
These are accessible through the :attr:`~reframe.core.systems.SystemPartition.features` attribute of the :attr:`~reframe.core.pipeline.RegressionTest.current_partition` and can also be selected through the extended syntax of :attr:`~reframe.core.pipeline.RegressionTest.valid_systems`.
600601
The values of this list must be alphanumeric strings starting with a non-digit character and may also contain a ``-``.
601602

@@ -608,11 +609,18 @@ System Partition Configuration
608609
:default: ``{}``
609610

610611
User defined attributes of the partition.
612+
611613
These are accessible through the :attr:`~reframe.core.systems.SystemPartition.extras` attribute of the :attr:`~reframe.core.pipeline.RegressionTest.current_partition` and can also be selected through the extended syntax of :attr:`~reframe.core.pipeline.RegressionTest.valid_systems`.
612614
The attributes of this object must be alphanumeric strings starting with a non-digit character and their values can be of any type.
613615

616+
By default, the values of the :attr:`~config.systems.partitions.scheduler` and :attr:`~config.systems.partitions.launcher` of the partition are added to the partition's extras, if not already present.
617+
614618
.. versionadded:: 3.5.0
615619

620+
.. versionchanged:: 4.6.0
621+
622+
The default ``scheduler`` and ``launcher`` extras are added.
623+
616624
.. _container-platform-configuration:
617625

618626

reframe/core/systems.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,12 @@ def __init__(self, *, parent, name, sched_type, launcher_type,
189189
self._features = features
190190
self._time_limit = time_limit
191191

192+
# Add implicit extras from scheduler and launcher
193+
sched_name = self._sched_type.registered_name
194+
launcher_name = self._launcher_type.registered_name
195+
self._extras.setdefault('scheduler', sched_name)
196+
self._extras.setdefault('launcher', launcher_name)
197+
192198
@property
193199
def access(self):
194200
'''The scheduler options for accessing this system partition.

unittests/test_config.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,16 @@ def test_system_create(site_config):
436436
assert partition.local_env.env_vars == {'FOO_GPU': 'yes'}
437437
assert partition.max_jobs == 10
438438
assert partition.time_limit is None
439+
440+
# Check partition extras and features
441+
assert partition.features == ['cuda', 'mpi']
442+
assert partition.extras == {
443+
'gpu_arch': 'a100',
444+
'scheduler': 'slurm',
445+
'launcher': 'srun'
446+
}
447+
448+
# Check partition environments
439449
assert len(partition.environs) == 2
440450
assert partition.environment('PrgEnv-gnu').cc == 'cc'
441451
assert partition.environment('PrgEnv-gnu').cflags == []

0 commit comments

Comments
 (0)