Node Selectors#
The ClusterWareAI ™ node selector language allows you to quickly and easily launch actions on a selected group of nodes where the grouping is defined by a boolean expression. The expression can include tests against each node’s status information, any assigned or inherited attributes, the node fields, as well as health or hardware information. When combined with admin-created attributes, the node selector language can become a very powerful tool for the day-to-day management and maintenance of a cluster.
Node selectors can reference:
Individual attributes (
attribute[attributename]ora[attributename]). Includes Reserved Attributes or user-defined attributes. See Node Attributes for details.Node fields (
node[field]orn[field]). Includes MAC address, name, domain, hostname, and other information listed using thecw-nodectl ls -lcommand. See Database Primitive Fields and Attributes for details.Attribute group membership (
%groupname). See Attribute Groups for details.Hardware fields (
hardware[entry]orh[entry]). Includes information the ClusterWareAI software collects from the node, which varies by node type, hardware vendor, and so on. Examples includenum_cpus,ram_total, CPU architecture, hardware vendor, and so on. See Compute Node Fields for details.Status fields (
status[entry]ors[entry]). Includes information the ClusterWareAI software collects from the node, which varies by node. Examples includeram_free,load_avg, CPU usage, and so on. See Command-Line Monitoring of Nodes for details.
Tip
If you specify a list of nodes using -ids and use -selector
at the same time, they act as a logical AND. Together they return nodes in
the provided list and that match the provided selector.
Example Node Selector Commands#
You should test node selector queries prior to using them with an action. Queries may fail or provide unexpected results, particularly if an attribute is set on individual nodes. For example:
View the list of “large memory” nodes:
cw-nodectl –selector “hardware[ram_total] > 128GiB” ls
View the list of “large SMP” nodes:
cw-nodectl –selector “hardware[cpu_count] > 48” ls
View all nodes using the "GPUBoot" boot configuration:
cw-nodectl –selector “attributes[_boot_config]==GpuBoot”
View nodes 1-9 that are currently up:
cw-nodectl -in[1-9] --up ls
After making sure the node selector lists all expected nodes, run the command again with additional arguments to perform an action. For example, you can verify the kernel rpm on all nodes using the “GpuBoot” boot configuration by running:
cw-nodectl –selector “attributes[_boot_config]==GpuBoot” exec rpm -q kernel
See Using Node Selectors for additional examples.