From 257ac383be6df4a1f1d068b6b5858627c3bcd7d0 Mon Sep 17 00:00:00 2001 From: Eirini Koutsaniti Date: Wed, 10 Apr 2024 11:01:12 +0200 Subject: [PATCH] Add config + a test --- docs/config_reference.rst | 33 +++++++++++++++++++++++++- unittests/resources/config/settings.py | 9 +++++++ unittests/test_config.py | 6 +++++ 3 files changed, 47 insertions(+), 1 deletion(-) diff --git a/docs/config_reference.rst b/docs/config_reference.rst index 6de312ea9b..78d096fef0 100644 --- a/docs/config_reference.rst +++ b/docs/config_reference.rst @@ -684,7 +684,7 @@ ReFrame can launch containerized applications, but you need to configure properl Custom Job Scheduler Resources ============================== -ReFrame allows you to define custom scheduler resources for each partition that you can then transparently access through the :attr:`~reframe.core.pipeline.RegressionTest.extra_resources` attribute of a regression test. +ReFrame allows you to define custom scheduler resources for each partition that you can then transparently access through the :attr:`~reframe.core.pipeline.RegressionTest.extra_resources` attribute of a regression test or the environment. .. py:attribute:: systems.partitions.resources.name @@ -766,6 +766,27 @@ ReFrame allows you to define custom scheduler resources for each partition that The backend assumes a ``qsub`` option, if the options passed in these attributes start with a ``-``. +.. py:attribute:: systems.partitions.env_resources.name + + :required: Yes + + The name of this resources. + This name will be used to request this resource in a programming environment :attr:`~environments.resources`. + + .. versionadded:: 4.6 + + +.. py:attribute:: systems.partitions.env_resources.options + + :required: No + :default: ``[]`` + + A list of options to be passed to this partition’s job scheduler. + This is very similar to the :attr:`~config.systems.partitions.resources.options` parameter, but it is used to define resources that are specific to a programming environment. + + .. versionadded:: 4.6 + + Environment Configuration ========================= @@ -948,6 +969,16 @@ They are associated with `system partitions <#system-partition-configuration>`__ It first looks for definitions for the current partition, then for the containing system and, finally, for global definitions (the ``*`` pseudo-system). +.. py:attribute:: environments.resources + + :required: No + :default: ``{}`` + + This is similar to a regression test's :attr:`~reframe.core.pipeline.RegressionTest.extra_resources`. + + .. versionadded:: 4.6 + + .. _logging-config-reference: Logging Configuration diff --git a/unittests/resources/config/settings.py b/unittests/resources/config/settings.py index 72f19e45a7..094dc361b0 100644 --- a/unittests/resources/config/settings.py +++ b/unittests/resources/config/settings.py @@ -63,6 +63,15 @@ def hostname(): ] } ], + 'env_resources': [ + { + 'name': 'uenv', + 'options': [ + '--mount={mount}', + '--file={file}' + ], + }, + ], 'features': ['cuda', 'mpi'], 'extras': { 'gpu_arch': 'a100' diff --git a/unittests/test_config.py b/unittests/test_config.py index 6a89043b47..de9e87a4fe 100644 --- a/unittests/test_config.py +++ b/unittests/test_config.py @@ -461,6 +461,12 @@ def test_system_create(site_config): assert resources_spec == ['#DW jobdw capacity=100GB', '#DW stage_in source=/foo'] + env_resources_spec = partition.get_env_resource( + 'uenv', mount='mount_point', file='file_path' + ) + assert env_resources_spec == ['--mount=mount_point', + '--file=file_path'] + # Check processor info assert partition.processor.info is not None assert partition.processor.topology is not None