Skip to content

Commit 11ad017

Browse files
authored
Merge pull request #6601 from grondo/env-doc-simplify
doc: reword initial program environment section in `flux-environment(7)`
2 parents fc051b9 + edd5d1c commit 11ad017

File tree

1 file changed

+32
-23
lines changed

1 file changed

+32
-23
lines changed

doc/man7/flux-environment.rst

Lines changed: 32 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -158,27 +158,27 @@ INITIAL PROGRAM ENVIRONMENT
158158
===========================
159159

160160
The :man1:`flux-alloc` interactive shell and the :man1:`flux-batch` batch
161-
script are examples of Flux initial programs. Flux does not set many
162-
environment variables for the initial program. In fact, the following
163-
are actively unset to avoid confusion when they are set by the *enclosing
164-
instance*:
165-
166-
- :envvar:`FLUX_JOB_ID`
167-
- :envvar:`FLUX_JOB_SIZE`
168-
- :envvar:`FLUX_JOB_NNODES`
169-
- :envvar:`FLUX_JOB_TMPDIR`
170-
- :envvar:`FLUX_TASK_RANK`
171-
- :envvar:`FLUX_TASK_LOCAL_ID`
172-
- :envvar:`FLUX_KVS_NAMESPACE`
173-
- :envvar:`FLUX_PROXY_REMOTE`
174-
- :envvar:`FLUX_PMI_LIBRARY_PATH`
175-
- :envvar:`I_MPI_PMI_LIBRARY`
176-
- :envvar:`PMI_*`
177-
- :envvar:`SLURM_*`
178-
179-
The :envvar:`FLUX_URI` variable is set, however, so Flux commands can be used
180-
as needed from the initial program to obtain information they might get via the
181-
environment in other workload managers, for example:
161+
script are examples of Flux initial programs. Flux deliberately avoids
162+
setting many environment variables for the initial program to ensure
163+
consistency and predictability across all methods of launching a Flux
164+
instance.
165+
166+
The initial program environment will have at least the following environment
167+
variables set:
168+
169+
.. envvar:: FLUX_URI
170+
171+
Allows Flux commands to connect to the enclosing instance (the instance
172+
that started the initial program)
173+
174+
.. envvar:: FLUX_ENCLOSING_ID
175+
176+
Set to the jobid of the enclosing instance, if it was launched as a Flux
177+
job.
178+
179+
If needed, Flux commands can be used to retrieve information that would
180+
typically be available from the environment in other workload managers. For
181+
example:
182182

183183
.. code-block:: shell
184184
@@ -187,8 +187,17 @@ environment in other workload managers, for example:
187187
BATCH_NGPUS=$(flux resource list -n -o {ngpus})
188188
BATCH_HOSTLIST=$(flux getattr hostlist)
189189
190-
Additionally, :envvar:`FLUX_ENCLOSING_ID` is set to the jobid of the
191-
enclosing instance, if it has one.
190+
The advantage of this approach is that it works consistently, regardless
191+
of how the Flux instance was launched.
192+
193+
The following set of environment variables are actively unset by the broker
194+
to avoid confusion when they are set by the enclosing instance or another
195+
resource manager: :envvar:`FLUX_JOB_ID`, :envvar:`FLUX_JOB_SIZE`,
196+
:envvar:`FLUX_JOB_NNODES`, :envvar:`FLUX_JOB_TMPDIR`,
197+
:envvar:`FLUX_TASK_RANK`, :envvar:`FLUX_TASK_LOCAL_ID`,
198+
:envvar:`FLUX_KVS_NAMESPACE`, :envvar:`FLUX_PROXY_REMOTE`,
199+
:envvar:`FLUX_PMI_LIBRARY_PATH`, :envvar:`I_MPI_PMI_LIBRARY`,
200+
:envvar:`PMI_*`, :envvar:`SLURM_*`
192201

193202
PMI CLIENT
194203
==========

0 commit comments

Comments
 (0)