Skip to content

Commit a66aa37

Browse files
committed
doc: add flux-hostlist(1)
Problem: There is no documentation for flux-hostlist(1) Add a new manual page for this command. Update spelling dictionary.
1 parent 9daacaa commit a66aa37

File tree

4 files changed

+225
-1
lines changed

4 files changed

+225
-1
lines changed

doc/Makefile.am

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ MAN1_FILES_PRIMARY = \
5454
man1/flux-pgrep.1 \
5555
man1/flux-cancel.1 \
5656
man1/flux-watch.1 \
57-
man1/flux-update.1
57+
man1/flux-update.1 \
58+
man1/flux-hostlist.1
5859

5960
# These files are generated as clones of a primary page.
6061
# Sphinx handles this automatically if declared in the conf.py

doc/man1/flux-hostlist.rst

Lines changed: 219 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,219 @@
1+
.. flux-help-section: other
2+
3+
================
4+
flux-hostlist(1)
5+
================
6+
7+
SYNOPSIS
8+
========
9+
10+
**flux** **hostlist** [*OPTIONS*] [*SOURCES*]
11+
12+
DESCRIPTION
13+
===========
14+
15+
.. program:: flux hostlist
16+
17+
:program:`flux hostlist` takes zero or more *SOURCES* of host lists on the
18+
command line and concatenates them by default into a single RFC 29 Hostlist.
19+
20+
*SOURCES* can optionally be combined by various set operations, for example
21+
to find the intersection, difference, or to subtract hostlists.
22+
23+
SOURCES
24+
=======
25+
26+
Valid *SOURCES* of hostlist information include:
27+
28+
instance
29+
hosts from the broker ``hostlist`` attribute
30+
31+
jobid
32+
hosts assigned to a job.
33+
34+
local
35+
*jobid* from ``FLUX_JOB_ID`` environment variable if set, otherwise
36+
*instance*
37+
38+
avail[able]
39+
*instance* hostlist minus those nodes down or drained
40+
41+
stdin or ``-``
42+
read a list of hosts on stdin
43+
44+
hosts
45+
a literal RFC 29 Hostlist
46+
47+
The default source is *local*.
48+
49+
OPTIONS
50+
=======
51+
52+
.. option:: -e, --expand
53+
54+
Expand hostlist result using the defined output delimiter. Default is
55+
space-delimited.
56+
57+
.. option:: -d, --delimiter=S
58+
59+
Set the delimiter for :option:`--expand` to string *S*.
60+
61+
.. option:: -c, --count
62+
63+
Emit the number of hosts in the result hostlist instead of the hostlist
64+
itself.
65+
66+
.. option:: -n, --nth=N
67+
68+
Output only the host at index *N* (*-N* to index from the end). The command
69+
will fail if *N* is not a valid index.
70+
71+
.. option:: -L, --limit=N
72+
73+
Output at most *N* hosts (*-N* to output the last *N* hosts).
74+
75+
.. option:: -S, --sort
76+
77+
Display sorted result.
78+
79+
.. option:: -u, --union, --unique
80+
81+
Return only unique hosts. This implies :option:`--sort`. Without any
82+
other manipulation options, this is equivalent to returning the set
83+
union of all provided hosts. (By default, all inputs are concatenated).
84+
85+
.. option:: -x, --exclude=HOSTS
86+
87+
Exclude all occurrences of *HOSTS* form the result.
88+
89+
.. option:: -i, --intersect
90+
91+
Return the set intersection of all hostlists.
92+
93+
.. option:: -m, --minus
94+
95+
Subtract all hostlists from the first.
96+
97+
.. option:: -X, --xor
98+
99+
Return the symmetric difference of all hostlists.
100+
101+
.. option:: -f, --fallback
102+
103+
If an argument to :command:`flux-hostlist` is a single hostname, and the
104+
hostname can be interpreted as a valid Flux jobid (e.g. starts with ``f``
105+
and otherwise contains valid base58 characters like ``fuzzy`` or ``foo1``),
106+
then the command may fail with::
107+
108+
flux-hostlist: ERROR: job foo1 not found
109+
110+
With the :option:`--fallback` option arguments that appear to be jobids that
111+
are not found are treated as hostnames, e.g.::
112+
113+
$ flux hostlist --fallback foo1 foo2
114+
foo[1-2]
115+
116+
.. option:: -q, --quiet
117+
118+
Suppress output and exit with a nonzero exit code if the hostlist is empty.
119+
120+
EXAMPLES
121+
========
122+
123+
Create host file for the current job or instance if running in an initial
124+
program:
125+
126+
::
127+
128+
$ flux hostlist -ed'\n' >hostfile
129+
130+
Launch an MPI program using :program:`mpiexec.hydra` from within a batch
131+
script:
132+
133+
::
134+
135+
#!/bin/sh
136+
mpiexec.hydra -launcher ssh -hosts "$(flux hostlist -e)" mpi_hello
137+
138+
List the hosts for one job: (Note: this is the same as
139+
:command:`flux jobs -no {nodelist} JOBID`)
140+
141+
::
142+
143+
$ flux hostlist JOBID
144+
host[1-2]
145+
146+
List the unordered, unique hosts for multiple jobs:
147+
148+
::
149+
150+
$ flux hostlist -u JOBID1 JOBID2 JOBID3
151+
host[1-2,4]
152+
153+
Determine if any failed jobs shared common nodes:
154+
155+
::
156+
157+
$ flux hostlist --intersect $(flux jobs -f failed -no {id})
158+
host4
159+
160+
Determine if a given host appeared the last submitted job:
161+
162+
::
163+
164+
if flux hostlist -q -i $(flux job last) host1; then
165+
echo host1 was part of your last job
166+
fi
167+
168+
169+
Count the number of currently available hosts:
170+
171+
::
172+
173+
$ flux hostlist --count avail
174+
4
175+
176+
List all the hosts on which a job named 'myapp' ran:
177+
178+
::
179+
180+
$ flux hostlist --union $(flux pgrep myapp)
181+
host[2,4-5]
182+
183+
List all hosts in the current instance which haven't had a job assigned
184+
in the last 100 jobs:
185+
186+
::
187+
188+
$ flux hostlist --minus instance $(flux jobs -c 100 -ano {id})
189+
host0
190+
191+
EXIT STATUS
192+
===========
193+
194+
0
195+
Successful operation
196+
197+
1
198+
One or more *SOURCES* were invalid, an invalid index was specified to
199+
:option:`--nth`, or :option:`--quiet` was used and the result hostlist
200+
was empty.
201+
202+
2
203+
Invalid option specified or other command line error
204+
205+
RESOURCES
206+
=========
207+
208+
.. include:: common/resources.rst
209+
210+
FLUX RFC
211+
========
212+
213+
:doc:`rfc:spec_29`
214+
215+
216+
SEE ALSO
217+
========
218+
219+
:man1:`flux-getattr`, :man1:`flux-jobs`, :man7:`flux-broker-attributes`

doc/manpages.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
('man1/flux-shell', 'flux-shell', 'the Flux job shell', [author], 1),
7070
('man1/flux-watch', 'flux-watch', 'monitor one or more Flux jobs', [author], 1),
7171
('man1/flux-update', 'flux-update', 'update active Flux jobs', [author], 1),
72+
('man1/flux-hostlist', 'flux-hostlist', 'fetch, combine, and manipulate Flux hostlists', [author], 1),
7273
('man3/flux_attr_get', 'flux_attr_set', 'get/set Flux broker attributes', [author], 3),
7374
('man3/flux_attr_get', 'flux_attr_get', 'get/set Flux broker attributes', [author], 3),
7475
('man3/flux_aux_set', 'flux_aux_get', 'get/set auxiliary handle data', [author], 3),

doc/test/spell.en.pws

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -824,3 +824,6 @@ infeasible
824824
login
825825
workflow
826826
xmlfile
827+
hostfile
828+
ano
829+
myapp

0 commit comments

Comments
 (0)