Skip to content

Commit 8de06d4

Browse files
author
Vasileios Karakasis
authored
Merge pull request #1860 from teojgo/bugfix/local_build_time
[feat] Add a `time_limit` partition configuration parameter and a `build_time_limit` variable for regression tests
2 parents 31f17f5 + df41e5e commit 8de06d4

File tree

5 files changed

+48
-7
lines changed

5 files changed

+48
-7
lines changed

config/cscs-ci.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
{
2525
'name': 'gpu',
2626
'scheduler': 'slurm',
27+
'time_limit': '10m',
2728
'access': [
2829
'--constraint=gpu',
2930
'--partition=cscsci',
@@ -58,6 +59,7 @@
5859
{
5960
'name': 'slurm',
6061
'scheduler': 'slurm',
62+
'time_limit': '10m',
6163
'access': [
6264
'--constraint=gpu',
6365
f'--account={osext.osgroup()}'
@@ -80,6 +82,7 @@
8082
{
8183
'name': 'pbs',
8284
'scheduler': 'pbs',
85+
'time_limit': '10m',
8386
'access': [
8487
'proc=gpu',
8588
f'-A {osext.osgroup()}'
@@ -94,6 +97,7 @@
9497
{
9598
'name': 'torque',
9699
'scheduler': 'torque',
100+
'time_limit': '10m',
97101
'access': [
98102
'-l proc=gpu',
99103
f'-A {osext.osgroup()}'

config/cscs.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@
182182
},
183183
{
184184
'name': 'gpu',
185+
'time_limit': '10m',
185186
'scheduler': 'slurm',
186187
'container_platforms': [
187188
{
@@ -230,6 +231,7 @@
230231
{
231232
'name': 'mc',
232233
'scheduler': 'slurm',
234+
'time_limit': '10m',
233235
'container_platforms': [
234236
{
235237
'type': 'Sarus',
@@ -348,6 +350,7 @@
348350
{
349351
'name': 'gpu',
350352
'scheduler': 'slurm',
353+
'time_limit': '10m',
351354
'container_platforms': [
352355
{
353356
'type': 'Sarus',
@@ -389,6 +392,7 @@
389392
{
390393
'name': 'mc',
391394
'scheduler': 'slurm',
395+
'time_limit': '10m',
392396
'container_platforms': [
393397
{
394398
'type': 'Sarus',

docs/config_reference.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,15 @@ System Partition Configuration
287287
A list of `environment module objects <#module-objects>`__ to be loaded before running a regression test on this partition.
288288

289289

290+
.. js:attribute:: .systems[].partitions[].time_limit
291+
292+
:required: No
293+
:default: ``null``
294+
295+
The time limit for the jobs submitted on this partition.
296+
When the value is ``null``, no time limit is applied.
297+
298+
290299
.. js:attribute:: .systems[].partitions[].variables
291300

292301
:required: No

reframe/core/pipeline.py

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -644,11 +644,11 @@ def pipeline_hooks(cls):
644644
#:
645645
#: Time limit is specified as a string in the form
646646
#: ``<days>d<hours>h<minutes>m<seconds>s`` or as number of seconds.
647-
#: If set to :class:`None`, no time limit will be set.
648-
#: The default time limit of the system partition's scheduler will be used.
647+
#: If set to :class:`None`, the |time_limit|_
648+
#: of the current system partition will be used.
649649
#:
650650
#: :type: :class:`str` or :class:`float` or :class:`int`
651-
#: :default: ``'10m'``
651+
#: :default: :class:`None`
652652
#:
653653
#: .. note::
654654
#: .. versionchanged:: 2.15
@@ -662,7 +662,25 @@ def pipeline_hooks(cls):
662662
#: - The old syntax using a ``(h, m, s)`` tuple is dropped.
663663
#: - Support of `timedelta` objects is dropped.
664664
#: - Number values are now accepted.
665-
time_limit = variable(type(None), field=fields.TimerField, value='10m')
665+
#:
666+
#: .. versionchanged:: 3.5.1
667+
#: The default value is now :class:`None` and it can be set globally
668+
#: per partition via the configuration.
669+
#:
670+
#: .. |time_limit| replace:: :attr:`time_limit`
671+
#: .. _time_limit: #.systems[].partitions[].time_limit
672+
time_limit = variable(type(None), field=fields.TimerField, value=None)
673+
674+
#: .. versionadded:: 3.5.1
675+
#:
676+
#: The time limit for the build job of the regression test.
677+
#:
678+
#: It is specified similarly to the :attr:`time_limit` attribute.
679+
#:
680+
#: :type: :class:`str` or :class:`float` or :class:`int`
681+
#: :default: :class:`None`
682+
build_time_limit = variable(type(None), field=fields.TimerField,
683+
value=None)
666684

667685
#: .. versionadded:: 2.8
668686
#:
@@ -1228,7 +1246,11 @@ def compile(self):
12281246
self.modules, self.variables.items())
12291247
environs = [self._current_partition.local_env, self._current_environ,
12301248
user_environ, self._cdt_environ]
1231-
1249+
self._build_job.time_limit = (
1250+
self.build_time_limit or rt.runtime().get_option(
1251+
f'systems/0/partitions/@{self.current_partition.name}'
1252+
f'/time_limit')
1253+
)
12321254
with osext.change_dir(self._stagedir):
12331255
# Prepare build job
12341256
build_commands = [
@@ -1328,8 +1350,9 @@ def run(self):
13281350
self.job.num_tasks_per_socket = self.num_tasks_per_socket
13291351
self.job.num_cpus_per_task = self.num_cpus_per_task
13301352
self.job.use_smt = self.use_multithreading
1331-
self.job.time_limit = self.time_limit
1332-
1353+
self.job.time_limit = (self.time_limit or rt.runtime().get_option(
1354+
f'systems/0/partitions/@{self.current_partition.name}/time_limit')
1355+
)
13331356
exec_cmd = [self.job.launcher.run_command(self.job),
13341357
self.executable, *self.executable_opts]
13351358
commands = [*self.prerun_cmds, ' '.join(exec_cmd), *self.postrun_cmds]

reframe/schemas/config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@
274274
}
275275
},
276276
"modules": {"$ref": "#/defs/modules_list"},
277+
"time_limit": {"type": ["string", "null"]},
277278
"variables": {"$ref": "#/defs/envvar_list"},
278279
"max_jobs": {"type": "number"},
279280
"prepare_cmds": {

0 commit comments

Comments
 (0)