You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/advanced.rst
+57Lines changed: 57 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -448,3 +448,60 @@ Here is how the new deferred attribute is defined:
448
448
449
449
The behavior of the flexible task allocation is controlled by the ``--flex-alloc-tasks`` command line option.
450
450
See the corresponding `section <running.html#controlling-the-flexible-task-allocation>`__ for more information.
451
+
452
+
453
+
Testing containerized applications
454
+
----------------------------------
455
+
456
+
.. versionadded:: 2.20
457
+
458
+
459
+
ReFrame can be used also to test applications that run inside a container.
460
+
A container-based test can be written as :class:`RunOnlyRegressionTest <reframe.core.pipeline.RunOnlyRegressionTest>` that sets the :attr:`container_platform <reframe.core.pipeline.RegressionTest.container_platform>`.
461
+
The following example shows a simple test that runs some basic commands inside an Ubuntu 18.04 container and checks that the test has indeed run inside the container and that the stage directory was correctly mounted:
This attribute accepts a string that corresponds to the name of the platform and it instantiates the appropriate :class:`ContainerPlatform <reframe.core.containers.ContainerPlatform>` object behind the scenes.
471
+
In this case, the test will be using `Singularity <https://sylabs.io>`__ as a container platform.
472
+
If such a platform is not configured for the current system, the test will fail.
473
+
For a complete list of supported container platforms, the user is referred to the `configuration documentation <configure.html#partition-configuration>`__.
474
+
475
+
As soon as the container platform to be used is defined, you need to specify the container image to use and the commands to run inside the container:
These two attributes are mandatory for container-based check.
481
+
The :attr:`image <reframe.core.pipeline.RegressionTest.container_platform.image>` attribute specifies the name of an image from a registry, whereas the :attr:`commands <reframe.core.pipeline.RegressionTest.container_platform.commands>` attribute provides the list of commands to be run inside the container.
482
+
It is important to note that the :attr:`executable <reframe.core.pipeline.RegressionTest.executable>` and :attr:`executable_opts <reframe.core.pipeline.RegressionTest.executable_opts>` attributes of the :class:`RegressionTest <reframe.core.pipeline.RegressionTest>` are ignored in case of container-based tests.
483
+
484
+
In the above example, ReFrame will run the container as follows:
By default ReFrame will mount the stage directory of the test under ``/rfm_workdir`` inside the container and it will always prepend a ``cd`` command to that directory.
491
+
The user commands then are then run from that directory one after the other.
492
+
Once the commands are executed, the container is stopped and ReFrame goes on with the sanity and/or performance checks.
493
+
494
+
Users may also change the default mount point of the stage directory by using :attr:`workdir <reframe.core.pipeline.RegressionTest.container_platform.workdir>` attribute:
Besides the stage directory, additional mount points can be specified through the :attr:`mount_points <reframe.core.pipeline.RegressionTest.container_platform.mount_points>` attribute:
For a complete list of the available attributes of a specific container platform, the reader is referred to `reference guide <reference.html#container-platforms>`__.
Copy file name to clipboardExpand all lines: docs/configure.rst
+37Lines changed: 37 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,6 +43,11 @@ The following example shows a minimal configuration for the `Piz Daint <https://
43
43
'access': ['--constraint=gpu'],
44
44
'environs': ['PrgEnv-cray', 'PrgEnv-gnu',
45
45
'PrgEnv-intel', 'PrgEnv-pgi'],
46
+
'container_platforms': {
47
+
'Singularity': {
48
+
'modules': ['Singularity']
49
+
}
50
+
},
46
51
'descr': 'Hybrid nodes (Haswell/P100)',
47
52
'max_jobs': 100
48
53
},
@@ -53,6 +58,11 @@ The following example shows a minimal configuration for the `Piz Daint <https://
53
58
'access': ['--constraint=mc'],
54
59
'environs': ['PrgEnv-cray', 'PrgEnv-gnu',
55
60
'PrgEnv-intel', 'PrgEnv-pgi'],
61
+
'container_platforms': {
62
+
'Singularity': {
63
+
'modules': ['Singularity']
64
+
}
65
+
},
56
66
'descr': 'Multicore nodes (Broadwell)',
57
67
'max_jobs': 100
58
68
}
@@ -150,6 +160,33 @@ The available partition attributes are the following:
150
160
* ``environs``: A list of environments, with which ReFrame will try to run any regression tests written for this partition (default ``[]``).
151
161
The environment names must be resolved inside the ``environments`` section of the ``site_configuration`` dictionary (see `Environments Configuration <#environments-configuration>`__ for more information).
152
162
163
+
* ``container_platforms``: *[new in 2.20]* A set of key/value pairs specifying the supported container platforms for this partition and how their environment is set up.
164
+
Supported platform names are the following (names are case sensitive):
165
+
166
+
- ``Docker``: The `Docker <https://www.docker.com/>`__ container runtime.
167
+
- ``Singularity``: The `Singularity <https://sylabs.io/>`__ container runtime.
168
+
- ``Sarus``: The `Sarus <https://sarus.readthedocs.io>`__ container runtime.
169
+
170
+
Each configured container runtime is associated optionally with an environment (modules and environment variables) that is providing it.
171
+
This environment is specified as a dictionary in the following format:
If no special environment arrangement is needed for a configured container platform, you can simply specify an empty dictionary as an environment configuration, as it is shown in the following example:
182
+
183
+
.. code:: python
184
+
185
+
'container_platforms': {
186
+
'Docker': {}
187
+
}
188
+
189
+
153
190
* ``modules``: A list of modules to be loaded before running a regression test on that partition (default ``[]``).
154
191
155
192
* ``variables``: A set of environment variables to be set before running a regression test on that partition (default ``{}``).
Copy file name to clipboardExpand all lines: docs/reference.rst
+16Lines changed: 16 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -137,3 +137,19 @@ It is up to the concrete build system implementations on how to use or not these
137
137
:members:
138
138
:exclude-members: BuildSystemField
139
139
:show-inheritance:
140
+
141
+
142
+
Container platforms
143
+
-------------------
144
+
145
+
.. versionadded:: 2.20
146
+
147
+
ReFrame can run a regression test inside a container.
148
+
To achieve that you have to set the :attr:`reframe.core.pipeline.RegressionTest.container_platform` attribute and then set up the container platform (e.g., image to load, commands to execute).
149
+
The :class:`reframe.core.ContainerPlatform` abstract base class define the basic interface and a minimal set of attributes that all concrete container platforms must implement.
150
+
Concrete container platforms may also define additional fields that are specific to them.
0 commit comments