nodeset - compute advanced nodeset operations
Contents
Bug Reports
UsethefollowingURLtosubmitabugreportorfeedback:
<https://github.com/cea-hpc/clustershell/issues>
Copyright
GNU Lesser General Public License version 2.1 or later (LGPLv2.1+)
1.9.3 2025-01-23 NODESET(1)
Description
Note: nodeset and cluset are the same command.
nodeset is an utility command provided with the ClusterShell library which implements some features of
ClusterShell's NodeSet and RangeSet Python classes. It provides easy manipulation of 1D or nD-indexed
cluster nodes and node groups.
Also, nodeset is automatically bound to the library node group resolution mechanism. Thus, it is
especially useful to enhance cluster aware administration shell scripts.
Examples
Gettingthenodecount$nodeset-cnode[0-7,32-159]
136
$nodeset-cnode[0-7,32-159]node[160-163]
140
$nodeset-cdc[1-2]n[100-199]
200
$nodeset-c@login
4
Foldingnodesets$nodeset-fnode[0-7,32-159]node[160-163]
node[0-7,32-163]
$echonode3node6node1node2node7node5|nodeset-f
node[1-3,5-7]
$nodeset-fdc1n2dc2n2dc1n1dc2n1
dc[1-2]n[1-2]
$nodeset--axis=1-fdc1n2dc2n2dc1n1dc2n1
dc[1-2]n1,dc[1-2]n2
Expandingnodesets$nodeset-enode[160-163]
node160 node161 node162 node163
$echo'dc[1-2]n[2-6/2]'|nodeset-e
dc1n2 dc1n4 dc1n6 dc2n2 dc2n4 dc2n6
Excludingnodesfromnodeset$nodeset-fnode[32-159]-xnode33
node[32,34-159]
Computingnodesetsintersection$nodeset-fnode[32-159]-inode[0-7,20-21,32,156-159]
node[32,156-159]
Computingnodesetssymmetricdifference(xor)$nodeset-fnode[33-159]--xornode[32-33,156-159]
node[32,34-155]
Splittingnodesintoseveralnodesets(expandingresults)$nodeset--split=3-enode[1-9]
node1 node2 node3
node4 node5 node6
node7 node8 node9
Splittingnon-contiguousnodesets(foldingresults)$nodeset--contiguous-fnode2node3node4node8node9
node[2-4]
node[8-9]
$nodeset--contiguous-fdc[1,3]n[1-2,4-5]
dc1n[1-2]
dc1n[4-5]
dc3n[1-2]
dc3n[4-5]
Exit Status
An exit status of zero indicates success of the nodeset command. A non-zero exit status indicates
failure.
Extended Patterns
The nodeset command benefits from ClusterShell NodeSet basic arithmetic addition. This feature extends
recognized string patterns by supporting operators matching all Operations seen previously. String
patterns are read from left to right, by proceeding any character operators accordingly.
Supportedcharacteroperators, indicates that the union of both left and right nodeset should be computed before
continuing
! indicates the difference operation
& indicates the intersection operation
^ indicates the symmetricdifference (XOR) operation
Care should be taken to escape these characters as needed when the shell does not interpret them
literally.
Examplesofuseofextendedpatterns$nodeset-fnode[0-7],node[8-10]
node[0-10]
$nodeset-fnode[0-10]!node[8-10]
node[0-7]
$nodeset-fnode[0-10]&node[5-13]
node[5-10]
$nodeset-fnode[0-10]^node[5-13]
node[0-4,11-13]
Exampleofadvancedusage$nodeset-f@gpu^@slurm:bigmem!@chassis[1-9/2]
This computes a folded nodeset containing nodes found in group @gpu and @slurm:bigmem, but not in
both, minus the nodes found in odd chassis groups from 1 to 9.
"Allnodes"extension
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:
$nodeset[-sSOURCE]-a-fGroupnamesinexpressions
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 upcall defined (see
groups.conf(5)):
$nodeset-f@@rack
J[1-3]
History
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.
ClusterShellv1.1:$nodeset-f-xnode[3,5-6,9]node[1-9]
node[1-2,4,7-8]
ClusterShellv1.2+:$nodeset-fnode[1-9]-xnode[3,5-6,9]
node[1-2,4,7-8]
cluset was added in 1.7.3 to avoid a conflict with xCAT's nodeset command and also to conform with
ClusterShell's "clu*" command nomenclature.
Name
nodeset - compute advanced nodeset operations
Node Wildcards
Any wildcard mask found is matched against all nodes from the group source (see groups.conf(5) and the
-a/--all option above). * means match zero or more characters of any type; ? means match exactly one
character of any type. This can be especially useful for server farms, or when cluster node names
differ.
Saythatyourgroupconfigurationissettoreturnthefollowing“allnodes”:$nodeset-f-a
bckserv[1-2],dbserv[1-4],wwwserv[1-9]
Then,youcanusewildcardstoselectparticularnodes,asshownbelow:$nodeset-f'www*'
wwwserv[1-9]
$nodeset-f'www*[1-4]'
wwwserv[1-4]
$nodeset-f'*serv1'
bckserv1,dbserv1,wwwserv1
Wildcard masks are resolved prior to extended patterns, but each mask is evaluated as a whole node set
operand. In the example below, we select all nodes matching *serv* before removing all nodes matching
www*:
$nodeset-f'*serv*!www*'
bckserv[1-2],dbserv[1-4]
Options
--version
show program's version number and exit
-h, --help
show this help message and exit
-sGROUPSOURCE, --groupsource=GROUPSOURCE
optional groups.conf(5) group source to use
--groupsconf=FILE
use alternate config file for groups.conf(5)
Commands:-c, --count
show number of nodes in nodeset(s)
-e, --expand
expand nodeset(s) to separate nodes (see also -S SEPARATOR)
-f, --fold
fold nodeset(s) (or separate nodes) into one nodeset
-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 belongs 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.
-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 belongs to (individually).
-r, --regroup
fold nodes using node groups (see -s GROUPSOURCE)
--groupsources
list all active group sources (see groups.conf(5))
Operations:-xSUB_NODES, --exclude=SUB_NODES
exclude specified nodeset
-iAND_NODES, --intersection=AND_NODES
calculate nodesets intersection
-XXOR_NODES, --xor=XOR_NODES
calculate symmetric difference between nodesets
Options:-a, --all
call external node groups support to display all nodes
--autostep=AUTOSTEP
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].
-d, --debug
output more messages for debugging purpose
-q, --quiet
be quiet, print essential output only
-R, --rangeset
switch to RangeSet instead of NodeSet. Useful when working on numerical cluster ranges,
eg. 1,5,18-31
-G, --groupbase
hide group source prefix (always @groupname)
-SSEPARATOR, --separator=SEPARATOR
separator string to use when expanding nodesets (default: ' ')
-OFORMAT, --output-format=FORMAT
output format (default: '%s')
-ISLICE_RANGESET, --slice=SLICE_RANGESET
return sliced off result; examples of SLICE_RANGESET are "0" for simple index selection,
or "1-9/2,16" for complex rangeset selection
--split=MAXSPLIT
split result into a number of subsets
--contiguous
split result into contiguous subsets (ie. for nodeset, subsets will contain nodes with
same pattern name and a contiguous range of indexes, like foobar[1-100]; for rangeset,
subsets with consists in contiguous index ranges)"""
--axis=RANGESET
for nD nodesets, fold along provided axis only. Axis are indexed from 1 to n and can be
specified here either using the rangeset syntax, eg. '1', '1-2', '1,3', or by a single
negative number meaning that the indices is counted from the end. Because some nodesets
may have several different dimensions, axis indices are silently truncated to fall in
the allowed range.
--pick=N
pick N node(s) at random in nodeset
For a short explanation of these options, see -h,--help.
If a single hyphen-minus (-) is given as a nodeset, it will be read from standard input.
See Also
clubak(1), cluset(1), clush(1), groups.conf(5). <http://clustershell.readthedocs.org/>
Synopsis
nodeset [OPTIONS] [COMMAND] [nodeset1 [OPERATION] nodeset2|...]
