From ab4e13d5c49e49a01d9992fa7ec4e760f7f06b42 Mon Sep 17 00:00:00 2001 From: Theofilos Manitaras Date: Thu, 11 Mar 2021 16:29:45 +0100 Subject: [PATCH 1/5] Pass the given 'time_limit' to the build job --- reframe/core/pipeline.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/reframe/core/pipeline.py b/reframe/core/pipeline.py index 5cd02efe0a..58e9f7eb9a 100644 --- a/reframe/core/pipeline.py +++ b/reframe/core/pipeline.py @@ -1211,6 +1211,10 @@ def compile(self): environs = [self._current_partition.local_env, self._current_environ, user_environ, self._cdt_environ] + # NOTE: Here we set the time_limit which should be taken into account + # in case the build job in not submitted locally. + self._build_job.time_limit = self.time_limit + with osext.change_dir(self._stagedir): # Prepare build job build_commands = [ From 1f65811292deb00b66f243a33ee058cf09f8091d Mon Sep 17 00:00:00 2001 From: Theofilos Manitaras Date: Mon, 15 Mar 2021 13:38:38 +0100 Subject: [PATCH 2/5] Support 'timelimit' in partition config * Add also the `build_time_limit` field. --- config/cscs.py | 4 ++++ docs/config_reference.rst | 8 +++++++ reframe/core/pipeline.py | 42 +++++++++++++++++++++++++++---------- reframe/schemas/config.json | 1 + 4 files changed, 44 insertions(+), 11 deletions(-) diff --git a/config/cscs.py b/config/cscs.py index 6ff3e5588d..ef154be571 100644 --- a/config/cscs.py +++ b/config/cscs.py @@ -182,6 +182,7 @@ }, { 'name': 'gpu', + 'timelimit': '10m', 'scheduler': 'slurm', 'container_platforms': [ { @@ -230,6 +231,7 @@ { 'name': 'mc', 'scheduler': 'slurm', + 'timelimit': '10m', 'container_platforms': [ { 'type': 'Sarus', @@ -348,6 +350,7 @@ { 'name': 'gpu', 'scheduler': 'slurm', + 'timelimit': '10m', 'container_platforms': [ { 'type': 'Sarus', @@ -389,6 +392,7 @@ { 'name': 'mc', 'scheduler': 'slurm', + 'timelimit': '10m', 'container_platforms': [ { 'type': 'Sarus', diff --git a/docs/config_reference.rst b/docs/config_reference.rst index b0b1ec5052..ecaa3d0fd3 100644 --- a/docs/config_reference.rst +++ b/docs/config_reference.rst @@ -287,6 +287,14 @@ System Partition Configuration A list of `environment module objects <#module-objects>`__ to be loaded before running a regression test on this partition. +.. js:attribute:: .systems[].partitions[].timelimit + + :required: No + :default: ``""`` + + The time limit for the jobs submitted on this partition. + + .. js:attribute:: .systems[].partitions[].variables :required: No diff --git a/reframe/core/pipeline.py b/reframe/core/pipeline.py index 58e9f7eb9a..a2542148f3 100644 --- a/reframe/core/pipeline.py +++ b/reframe/core/pipeline.py @@ -634,11 +634,12 @@ def pipeline_hooks(cls): #: #: Time limit is specified as a string in the form #: ``dhms`` or as number of seconds. - #: If set to :class:`None`, no time limit will be set. - #: The default time limit of the system partition's scheduler will be used. + #: If set to :class:`None`, the + #: `timelimit `__ + #: of a system partition will be used. #: #: :type: :class:`str` or :class:`float` or :class:`int` - #: :default: ``'10m'`` + #: :default: ``None`` #: #: .. note:: #: .. versionchanged:: 2.15 @@ -652,7 +653,24 @@ def pipeline_hooks(cls): #: - The old syntax using a ``(h, m, s)`` tuple is dropped. #: - Support of `timedelta` objects is dropped. #: - Number values are now accepted. - time_limit = variable(type(None), field=fields.TimerField, value='10m') + #: + #: .. versionchanged:: 3.6 + #: - The default value is now :class:`None`. + #: - Can be now set per partition via the configuration. + time_limit = variable(type(None), field=fields.TimerField, value=None) + + + #: .. versionadded:: 3.6 + #: + #: The time limit for the build phase of the regression test. + #: + #: It is specified similarly to the :attr:`time_limit` attribute. + #: + #: :type: :class:`str` or :class:`float` or :class:`int` + #: :default: ``None`` + build_time_limit = variable(type(None), field=fields.TimerField, + value=None) + #: .. versionadded:: 2.8 #: @@ -1210,11 +1228,11 @@ def compile(self): self.modules, self.variables.items()) environs = [self._current_partition.local_env, self._current_environ, user_environ, self._cdt_environ] - - # NOTE: Here we set the time_limit which should be taken into account - # in case the build job in not submitted locally. - self._build_job.time_limit = self.time_limit - + self._build_job.time_limit = ( + self.build_time_limit or rt.runtime().get_option( + f'systems/@{self.current_system.name}/partitions/' + f'@{self.current_partition.name}/timelimit') + ) with osext.change_dir(self._stagedir): # Prepare build job build_commands = [ @@ -1314,8 +1332,10 @@ def run(self): self.job.num_tasks_per_socket = self.num_tasks_per_socket self.job.num_cpus_per_task = self.num_cpus_per_task self.job.use_smt = self.use_multithreading - self.job.time_limit = self.time_limit - + self.job.time_limit = (self.time_limit or rt.runtime().get_option( + f'systems/@{self.current_system.name}/partitions/' + f'@{self.current_partition.name}/timelimit') + ) exec_cmd = [self.job.launcher.run_command(self.job), self.executable, *self.executable_opts] commands = [*self.prerun_cmds, ' '.join(exec_cmd), *self.postrun_cmds] diff --git a/reframe/schemas/config.json b/reframe/schemas/config.json index 5c1e2c9986..f1d918a4e3 100644 --- a/reframe/schemas/config.json +++ b/reframe/schemas/config.json @@ -274,6 +274,7 @@ } }, "modules": {"$ref": "#/defs/modules_list"}, + "timelimit": {"type": "string"}, "variables": {"$ref": "#/defs/envvar_list"}, "max_jobs": {"type": "number"}, "prepare_cmds": { From 001630e34c700085516c3ae7ef08090351dccddd Mon Sep 17 00:00:00 2001 From: Theofilos Manitaras Date: Mon, 15 Mar 2021 13:42:00 +0100 Subject: [PATCH 3/5] PEP8 fix --- reframe/core/pipeline.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/reframe/core/pipeline.py b/reframe/core/pipeline.py index a2542148f3..20a9d54ef3 100644 --- a/reframe/core/pipeline.py +++ b/reframe/core/pipeline.py @@ -659,7 +659,6 @@ def pipeline_hooks(cls): #: - Can be now set per partition via the configuration. time_limit = variable(type(None), field=fields.TimerField, value=None) - #: .. versionadded:: 3.6 #: #: The time limit for the build phase of the regression test. @@ -1333,8 +1332,8 @@ def run(self): self.job.num_cpus_per_task = self.num_cpus_per_task self.job.use_smt = self.use_multithreading self.job.time_limit = (self.time_limit or rt.runtime().get_option( - f'systems/@{self.current_system.name}/partitions/' - f'@{self.current_partition.name}/timelimit') + f'systems/@{self.current_system.name}/partitions/' + f'@{self.current_partition.name}/timelimit') ) exec_cmd = [self.job.launcher.run_command(self.job), self.executable, *self.executable_opts] From a05e53d0721bda1b38f4e579c4d6542e3e40606c Mon Sep 17 00:00:00 2001 From: Theofilos Manitaras Date: Tue, 16 Mar 2021 16:57:17 +0100 Subject: [PATCH 4/5] Address PR comments --- config/cscs-ci.py | 4 ++++ config/cscs.py | 8 ++++---- docs/config_reference.rst | 5 +++-- reframe/core/pipeline.py | 15 +++++++-------- reframe/schemas/config.json | 2 +- 5 files changed, 19 insertions(+), 15 deletions(-) diff --git a/config/cscs-ci.py b/config/cscs-ci.py index ef48ea7539..9e7d6c8c8d 100644 --- a/config/cscs-ci.py +++ b/config/cscs-ci.py @@ -24,6 +24,7 @@ { 'name': 'gpu', 'scheduler': 'slurm', + 'time_limit': '10m', 'access': [ '--constraint=gpu', '--partition=cscsci', @@ -58,6 +59,7 @@ { 'name': 'slurm', 'scheduler': 'slurm', + 'time_limit': '10m', 'access': [ '--constraint=gpu', f'--account={osext.osgroup()}' @@ -80,6 +82,7 @@ { 'name': 'pbs', 'scheduler': 'pbs', + 'time_limit': '10m', 'access': [ 'proc=gpu', f'-A {osext.osgroup()}' @@ -94,6 +97,7 @@ { 'name': 'torque', 'scheduler': 'torque', + 'time_limit': '10m', 'access': [ '-l proc=gpu', f'-A {osext.osgroup()}' diff --git a/config/cscs.py b/config/cscs.py index ef154be571..b9b250b102 100644 --- a/config/cscs.py +++ b/config/cscs.py @@ -182,7 +182,7 @@ }, { 'name': 'gpu', - 'timelimit': '10m', + 'time_limit': '10m', 'scheduler': 'slurm', 'container_platforms': [ { @@ -231,7 +231,7 @@ { 'name': 'mc', 'scheduler': 'slurm', - 'timelimit': '10m', + 'time_limit': '10m', 'container_platforms': [ { 'type': 'Sarus', @@ -350,7 +350,7 @@ { 'name': 'gpu', 'scheduler': 'slurm', - 'timelimit': '10m', + 'time_limit': '10m', 'container_platforms': [ { 'type': 'Sarus', @@ -392,7 +392,7 @@ { 'name': 'mc', 'scheduler': 'slurm', - 'timelimit': '10m', + 'time_limit': '10m', 'container_platforms': [ { 'type': 'Sarus', diff --git a/docs/config_reference.rst b/docs/config_reference.rst index ecaa3d0fd3..2651f80481 100644 --- a/docs/config_reference.rst +++ b/docs/config_reference.rst @@ -287,12 +287,13 @@ System Partition Configuration A list of `environment module objects <#module-objects>`__ to be loaded before running a regression test on this partition. -.. js:attribute:: .systems[].partitions[].timelimit +.. js:attribute:: .systems[].partitions[].time_limit :required: No - :default: ``""`` + :default: ``null`` The time limit for the jobs submitted on this partition. + When the value is ``null``, no time limit is applied. .. js:attribute:: .systems[].partitions[].variables diff --git a/reframe/core/pipeline.py b/reframe/core/pipeline.py index 20a9d54ef3..06cee97275 100644 --- a/reframe/core/pipeline.py +++ b/reframe/core/pipeline.py @@ -635,7 +635,7 @@ def pipeline_hooks(cls): #: Time limit is specified as a string in the form #: ``dhms`` or as number of seconds. #: If set to :class:`None`, the - #: `timelimit `__ + #: `time_limit `__ #: of a system partition will be used. #: #: :type: :class:`str` or :class:`float` or :class:`int` @@ -654,14 +654,14 @@ def pipeline_hooks(cls): #: - Support of `timedelta` objects is dropped. #: - Number values are now accepted. #: - #: .. versionchanged:: 3.6 + #: .. versionchanged:: 3.5.1 #: - The default value is now :class:`None`. #: - Can be now set per partition via the configuration. time_limit = variable(type(None), field=fields.TimerField, value=None) - #: .. versionadded:: 3.6 + #: .. versionadded:: 3.5.1 #: - #: The time limit for the build phase of the regression test. + #: The time limit for the build job of the regression test. #: #: It is specified similarly to the :attr:`time_limit` attribute. #: @@ -1229,8 +1229,8 @@ def compile(self): user_environ, self._cdt_environ] self._build_job.time_limit = ( self.build_time_limit or rt.runtime().get_option( - f'systems/@{self.current_system.name}/partitions/' - f'@{self.current_partition.name}/timelimit') + f'systems/0/partitions/@{self.current_partition.name}' + f'/time_limit') ) with osext.change_dir(self._stagedir): # Prepare build job @@ -1332,8 +1332,7 @@ def run(self): self.job.num_cpus_per_task = self.num_cpus_per_task self.job.use_smt = self.use_multithreading self.job.time_limit = (self.time_limit or rt.runtime().get_option( - f'systems/@{self.current_system.name}/partitions/' - f'@{self.current_partition.name}/timelimit') + f'systems/0/partitions/@{self.current_partition.name}/time_limit') ) exec_cmd = [self.job.launcher.run_command(self.job), self.executable, *self.executable_opts] diff --git a/reframe/schemas/config.json b/reframe/schemas/config.json index f1d918a4e3..1d5b143b1c 100644 --- a/reframe/schemas/config.json +++ b/reframe/schemas/config.json @@ -274,7 +274,7 @@ } }, "modules": {"$ref": "#/defs/modules_list"}, - "timelimit": {"type": "string"}, + "time_limit": {"type": ["string", "null"]}, "variables": {"$ref": "#/defs/envvar_list"}, "max_jobs": {"type": "number"}, "prepare_cmds": { From 58feda1a45cff2a1738961b6efa07f27c5f1155e Mon Sep 17 00:00:00 2001 From: Vasileios Karakasis Date: Tue, 16 Mar 2021 19:30:04 +0100 Subject: [PATCH 5/5] Documentation formatting fixes --- reframe/core/pipeline.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/reframe/core/pipeline.py b/reframe/core/pipeline.py index 06cee97275..d2fc3c7119 100644 --- a/reframe/core/pipeline.py +++ b/reframe/core/pipeline.py @@ -634,12 +634,11 @@ def pipeline_hooks(cls): #: #: Time limit is specified as a string in the form #: ``dhms`` or as number of seconds. - #: If set to :class:`None`, the - #: `time_limit `__ - #: of a system partition will be used. + #: If set to :class:`None`, the |time_limit|_ + #: of the current system partition will be used. #: #: :type: :class:`str` or :class:`float` or :class:`int` - #: :default: ``None`` + #: :default: :class:`None` #: #: .. note:: #: .. versionchanged:: 2.15 @@ -655,8 +654,11 @@ def pipeline_hooks(cls): #: - Number values are now accepted. #: #: .. versionchanged:: 3.5.1 - #: - The default value is now :class:`None`. - #: - Can be now set per partition via the configuration. + #: The default value is now :class:`None` and it can be set globally + #: per partition via the configuration. + #: + #: .. |time_limit| replace:: :attr:`time_limit` + #: .. _time_limit: #.systems[].partitions[].time_limit time_limit = variable(type(None), field=fields.TimerField, value=None) #: .. versionadded:: 3.5.1 @@ -666,11 +668,10 @@ def pipeline_hooks(cls): #: It is specified similarly to the :attr:`time_limit` attribute. #: #: :type: :class:`str` or :class:`float` or :class:`int` - #: :default: ``None`` + #: :default: :class:`None` build_time_limit = variable(type(None), field=fields.TimerField, value=None) - #: .. versionadded:: 2.8 #: #: Extra resources for this test.