Skip to content

Commit

Permalink
Merge branch 'develop' into dependabot/pip/argcomplete-3.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarak committed May 8, 2024
2 parents 8c66de4 + 5688d9c commit 2258c94
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 22 deletions.
28 changes: 19 additions & 9 deletions docs/config_reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -976,7 +976,7 @@ They are associated with `system partitions <#system-partition-configuration>`__
:default: ``{}``

Scheduler resources associated with this environments.

This is the equivalent of a test's :attr:`~reframe.core.pipeline.RegressionTest.extra_resources`.

.. versionadded:: 4.6
Expand Down Expand Up @@ -1632,14 +1632,6 @@ General Configuration
.. versionadded:: 3.12.0


.. py:attribute:: general.git_timeout
:required: No
:default: 5

Timeout value in seconds used when checking if a git repository exists.


.. py:attribute:: general.dump_pipeline_progress
Dump pipeline progress for the asynchronous execution policy in ``pipeline-progress.json``.
Expand All @@ -1651,6 +1643,24 @@ General Configuration
.. versionadded:: 3.10.0


.. py:attribute:: general.flex_alloc_strict
:required: No
:default: ``False``

Fail flexible tests if their minimum task requirement is not satisfied.

.. versionadded:: 4.7


.. py:attribute:: general.git_timeout
:required: No
:default: 5

Timeout value in seconds used when checking if a git repository exists.


.. py:attribute:: general.pipeline_timeout
Timeout in seconds for advancing the pipeline in the asynchronous execution policy.
Expand Down
27 changes: 27 additions & 0 deletions docs/manpage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,18 @@ If no node can be selected, the test will be marked as a failure with an appropr

Slurm OR constraints and parenthesized expressions are supported in flexible node allocation.

.. versionchanged:: 4.7
The test is not marked as a failure if not enough nodes are available, but it is skipped instead.
To enforce a failure, use :option:`--flex-alloc-strict`

.. option:: --flex-alloc-strict

Fail flexible tests if their minimum task requirement is not satisfied.
Otherwise the tests will be skipped.

.. versionadded:: 4.7


---------------------------------------
Options controlling ReFrame environment
---------------------------------------
Expand Down Expand Up @@ -1410,6 +1422,21 @@ Whenever an environment variable is associated with a configuration option, its
.. versionadded:: 4.0.0


.. envvar:: RFM_FLEX_ALLOC_STRICT

Fail flexible tests if their minimum task requirement is not satisfied.

.. table::
:align: left

================================== ==================
Associated command line option :option:`--flex-alloc-strict`
Associated configuration parameter :attr:`~config.general.flex_alloc_strict`
================================== ==================

.. versionadded:: 4.7


.. envvar:: RFM_GIT_TIMEOUT

Timeout value in seconds used when checking if a git repository exists.
Expand Down
1 change: 1 addition & 0 deletions reframe/core/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -2018,6 +2018,7 @@ def _get_cp_env():
self._job.prepare(
commands, environs,
self._current_partition.prepare_cmds,
rt.runtime().get_option('general/flex_alloc_strict'),
login=rt.runtime().get_option('general/0/use_login_shell'),
trap_errors=rt.runtime().get_option(
'general/0/trap_job_errors'
Expand Down
16 changes: 9 additions & 7 deletions reframe/core/schedulers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import reframe.core.shell as shell
import reframe.utility.jsonext as jsonext
import reframe.utility.typecheck as typ
from reframe.core.exceptions import JobError, JobNotStartedError
from reframe.core.exceptions import JobError, JobNotStartedError, SkipTestError
from reframe.core.launchers import JobLauncher
from reframe.core.logging import getlogger, DEBUG2
from reframe.core.meta import RegressionTestMeta
Expand Down Expand Up @@ -550,7 +550,8 @@ def submit_time(self):
'''
return self._submit_time

def prepare(self, commands, environs=None, prepare_cmds=None, **gen_opts):
def prepare(self, commands, environs=None, prepare_cmds=None,
strict_flex=False, **gen_opts):
environs = environs or []
if self.num_tasks is not None and self.num_tasks <= 0:
getlogger().debug(f'[F] Flexible node allocation requested')
Expand All @@ -565,11 +566,12 @@ def prepare(self, commands, environs=None, prepare_cmds=None, **gen_opts):
'this scheduler backend') from e

if guessed_num_tasks < min_num_tasks:
raise JobError(
'could not satisfy the minimum task requirement: '
'required %s, found %s' %
(min_num_tasks, guessed_num_tasks)
)
msg = (f'could not satisfy the minimum task requirement: '
f'required {min_num_tasks}, found {guessed_num_tasks}')
if strict_flex:
raise JobError(msg)
else:
raise SkipTestError(msg)

self.num_tasks = guessed_num_tasks
getlogger().debug(f'[F] Setting num_tasks to {self.num_tasks}')
Expand Down
6 changes: 6 additions & 0 deletions reframe/frontend/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,12 @@ def main():
dest='flex_alloc_nodes', metavar='{all|STATE|NUM}', default=None,
help='Set strategy for the flexible node allocation (default: "idle").'
)
run_options.add_argument(
'--flex-alloc-strict', action='store_true',
envvar='RFM_FLEX_ALLOC_STRICT',
configvar='general/flex_alloc_strict',
help='Fail the flexible tests if not enough nodes can be found'
)
run_options.add_argument(
'-J', '--job-option', action='append', metavar='OPT',
dest='job_options', default=[],
Expand Down
18 changes: 12 additions & 6 deletions unittests/test_schedulers.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from reframe.core.backends import (getlauncher, getscheduler)
from reframe.core.environments import Environment
from reframe.core.exceptions import (
ConfigError, JobError, JobNotStartedError, JobSchedulerError
ConfigError, JobError, JobNotStartedError, JobSchedulerError, SkipTestError
)
from reframe.core.schedulers import Job
from reframe.core.schedulers.slurm import _SlurmNode, _create_nodes
Expand Down Expand Up @@ -124,7 +124,7 @@ def fake_job(make_job):

def prepare_job(job, command='hostname',
pre_run=None, post_run=None,
prepare_cmds=None):
prepare_cmds=None, strict_flex=True):
environs = [Environment(name='foo', modules=['testmod_foo'])]
pre_run = pre_run or ['echo prerun']
post_run = post_run or ['echo postrun']
Expand All @@ -137,7 +137,8 @@ def prepare_job(job, command='hostname',
post_run
],
environs,
prepare_cmds
prepare_cmds,
strict_flex,
)


Expand Down Expand Up @@ -1146,11 +1147,16 @@ def test_flex_alloc_no_num_tasks_per_node(make_flexible_job):
assert job.num_tasks == 1


def test_flex_alloc_not_enough_idle_nodes(make_flexible_job):
@pytest.fixture(params=['skip', 'error'])
def strict_flex(request):
return request.param == 'error'


def test_flex_alloc_not_enough_idle_nodes(make_flexible_job, strict_flex):
job = make_flexible_job('idle')
job.num_tasks = -12
with pytest.raises(JobError):
prepare_job(job)
with pytest.raises(JobError if strict_flex else SkipTestError):
prepare_job(job, strict_flex=strict_flex)


def test_flex_alloc_maintenance_nodes(make_flexible_job):
Expand Down

0 comments on commit 2258c94

Please sign in to comment.