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
This PR reworks the tool-suites container support.
The main changes are:
* Base images are now separated into stages. This allows rebuilding only certain stages.
* vara-container build has additional flags for updating only varats, the research tool, or the config.
* Installing research tools into a container is handled by a new protocol
* vara-container prepare-slurm has been removed. Its functionality is now handled by vara-run. As a side-effect, this does no longer require persistent changes to the benchbuild config.
* node_dir cleanup in the slurm script template has (hopefully) been fixed
* Container-related config has been updated.
* Python 3.10 in the Debian 10 base image
Copy file name to clipboardexpand all lines: docs/source/tutorials/container_guide.rst
+14-11
Original file line number
Diff line number
Diff line change
@@ -3,8 +3,16 @@ Container Guide
3
3
4
4
VaRA-TS supports running experiments inside containers to make them more portable and reproducible.
5
5
This guide walks you through the steps how to prepare and execute experiments in containers and assumes that your system has already been set up for executing containers.
6
-
You can find the instructions for setting up containers on your system :ref:`here <Running BenchBuild in a Container>`.
7
-
More details about the inner workings of the container support in VaRA-TS can be found :ref:`here <Container support>`.
6
+
For additional resources, see the following pages:
7
+
8
+
- :ref:`Running BenchBuild in a Container` explains how to initially set up containers on your system and how they work with BenchBuild under the hood.
9
+
- :ref:`Container support` explains how VaRA-TS creates and manages reusable base images that can be used by projects.
10
+
- :ref:`vara-container` is the tool that is used for managing these base images.
11
+
- :ref:`Using Containers` explains how container support can be implemented for a project.
12
+
- :ref:`Slurm and Container` demonstrates the container support integration with slurm.
13
+
14
+
15
+
8
16
Note that, by default, the most recent version of VaRA-TS available from PyPI will be used inside the container.
9
17
If you want to use your local development version of VaRA-TS instead, you have to specify this in the ``.varats.yml`` configuration file by setting the value of ``from_source`` to true and the value of ``varats_source`` to the directory containing the source code of the VaRA-TS.
10
18
@@ -18,11 +26,12 @@ If you want to use your local development version of VaRA-TS instead, you have t
18
26
vara-buildsetup build vara --container=DEBIAN_10
19
27
20
28
Note that the underlying tools may not support network file systems (i.e., if you are using podman in `rootless mode <https://github.com/containers/podman/blob/master/rootless.md>`_).
21
-
In the ``.benchbuild.yml`` configuration, you need to set the values of ``root`` and ``runroot`` to a directory that is locally available on the current machine.
29
+
In the ``.benchbuild.yml`` configuration, you need to set the values of ``container/root`` and ``container/runroot`` to a directory that is locally available on the current machine.
Copy file name to clipboardexpand all lines: docs/source/vara-ts-api/containers.rst
+16-7
Original file line number
Diff line number
Diff line change
@@ -1,24 +1,29 @@
1
1
Container support
2
2
=================
3
3
4
-
BenchBuild allows you to :ref:`run experiments in a container <Running BenchBuild in a container>`.
5
-
The `containers` module handles the correct creation of container images.
6
-
Our containers are structured in layers as follows::
4
+
VaRA-TS allows you to :ref:`run experiments in a container <Container Guide>`.
5
+
The ``containers`` module handles the correct creation of container images.
6
+
Our container images are structured in multiple stages as follows::
7
7
8
8
┌───────────────────────────────────┐ \
9
+
│ Stage 00 │ |
9
10
│ Base Container (e.g., Debian 10) │ |
11
+
│ + dependencies │ |
10
12
└───────────────────────────────────┘ |
11
13
+ |
12
14
┌───────────────────────────────────┐ |
13
-
│ varats │ |
15
+
│ Stage 10 │ |
16
+
│ varats/benchbuild │ |
14
17
└───────────────────────────────────┘ |
15
18
+ > Base Image
16
19
┌───────────────────────────────────┐ |
17
-
│ benchbuild │ |
20
+
│ Stage 20 │ |
21
+
│ Research Tool (e.g., VaRA) │ |
18
22
└───────────────────────────────────┘ |
19
23
+ |
20
24
┌───────────────────────────────────┐ |
21
-
│ Research Tool (e.g., VaRA) │ |
25
+
│ Stage 30 │ |
26
+
│ configuration │ |
22
27
└───────────────────────────────────┘ /
23
28
+
24
29
┌───────────────────────────────────┐
@@ -30,6 +35,10 @@ Our containers are structured in layers as follows::
30
35
└───────────────────────────────────┘
31
36
32
37
38
+
Each stage results in its own container image.
39
+
This allows us to update only some of the stages to save time when only changes to certain stages are required (especially stage 00 can be very time consuming to build).
40
+
The :ref:`vara-container` tool provides appropriate command line flags to only re-build certain stages.
41
+
33
42
Base images are built once for each :class:`~varats.containers.containers.ImageBase` with the currently configured research tool using the :ref:`vara-container` tool.
34
43
Projects must :ref:`select one of these base images <Using Containers>` which they are then free to extend with their own project-specific dependencies.
35
44
The directory structure inside a container looks like the following::
@@ -41,7 +50,7 @@ The directory structure inside a container looks like the following::
41
50
├─ BC_files/ # mount point to <varats-root>/benchbuild/BC_files outside the container
42
51
└─ paper_configs/ # mount point to <varats-root>/paper_configs outside the container
43
52
44
-
See :ref:`Running BenchBuild in a container` for how to set up the mount points.
53
+
The required mount points are specified automatically when creating a BenchBuild config via :ref:`vara-gen-bbconfig`.
This command changes the location where container images are built and stored in the BenchBuild config.
38
-
That means that all subsequent container images will reside in that directory including the base images that are built by this command.
39
-
This also means, that the ``--node_dir`` option you pass to this command must be a path that can be created on both, the machine where this command is executed and on the slurm nodes.
40
-
In general, it is a good idea to use some subdirectory of ``/tmp`` here, although that means that images and containers may be lost after a reboot.
Copy file name to clipboardexpand all lines: docs/source/vara-ts/benchbuild.rst
+4-4
Original file line number
Diff line number
Diff line change
@@ -189,10 +189,10 @@ Using buildah and podman on the Commandline
189
189
...........................................
190
190
191
191
For more advanced users, it might be useful to work with buildah and podman directly from the commandline, e.g., when debugging container images.
192
-
In these situations, it can come in handy to create some shell aliases that set the correct `root` and `runroot` to for the buildah and podman commands::
192
+
In these situations, it can come in handy to create some shell aliases that set the correct `root` and `runroot` to for the buildah and podman commands, as well as the `storage_driver` that is set in BenchBuild's config file::
193
193
194
-
alias bbuildah='buildah --root $VARATS_ROOT/containers/lib --runroot $VARATS_ROOT/containers/run'
195
-
alias bpodman='podman --root $VARATS_ROOT/containers/lib --runroot $VARATS_ROOT/containers/run'
194
+
alias bbuildah='buildah --root $VARATS_ROOT/containers/lib --runroot $VARATS_ROOT/containers/run --storage-driver=vfs'
195
+
alias bpodman='podman --root $VARATS_ROOT/containers/lib --runroot $VARATS_ROOT/containers/run --storage-driver=vfs'
196
196
197
197
198
198
Debugging Container Images
@@ -226,7 +226,7 @@ As an alternative, you can also mount the file system of a container image by fo
226
226
227
227
.. code-block:: bash
228
228
229
-
newontainer=$(bbuildah from <image_id>)
229
+
newcontainer=$(bbuildah from <image_id>)
230
230
231
231
This command will print a container id.
232
232
4. Mount the working container (identified by the id you got from the step before) with
Copy file name to clipboardexpand all lines: docs/source/vara-ts/slurm.rst
+21-33
Original file line number
Diff line number
Diff line change
@@ -108,52 +108,42 @@ If you understand how BenchBuild uses containers to run experiments you can prep
108
108
109
109
1. Set up VaRA-TS as described in the normal :ref:`slurm guide <Running with Slurm>` (steps 1 and 2).
110
110
111
-
2. Set up the BenchBuild container support as described in the :ref:`BenchBuild container documentation <Running BenchBuild in a Container>`.
111
+
2. Make sure that the host systems (from where slurm jobs are submitted), as well as the slurm cluster has rootless buildah and podman installed and configured (don't forget the subuid and subgid mappings for the users submitting the slurm jobs).
112
+
See :ref:`Running BenchBuild in a Container` for further instructions.
112
113
113
-
3. Make sure that also the slurm cluster has rootless buildah and podman installed and configured (don't forget the subuid and subgid mappings for the users submitting the slurm jobs).
114
+
3. Prepare the research tool(s) and base images (see the :ref:`container guide<Container Guide>`).
115
+
Use the ``--export`` flag when generating the base images to make them available to the containers running via slurm.
114
116
115
-
4. Preparing the research tool(s) for each base container required by your experiments, e.g.:
116
-
117
-
.. code-block:: console
118
-
119
-
vara-buildsetup build vara --container=DEBIAN_10
120
-
121
-
5. Rootless containers do not work on NFS (see `here <https://github.com/containers/podman/blob/master/rootless.md>`_), so we have to take some extra steps if we want to run containers via slurm.
122
-
These steps can be executed easily using the following command (:ref:`documentation <vara-container>`):
123
-
124
-
.. code-block:: bash
125
-
126
-
vara-container prepare-slurm
127
-
128
-
This step also builds the base images.
129
-
130
-
If you want to know in detail what happens in this command, take a look at the section :ref:`Prepare-Slurm in Detail`.
131
-
132
-
6. After the preparation is complete, you can generate the slurm script as follows:
117
+
4. After the preparation is complete, you can generate the slurm script as follows:
7. That's it! the script obtained from the previous step can be used like any other slurm script.
123
+
5. That's it! the script obtained from the previous step can be used like any other slurm script.
139
124
You can now make any adjustments to the script if needed or just submit it to slurm as described in the slurm guide (step 5).
140
125
You can also add the flag ``--submit`` to the ``vara-run`` command to directly submit the script to slurm.
141
126
142
127
143
-
Prepare-Slurm in Detail
144
-
...........................
128
+
How vara-run handles rootless containers
129
+
........................................
130
+
131
+
.. note::
132
+
133
+
This section is mainly for documentation purposes and intended for advanced users and developers of VaRA-TS.
145
134
146
-
As explained above, rootless containers do not work on NFS (see `here <https://github.com/containers/podman/blob/master/rootless.md>`_), so we have to take some extra steps if we want to run containers via slurm.
147
-
The recommended way to do this is using the ``vara-container prepare-slurm`` command, but in some situations it might be handy to know what happens under the hood:
135
+
Rootless containers do not work on NFS (see `here <https://github.com/containers/podman/blob/master/rootless.md>`_), so we have to take some extra steps if we want to run containers via slurm.
136
+
These steps are handled automatically by ``vara-run`` but in some situations it might be handy to know what happens under the hood:
148
137
149
-
- You need to set the container root and runroot paths to some location that is not on a NFS, e.g., to a directory in ``tmp``:
138
+
- You need to set the container root and runroot paths to some location that is not on a NFS, e.g., to a directory in ``tmp``.
139
+
Since this may differ from your local setup, BenchBuild offers its own set of configuration options to set the buildah/podman root and runroot directories on slurm:
150
140
151
141
.. code-block:: yaml
152
142
153
-
container:
154
-
root:
143
+
slurm:
144
+
container_root:
155
145
value: /tmp/<username>/containers/lib
156
-
runroot:
146
+
container_runroot:
157
147
value: /tmp/<username>/containers/run
158
148
159
149
- BenchBuild allows to export and import container images.
@@ -192,14 +182,12 @@ The recommended way to do this is using the ``vara-container prepare-slurm`` com
192
182
193
183
- Now it is time to generate the slurm script (cf. step 5 of the slurm guide).
194
184
Because of our NFS workarounds, we cannot use the default script provided by BenchBuild, but we need to provide our own script template.
195
-
You can find our default template in the ``varats.tools`` module.
196
-
This template is very similar to the original template provided by BenchBuild, but it takes care of pointing all relevant environment variables to the slurm node directory as described in the points above.
185
+
You can find our default template in the ``varats.tools.templates`` module.
186
+
This template is very similar to the original template provided by BenchBuild, but it takes care of pointing all relevant environment variables to the slurm node directory as described in the points above and implements a different cleanup strategy for the node directory.
197
187
To activate the template, simply save it to the ``/scratch/<username>/varats/benchbuild`` directory and set the appropriate value in the BenchBuild config:
0 commit comments