Debian Codegraph @

doc/txt/nodeset.txt

raw
1 =========
2 nodeset
3 =========
4
5 -----------------------------------
6 compute advanced nodeset operations
7 -----------------------------------
8
9 :Author: Stephane Thiell
10 :Date: 2026-07-16
11 :Copyright: GNU Lesser General Public License version 2.1 or later (LGPLv2.1+)
12 :Version: 1.10.1
13 :Manual section: 1
14 :Manual group: ClusterShell User Manual
15
16
17 SYNOPSIS
18 ========
19
20 ``nodeset`` [OPTIONS] [COMMAND] [nodeset1 [OPERATION] nodeset2|...]
21
22
23 DESCRIPTION
24 ===========
25 Note: ``nodeset`` and ``cluset`` are the same command.
26
27 ``nodeset`` is a utility command provided with the ClusterShell library which
28 implements some features of ClusterShell's NodeSet and RangeSet Python classes.
29 It provides easy manipulation of 1D or nD-indexed cluster nodes and node
30 groups.
31
32 Also, ``nodeset`` is automatically bound to the library node group resolution
33 mechanism. Thus, it is especially useful to enhance cluster aware
34 administration shell scripts.
35
36
37 OPTIONS
38 =======
39
40 --version show program's version number and exit
41 -h, --help show this help message and exit
42 -s GROUPSOURCE, --groupsource=GROUPSOURCE
43 optional ``groups.conf``\(5) group source to use
44 --groupsconf=FILE use alternate config file for ``groups.conf``\(5)
45
46 Commands:
47 -c, --count show number of nodes in nodeset(s)
48 -e, --expand expand nodeset(s) to separate nodes (see also -S *SEPARATOR*)
49 -f, --fold fold nodeset(s) (or separate nodes) into one nodeset
50 -l, --list list node groups, list node groups and nodes (``-ll``) or list node groups, nodes and node count (``-lll``). When no argument is specified at all, this command will list all node group names found in selected group source (see also -s *GROUPSOURCE*). If any nodesets are specified as argument, this command will find node groups these nodes belong to (individually). Optionally for each group, the fraction of these nodes being member of the group may be displayed (with ``-ll``), and also member count/total group node count (with ``-lll``). If a single hyphen-minus (-) is given as a nodeset, it will be read from standard input.
51 -L, --list-all list node groups from all group sources (``-LL`` shows nodes and ``-LLL`` adds node count). Like ``-l``, if any nodesets are specified as argument, this command will find node groups these nodes belong to (individually).
52 -r, --regroup fold nodes using node groups (see -s *GROUPSOURCE*)
53 --index=NODE output the index of NODE in the nodeset (reverse of -I/--slice)
54 --list-sources, --groupsources
55 list all active group sources (see ``groups.conf``\(5))
56
57 Operations:
58 -x SUB_NODES, --exclude=SUB_NODES
59 exclude specified nodeset
60 -i AND_NODES, --intersection=AND_NODES
61 calculate nodesets intersection
62 -X XOR_NODES, --xor=XOR_NODES
63 calculate symmetric difference between nodesets
64
65 Options:
66 -a, --all call external node groups support to display all nodes
67 --autostep=AUTOSTEP
68 enable a-b/step style syntax when folding nodesets, value is min node count threshold (integer '4', percentage '50%' or 'auto'). If not specified, auto step is disabled (best for compatibility with other cluster tools). Example: autostep=4, "node2 node4 node6" folds in node[2,4,6] but autostep=3, "node2 node4 node6" folds in node[2-6/2].
69 -d, --debug output more messages for debugging purpose
70 -q, --quiet be quiet, print essential output only
71 -R, --rangeset switch to RangeSet instead of NodeSet. Useful when
72 working on numerical cluster ranges, e.g. 1,5,18-31
73 -G, --groupbase do not display group source prefix (always `@groupname`)
74 -S SEPARATOR, --separator=SEPARATOR
75 separator string to use when expanding nodesets
76 (default: ' ')
77 -O FORMAT, --output-format=FORMAT
78 output format (default: '%s')
79 -I SLICE_RANGESET, --slice=SLICE_RANGESET
80 return sliced off result; examples of SLICE_RANGESET are "0" for simple index selection, or "1-9/2,16" for complex rangeset selection
81 --split=MAXSPLIT split result into a number of subsets
82 --contiguous split result into contiguous subsets (i.e. for nodeset, subsets will contain nodes with same pattern name and a contiguous range of indexes, like foobar[1-100]; for rangeset, subsets consist of contiguous index ranges)
83 --axis=RANGESET for nD nodesets, fold along provided axis only. Axes are indexed from 1 to n and can be specified here either using the rangeset syntax, e.g. '1', '1-2', '1,3', or by a single negative number meaning that the index is counted from the end. Because some nodesets may have several different dimensions, axis indices are silently truncated to fall in the allowed range.
84 --pick=N pick N node(s) at random in nodeset
85
86
87 For a short explanation of these options, see ``-h, --help``.
88
89 If a single hyphen-minus (-) is given as a nodeset, it will be read from
90 standard input.
91
92 EXTENDED PATTERNS
93 =================
94
95 The ``nodeset`` command benefits from ClusterShell NodeSet basic
96 arithmetic addition. This feature extends recognized string patterns by
97 supporting operators matching all Operations seen previously. String
98 patterns are read from left to right, by processing any character
99 operators accordingly.
100
101 Supported character operators
102 ``,``
103 indicates that the *union* of both left and right nodeset should be
104 computed before continuing
105 ``!``
106 indicates the *difference* operation
107 ``&``
108 indicates the *intersection* operation
109 ``^``
110 indicates the *symmetric difference* (XOR) operation
111
112 Care should be taken to escape these characters as needed when the shell
113 does not interpret them literally.
114
115 Examples of use of extended patterns
116 :$ nodeset -f node[0-7],node[8-10]:
117
118 | node[0-10]
119
120 :$ nodeset -f node[0-10]\!node[8-10]:
121
122 | node[0-7]
123
124 :$ nodeset -f node[0-10]\&node[5-13]:
125
126 | node[5-10]
127
128 :$ nodeset -f node[0-10]^node[5-13]:
129
130 | node[0-4,11-13]
131
132 Example of advanced usage
133 :$ nodeset -f @gpu^@slurm\:bigmem!@chassis[1-9/2]:
134
135 This computes a folded nodeset containing nodes found in groups @gpu and @slurm:bigmem, but not in both, minus the nodes found in odd chassis groups from 1 to 9.
136
137 "All nodes" extension
138 The ``@*`` and ``@SOURCE:*`` special notations may be used in extended patterns to represent all nodes (in SOURCE) according to the *all* external shell command (see ``groups.conf``\(5)) and are equivalent to:
139
140 :$ nodeset [-s SOURCE] -a -f:
141
142 Group names in expressions
143 The ``@@SOURCE`` notation may be used to access all group names from the specified SOURCE (or from the default group source when just ``@@`` is used) in node set expressions; this works with either file-based group sources or with external group sources that have the *list* or *mapall* upcall defined (see ``groups.conf``\(5)):
144
145 :$ nodeset -f @@rack:
146
147 | J[1-3]
148
149
150 NODE WILDCARDS
151 ==============
152
153 Any wildcard mask found is matched against all nodes from the group source (see ``groups.conf``\(5) and the ``-a/--all`` option above).
154 ``*`` means match zero or more characters of any type; ``?`` means match exactly one character of any type.
155 This can be especially useful for server farms, or when cluster node names differ.
156
157 Say that your group configuration is set to return the following "all nodes":
158 :$ nodeset -f -a:
159
160 | bckserv[1-2],dbserv[1-4],wwwserv[1-9]
161
162 Then, you can use wildcards to select particular nodes, as shown below:
163 :$ nodeset -f 'www\*':
164
165 | wwwserv[1-9]
166
167 :$ nodeset -f 'www\*[1-4]':
168
169 | wwwserv[1-4]
170
171 :$ nodeset -f '\*serv1':
172
173 | bckserv1,dbserv1,wwwserv1
174
175 Wildcard masks are resolved prior to extended patterns, but each mask is evaluated as a whole node set operand.
176 In the example below, we select all nodes matching ``*serv*`` before removing all nodes matching ``www*``:
177
178 :$ nodeset -f '\*serv\*\!www\*':
179
180 | bckserv[1-2],dbserv[1-4]
181
182 EXIT STATUS
183 ===========
184
185 An exit status of zero indicates success of the ``nodeset`` command. A non-zero
186 exit status indicates failure.
187
188 EXAMPLES
189 ===========
190
191 Getting the node count
192 :$ nodeset -c node[0-7,32-159]:
193
194 | 136
195
196 :$ nodeset -c node[0-7,32-159] node[160-163]:
197
198 | 140
199
200 :$ nodeset -c dc[1-2]n[100-199]:
201
202 | 200
203
204 :$ nodeset -c @login:
205
206 | 4
207
208 Folding nodesets
209 :$ nodeset -f node[0-7,32-159] node[160-163]:
210
211 | node[0-7,32-163]
212
213 :$ echo node3 node6 node1 node2 node7 node5 | nodeset -f:
214
215 | node[1-3,5-7]
216
217 :$ nodeset -f dc1n2 dc2n2 dc1n1 dc2n1:
218
219 | dc[1-2]n[1-2]
220
221 :$ nodeset --axis=1 -f dc1n2 dc2n2 dc1n1 dc2n1:
222
223 | dc[1-2]n1,dc[1-2]n2
224
225
226
227 Expanding nodesets
228 :$ nodeset -e node[160-163]:
229
230 | node160 node161 node162 node163
231
232 :$ echo 'dc[1-2]n[2-6/2]' | nodeset -e:
233
234 | dc1n2 dc1n4 dc1n6 dc2n2 dc2n4 dc2n6
235
236 Excluding nodes from nodeset
237 :$ nodeset -f node[32-159] -x node33:
238
239 | node[32,34-159]
240
241 Computing nodesets intersection
242 :$ nodeset -f node[32-159] -i node[0-7,20-21,32,156-159]:
243
244 | node[32,156-159]
245
246 Computing nodesets symmetric difference (xor)
247 :$ nodeset -f node[33-159] --xor node[32-33,156-159]:
248
249 | node[32,34-155]
250
251 Splitting nodes into several nodesets (expanding results)
252 :$ nodeset --split=3 -e node[1-9]:
253
254 | node1 node2 node3
255 | node4 node5 node6
256 | node7 node8 node9
257
258 Splitting non-contiguous nodesets (folding results)
259 :$ nodeset --contiguous -f node2 node3 node4 node8 node9:
260
261 | node[2-4]
262 | node[8-9]
263
264 :$ nodeset --contiguous -f dc[1,3]n[1-2,4-5]:
265
266 | dc1n[1-2]
267 | dc1n[4-5]
268 | dc3n[1-2]
269 | dc3n[4-5]
270
271
272 HISTORY
273 =======
274
275 Command syntax has been changed since ``nodeset`` command available with ClusterShell v1.1. Operations, like *--intersection* or *-x*, are now specified between nodesets in the command line.
276
277 ClusterShell v1.1:
278 :$ nodeset -f -x node[3,5-6,9] node[1-9]:
279
280 | node[1-2,4,7-8]
281
282 ClusterShell v1.2+:
283 :$ nodeset -f node[1-9] -x node[3,5-6,9]:
284
285 | node[1-2,4,7-8]
286
287 ``cluset`` was added in 1.7.3 to avoid a conflict with xCAT's ``nodeset``
288 command and also to conform with ClusterShell's "clu*" command nomenclature.
289
290 SEE ALSO
291 ========
292
293 ``clubak``\(1), ``cluset``\(1), ``clush``\(1), ``groups.conf``\(5).
294
295 https://clustershell.readthedocs.io/
296
297 BUG REPORTS
298 ===========
299
300 Use the following URL to submit a bug report or feedback:
301 https://github.com/clustershell/clustershell/issues
302