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/software/container-engine/known-issue.md
+5-18Lines changed: 5 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -56,25 +56,12 @@ Defining a mount related to `/users` in the EDF should only be done when there i
56
56
[](){#ref-ce-why-no-sbatch-env}
57
57
## Why `--environment` as `#SBATCH` is discouraged
58
58
59
-
Due to how Slurm works, when using `--environment` as an `#SBATCH` option, the entire contents of the SBATCH script is executed within a container created by the EDF file.
60
-
This can lead to subtle and hard-to-diagnose failures, some of which are described below.
59
+
The use of `--environment` as `#SBATCH` is known to cause **unexpected behaviors** and is exclusively reserved for highly customized workflows. This is because `--environment` as `#SBATCH` puts the entire SBATCH script in a container from the EDF file. The following are a few known associated issues.
61
60
62
-
-**Slurm availability in the container**: In some cases, CE does not inject essential Slurm components in containers, which result in crashes on basic Slurm operations (e.g., `srun`) inside the SBATCH script. Even if they were injected, it's not guaranteed to cover the complete feature set of Slurm.
61
+
-**Slurm availability in a container**: Either Slurm components are not completely injected inside a container, or injected Slurm components do not function properly.
63
62
64
-
-**The execution context is not the host system**: Since the entire SBATCH script runs inside a container (shaped with EDF), all commands in the script are affected by the environment defined by EDF. This primarily includes filesystem mounts, where any directories not explicitly mounted in EDF are invisible to all commands inside the SBATCH script.
63
+
-**Non-host execution context**: Since the SBATCH script runs inside a container, most host resources are inaccessible by default unless EDFexplicitly exposes them. Affected resources include: filesystems, devices, system resources, container hooks, etc.
65
64
66
-
-**Nested use of `--environment`**: `--environment` in the SBATCH script _and_ for a `srun` command results in entering the EDF environment twice, causing unexpected errors due to double-entering containers.
65
+
-**Nested use of `--environment`**: running `srun --environment` in `#SBATCH --environment`results in double-entering EDF containers, causing unexpected errors in the underlying container runtime.
67
66
68
-
For these reasons, we encourage using `--environment` for each `srun` as shown below.
69
-
70
-
```bash
71
-
#!/bin/bash
72
-
#SBATCH --cpus-per-task=4
73
-
...
74
-
srun --environment=my_edf echo'this'
75
-
...
76
-
srun --environment=my_edf echo'that'
77
-
...
78
-
```
79
-
80
-
As the use of `--environment` as an `#SBATCH` option is reserved for highly customized workflows, users should have a high level of proficiency and a full understanding of the risk to encounter cryptic behaviors. Should users encounter a problem while using `--environment` as `#SBATCH`, it's recommended to move `--environment` from `#SBATCH` to each `srun` and see if the problem disappears.
67
+
To avoid any unexpected confusion, users are advised **not** to use `--environment` as `#SBATCH`. If users encounter a problem while using this, it's recommended to move `--environment` from `#SBATCH` to each `srun` and see if the problem disappears.
Copy file name to clipboardExpand all lines: docs/software/container-engine/run.md
+16-2Lines changed: 16 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,11 +34,25 @@ Use `--environment` with the Slurm command (e.g., `srun` or `salloc`):
34
34
#SBATCH --job-name=edf-example
35
35
#SBATCH --time=00:01:00
36
36
...
37
-
38
-
# Run job step
39
37
srun --environment=ubuntu cat /etc/os-release
40
38
```
41
39
40
+
Multiple Slurm commands may have different EDF environments; this is useful when a single environment is not feasible due to the compatibility issues between programs.
41
+
42
+
!!! example "`srun`s with different EDFs"
43
+
```bash
44
+
#!/bin/bash
45
+
#SBATCH --job-name=edf-example
46
+
#SBATCH --time=00:01:00
47
+
...
48
+
srun --environment=env1 ... # (1)!
49
+
...
50
+
srun --environment=env2 ... # (2)!
51
+
```
52
+
53
+
1. Assuming `env1.toml` is at `EDF_PATH`. See [EDF search path][ref-ce-edf-search-path] below.
54
+
2. Assuming `env2.toml` is at `EDF_PATH`. See [EDF search path][ref-ce-edf-search-path] below.
55
+
42
56
Specifying the `--environment` option with an `#SBATCH` option is **experimental**.
43
57
Such usage is discouraged as it may result in unexpected behaviors.
0 commit comments