|
1 | 1 | ## Running containerized environments |
2 | 2 |
|
3 | | -Specifying the `--environment` option to the Slurm command (e.g., `srun` or `salloc`) will make it run inside the EDF environment: |
| 3 | +Specifying the `--environment` option to the Slurm command (e.g., `srun` or `salloc`) will make it run inside the EDF environment. |
| 4 | +There are three ways to do so: |
4 | 5 |
|
5 | | -```console |
6 | | -$ srun --environment=$SCRATCH/edf/debian.toml cat /etc/os-release |
7 | | -``` |
| 6 | + 1. **Through an absolute path**: providing an absolute path to EDF. |
8 | 7 |
|
9 | | -`--environment` can be a relative path from the current working directory (i.e., where the Slurm command is executed). |
10 | | -A relative path should be prepended by `./`: |
11 | | - |
12 | | -```console |
13 | | -$ srun --environment=./debian.toml cat /etc/os-release # (1) |
14 | | -``` |
| 8 | + ```console |
| 9 | + $ srun --environment=$SCRATCH/edf/debian.toml cat /etc/os-release |
| 10 | + ``` |
15 | 11 |
|
16 | | -1. Assuming `debian.toml` is in the current folder. |
| 12 | + 2. **Through a relative path**: providing a relative path to EDF. The path is from the current working directory (i.e., where the Slurm command is executed). Should be prepended by `./`. |
17 | 13 |
|
18 | | -If an EDF is located in the [EDF search path][ref-ce-edf-search-path], `--environment` also accepts the EDF filename without the `.toml` extension: |
| 14 | + ```console |
| 15 | + $ srun --environment=./debian.toml cat /etc/os-release # (1) |
| 16 | + ``` |
| 17 | + 1. Assuming `debian.toml` is in the current folder. |
19 | 18 |
|
20 | | -```console |
21 | | -$ srun --environment=debian cat /etc/os-release # (1) |
22 | | -``` |
| 19 | + 3. **From EDF search paths**: providing the name of EDF in [EDF search path][ref-ce-edf-search-path]. `--environment` also accepts the EDF filename without the `.toml` extension: |
23 | 20 |
|
24 | | -1. Assuming `debian.toml` is in the EDF search path. |
| 21 | + ```console |
| 22 | + $ srun --environment=debian cat /etc/os-release # (1) |
| 23 | + ``` |
| 24 | + 1. Assuming `debian.toml` is in the EDF search path. |
25 | 25 |
|
26 | 26 | ### Use from batch scripts |
27 | 27 |
|
28 | 28 | The recommended approach is to use `--environment` as part of the Slurm command (e.g., `srun` or `salloc`): |
29 | 29 |
|
30 | 30 | !!! example "`srun` inside a batch script with EDF" |
31 | | - ```console |
| 31 | + ```bash |
32 | 32 | #!/bin/bash |
33 | 33 | #SBATCH --job-name=edf-example |
34 | 34 | #SBATCH --time=00:01:00 |
|
0 commit comments