From 37c559bb72867dd7a953db2b537c83869031a70a Mon Sep 17 00:00:00 2001 From: Vasileios Karakasis Date: Wed, 26 May 2021 00:10:24 +0200 Subject: [PATCH 1/2] Remove deprecated features in 4.x --- reframe/core/containers.py | 51 ------------------------------------ reframe/core/pipeline.py | 21 --------------- reframe/core/systems.py | 14 ---------- unittests/test_containers.py | 20 -------------- 4 files changed, 106 deletions(-) diff --git a/reframe/core/containers.py b/reframe/core/containers.py index a57d2ba63a..ac0097258d 100644 --- a/reframe/core/containers.py +++ b/reframe/core/containers.py @@ -38,21 +38,6 @@ class ContainerPlatform(abc.ABC): #: :default: :class:`None` command = fields.TypedField(str, type(None)) - _commands = fields.TypedField(typ.List[str]) - #: The commands to be executed within the container. - #: - #: .. deprecated:: 3.5.0 - #: Please use the `command` field instead. - #: - #: :type: :class:`list[str]` - #: :default: ``[]`` - commands = fields.DeprecatedField( - _commands, - 'The `commands` field is deprecated, please use the `command` field ' - 'to set the command to be executed by the container.', - fields.DeprecatedField.OP_SET, from_version='3.5.0' - ) - #: Pull the container image before running. #: #: This does not have any effect for the `Singularity` container platform. @@ -80,34 +65,10 @@ class ContainerPlatform(abc.ABC): #: :default: ``[]`` options = fields.TypedField(typ.List[str]) - _workdir = fields.TypedField(str, type(None)) - #: The working directory of ReFrame inside the container. - #: - #: This is the directory where the test's stage directory is mounted inside - #: the container. This directory is always mounted regardless if - #: :attr:`mount_points` is set or not. - #: - #: .. deprecated:: 3.5 - #: Please use the `options` field to set the working directory. - #: - #: :type: :class:`str` - #: :default: ``/rfm_workdir`` - workdir = fields.DeprecatedField( - _workdir, - 'The `workdir` field is deprecated, please use the `options` field to ' - 'set the container working directory', - fields.DeprecatedField.OP_SET, from_version='3.5.0' - ) - def __init__(self): self.image = None self.command = None - # NOTE: Here we set the target fields directly to avoid the deprecation - # warnings - self._commands = [] - self._workdir = _STAGEDIR_MOUNT - self.mount_points = [] self.options = [] self.pull_image = True @@ -171,10 +132,6 @@ def launch_command(self, stagedir): return (f'docker run --rm {" ".join(run_opts)} ' f'{self.image} {self.command}') - if self.commands: - return (f"docker run --rm {' '.join(run_opts)} {self.image} " - f"bash -c 'cd {self.workdir}; {'; '.join(self.commands)}'") - return f'docker run --rm {" ".join(run_opts)} {self.image}' @@ -216,10 +173,6 @@ def launch_command(self, stagedir): return (f'{self._command} run {" ".join(run_opts)} {self.image} ' f'{self.command}') - if self.commands: - return (f"{self._command} run {' '.join(run_opts)} {self.image} " - f"bash -c 'cd {self.workdir}; {'; '.join(self.commands)}'") - return f'{self._command} run {" ".join(run_opts)} {self.image}' @@ -262,10 +215,6 @@ def launch_command(self, stagedir): return (f'singularity exec {" ".join(run_opts)} ' f'{self.image} {self.command}') - if self.commands: - return (f"singularity exec {' '.join(run_opts)} {self.image} " - f"bash -c 'cd {self.workdir}; {'; '.join(self.commands)}'") - return f'singularity run {" ".join(run_opts)} {self.image}' diff --git a/reframe/core/pipeline.py b/reframe/core/pipeline.py index aeea2ce53a..d6fdcffe26 100644 --- a/reframe/core/pipeline.py +++ b/reframe/core/pipeline.py @@ -1434,17 +1434,6 @@ def run_complete(self): return self._job.finished() - @final - def poll(self): - '''See :func:`run_complete`. - - .. deprecated:: 3.2 - - ''' - user_deprecation_warning('calling poll() is deprecated; ' - 'please use run_complete() instead') - return self.run_complete() - @final def run_wait(self): '''Wait for the run phase of this test to finish. @@ -1465,16 +1454,6 @@ def run_wait(self): ''' self._job.wait() - @final - def wait(self): - '''See :func:`run_wait`. - - .. deprecated:: 3.2 - ''' - user_deprecation_warning('calling wait() is deprecated; ' - 'please use run_wait() instead') - self.run_wait() - @final def sanity(self): self.check_sanity() diff --git a/reframe/core/systems.py b/reframe/core/systems.py index 74d6521784..d8674e27af 100644 --- a/reframe/core/systems.py +++ b/reframe/core/systems.py @@ -346,20 +346,6 @@ def launcher_type(self): ''' return self._launcher_type - @property - def launcher(self): - '''See :attr:`launcher_type`. - - .. deprecated:: 3.2 - Please use :attr:`launcher_type` instead. - ''' - - from reframe.core.warnings import user_deprecation_warning - - user_deprecation_warning("the 'launcher' attribute is deprecated; " - "please use 'launcher_type' instead") - return self.launcher_type - def get_resource(self, name, **values): '''Instantiate managed resource ``name`` with ``value``. diff --git a/unittests/test_containers.py b/unittests/test_containers.py index 846bda0498..dfa90d6d8d 100644 --- a/unittests/test_containers.py +++ b/unittests/test_containers.py @@ -271,23 +271,3 @@ def expected_run_with_workdir(container_variant_noopt): elif container_variant_noopt == 'Singularity': return ("singularity exec -B\"/foo:/rfm_workdir\" --foo image:tag " "bash -c 'cd foodir; cmd1; cmd2'") - - -def test_run_with_commands(container_platform_noopt, - expected_run_with_commands): - with pytest.warns(warn.ReframeDeprecationWarning): - container_platform_noopt.commands = ['cmd1', 'cmd2'] - - found_commands = container_platform_noopt.launch_command('/foo') - assert found_commands == expected_run_with_commands - - -def test_run_with_workdir(container_platform_noopt, expected_run_with_workdir): - with pytest.warns(warn.ReframeDeprecationWarning): - container_platform_noopt.commands = ['cmd1', 'cmd2'] - - with pytest.warns(warn.ReframeDeprecationWarning): - container_platform_noopt.workdir = 'foodir' - - found_commands = container_platform_noopt.launch_command('/foo') - assert found_commands == expected_run_with_workdir From 1f28ca20a3868e6ea48eeb924d79273d52820988 Mon Sep 17 00:00:00 2001 From: Vasileios Karakasis Date: Wed, 26 May 2021 00:27:55 +0200 Subject: [PATCH 2/2] Remove unused imports --- unittests/test_containers.py | 1 - 1 file changed, 1 deletion(-) diff --git a/unittests/test_containers.py b/unittests/test_containers.py index dfa90d6d8d..b5ca53eb31 100644 --- a/unittests/test_containers.py +++ b/unittests/test_containers.py @@ -6,7 +6,6 @@ import pytest import reframe.core.containers as containers -import reframe.core.warnings as warn from reframe.core.exceptions import ContainerError