flux-resource(1)

SYNOPSIS

flux resource list [-n] [-o FORMAT] [-s STATES] [-q QUEUE] [-i TARGETS]
flux resource info [-s STATES] [-q QUEUE] [-i TARGETS]
flux resource R [-s STATES] [-q QUEUE] [-i TARGETS]
flux resource status [-n] [-o FORMAT] [-s STATES] [-q QUEUE] [-i TARGETS]
flux resource drain [-n] [-o FORMAT] [-i TARGETS]
flux resource drain [-f] [-u] [targets] [reason]
flux resource undrain [-f] [-u] targets [reason]
flux resource reload [-f] [--xml] path
flux resource acquire-mute
flux resource eventlog [-w EVENT] [-f FORMAT] [-T FORMAT] [-L [WHEN]] [-H] [-F] [-i TARGETS]

DESCRIPTION

flux resource lists and manipulates Flux resources. The resource inventory is maintained and monitored by the resource service. The scheduler acquires a subset of resources from the resource service to allocate to jobs, and relies on the resource service to inform it of status changes that affect the usability of resources by jobs as described in RFC 27.

The flux resource list subcommand queries the resource module for the scheduler view of resources, including allocated/free status.

The other flux resource subcommands operate on the resource service and are primarily of interest to system administrators of a Flux system instance. For example, they can show whether or not a node is booted, and may be used to administratively drain and undrain nodes.

A few notes on drained nodes:

  • While a node is drained, the scheduler will not allocate it to jobs.

  • The act of draining a node does not affect running jobs.

  • When an instance is restarted, drained nodes remain drained.

  • The scheduler may determine that a job request is feasible if the total resource set, including drained nodes, would allow it to run.

  • In flux resource status and flux resource drain, the drain state of a node will be presented as "drained" if the node has no job allocations, and "draining" if there are still jobs running on the node.

  • If a node is drained and offline, then "drained*" will be displayed.

Some further background on resource service operation may be found in the RESOURCE INVENTORY section below.

COMMANDS

list

Show the scheduler view of resources.

In the scheduler view, excluded resources are always omitted, and unavailable resources are shown in the "down" state regardless of the reason (drained, offline, torpid, etc). Valid states in the scheduler view are:

up

Available for use.

down

Unavailable for use.

allocated

Allocated to jobs.

free

Not allocated to jobs.

all

Wildcard matching all resources.

-s, --states=STATE,...

Restrict displayed resource states to a comma separated list of the states listed above.

If unspecified, free,allocated,down is used.

-q, --queue=QUEUE,...

Filter results to only include resources in the specified QUEUE. Multiple queues may be separated by a comma. When this option is used, the {queue} output field reflects only the specified queues, even if resources belong to additional queues.

-i, --include=TARGETS

Filter results to only include resources matching TARGETS, which may be specified either as an idset of broker ranks or list of hosts or nodes in hostlist form. It is not an error to specify ranks, nodes, or hosts which do not exist.

--skip-empty

Skip lines with empty resource sets in output. This is the default when -i, --include is used.

-o, --format=FORMAT

Customize the output format (See the OUTPUT FORMAT section below).

-n, --no-header

Suppress header from output,

info

Show a brief, single line summary of scheduler view of resources, for example:

8 Nodes, 32 Cores, 0 GPUs
-s, --states=STATE,...

Limit the output to specified resource states as described above for the list command.

If unspecified, all is used.

-q, --queue=QUEUE,...

Filter results to only include resources in the specified QUEUE. Multiple queues may be separated by a comma.

-i, --include=TARGETS

Filter results to only include resources matching TARGETS, which may be specified either as an idset of broker ranks or list of hosts or nodes in hostlist form. It is not an error to specify ranks, nodes, or hosts which do not exist.

R

Emit an RFC 20 Resource Set based on the scheduler view of resources.

-s, --states=STATE,...

Limit the output to specified resource states as described above for the list command.

If unspecified, all is used.

-q, --queue=QUEUE,...

Filter results to only include resources in the specified QUEUE. Multiple queues may be separated by a comma.

-i, --include=TARGETS

Filter results to only include resources matching TARGETS, which may be specified either as an idset of broker ranks or list of hosts or nodes in hostlist form. It is not an error to specify ranks, nodes, or hosts which do not exist.

status

Show system view of resources. Valid states in the system view are:

avail

available for scheduling when up. This includes all nodes that are not excluded, drained, or torpid.

exclude

excluded by configuration

draining

drained but still allocated

drained

drained and unallocated

drain

shorthand for drained,draining

allocated

node is currently allocated to a job or housekeeping

torpid

node has been unresponsive for a period of time and is temporarily unavailable for scheduling

housekeeping

node is currently running housekeeping

offline

node has not joined the Flux instance (e.g. turned off or has not started the flux broker).

online

node has joined the Flux instance

flux resource status displays a line of output for each set of resources that share a state and online/offline state.

Note

flux resource status queries both the administrative and scheduler view of resources to identify resources that are available, excluded by configuration, torpid, administratively drained or draining, or currently executing housekeeping.

-s, --states=STATE,...

Restrict the set of resource states a comma-separated list.

If unspecified, avail,exclude,draining,drained,torpid,housekeeping is used.

-q, --queue=QUEUE,...

Filter results to only include resources in the specified QUEUE. Multiple queues may be separated by a comma.

-i, --include=TARGETS

Filter results to only include resources matching TARGETS, which may be specified either as an idset of broker ranks or list of hosts or nodes in hostlist form. It is not an error to specify ranks, nodes, or hosts which do not exist.

-o, --format=FORMAT

Customize output formatting. See the OUTPUT FORMAT section below for details.

-n,--no-header

Suppress header from output,

--skip-empty

Force suppression of empty lines.

Normally, flux resource status skips lines with no resources, unless the -s, --states option is used.

drain

If specified without targets, list the drained nodes. In this mode, the following options are available:

-o, --format=FORMAT

Customize output formatting. See the OUTPUT FORMAT section below for details.

-n,--no-header

Suppress header from output,

-q, --queue=QUEUE,...

Filter results to only include resources in the specified QUEUE. Multiple queues may be separated by a comma.

-i, --include=TARGETS

Filter results to only include resources matching TARGETS, which may be specified either as an idset of broker ranks or list of hosts or nodes in hostlist form. It is not an error to specify ranks, nodes, or hosts which do not exist.

If specified with targets (IDSET or HOSTLIST), drain the specified nodes. Any remaining free arguments are recorded as a reason for the drain event. By default, flux resource drain fails if any of the targets are already drained.

Resources cannot be both excluded and drained, so flux resource drain will also fail if any targets are currently excluded by configuration. There is no option to force an excluded node into the drain state.

This command, when run with arguments, is restricted to the Flux instance owner.

-f, --force

If any of targets are already drained, do not fail. Overwrite the original drain reason. When --force is specified twice, the original drain timestamp is also overwritten.

-u, --update

If any of targets are already drained, do not fail and do not overwrite the existing drain reason or timestamp.

undrain

Undrain the nodes specified by the targets argument (IDSET or HOSTLIST). Any remaining free arguments are recorded as a reason for the undrain event.

This command is restricted to the Flux instance owner.

-f, --force

If any of targets are not drained, do not fail. Overwrite the original undrain reason. When --force is specified twice, the original undrain timestamp is also overwritten.

-u, --update

If any of targets are not drained, do not fail and do not overwrite the existing undrain reason or timestamp.

reload

Reload the resource inventory from path. By default, path refers to a file in RFC 20 format.

This command is primarily used in test.

-x, --xml

Interpret path as a directory of hwloc <rank>.xml files.

-f, --force

Do not fail if resource contain invalid ranks.

acquire-mute

Tell the resource module to stop sending RFC 28 resource.acquire responses to the scheduler. This is used during Flux instance shutdown to avoid asking the scheduler to needlessly process OFFLINE updates.

eventlog

Watch the resource journal, which is described in RFC 44.

-f, --format=FORMAT

Specify the eventlog output format. Valid choices are text (the default) or json.

-T, --time-format=FORMAT

Specify the timestamp format. Valid choices are raw (the default), iso, offset, and human.

-H, --human

Display human-readable output. Equivalent to -T human -f text.

-L, --color[=WHEN]

Colorize output. The optional argument WHEN can be "always", "never", or "auto". If WHEN is omitted, "always" is used. When the option is not used, the default is "auto", or "never" if NO_COLOR is set to a non-empty value in the environment.

-F, --follow

After printing the current eventlog, wait for new events and print them as they arrive.

-w, --wait=EVENT

Wait for the specified event to be posted, print it, then quit. The current set of valid events events is restart, resource-define, online, offline, drain, undrain, torpid, and lively.

-m, --match-context=KEY=VAL

When used with --wait, skip events whose context does not contain a matching KEY=VAL pair. This option may be repeated to require multiple pairs to match. Floating point values are compared within an absolute tolerance of 1e-5 rather than exactly.

-t, --timeout=FSD

When used with --wait, exit with an error if the expected event is not received within the specified duration in RFC 23 Flux Standard Duration form (e.g. 1.5, 5s, 1.5m).

-i, --include=TARGETS

Filter events to only include those that apply to TARGETS, which is normally one or more hostnames in RFC 29 hostlist form. TARGETS can also be broker ranks in RFC 22 idset form, useful mainly in test.

OUTPUT FORMAT

The --format option can be used to specify an output format using Python's string format syntax or a defined format by name. For a list of built-in and configured formats use -o help. An alternate default format can be set via the FLUX_RESOURCE_STATUS_FORMAT_DEFAULT, FLUX_RESOURCE_DRAIN_FORMAT_DEFAULT, and FLUX_RESOURCE_LIST_FORMAT_DEFAULT environment variables (for flux resource status, flux resource drain, and flux resource list respectively). A configuration snippet for an existing named format may be generated with --format=get-config=NAME. See flux-jobs(1) OUTPUT FORMAT section for a detailed description of this syntax.

If the format string begins with sort:k1[,k2,...], then k1[,k2,...] will be taken to be a comma-separated list of keys on which to sort the displayed output. If a sort key starts with -, then the key will be sorted in reverse order.

Sort keys can be any valid field name. Fields that may be empty or unset will sort before non-empty values. When sorting fields that contain mixed types, the sort order is: empty/None < numbers (including booleans) < strings. Booleans are treated as numeric values (False=0, True=1).

For example, to sort by a numeric field with empty values first:

--format='sort:nnodes {id} {nnodes} {status}'

Or to sort in reverse order (largest first, empty values last):

--format='sort:-nnodes {id} {nnodes} {status}'

Multiple sort keys can be specified, with earlier keys taking precedence:

--format='sort:state,-t_submit {id} {state} {t_submit}'

Resources are combined into a single line of output when possible depending on the supplied output format. Resource counts are not included in the determination of uniqueness. Therefore, certain output formats will alter the number of lines of output. For example:

$ flux resource list -no {nnodes}

Would simply output a single of output containing the total number of nodes. The actual state of the nodes would not matter in the output.

The following field names can be specified for the status and drain subcommands:

state

State of node(s): "avail", "exclude", "drain", "draining", "drained", "torpid", "allocated". If the set of resources is offline, an asterisk suffix is appended to the state, e.g. "avail*".

statex

Like state, but exclude the asterisk for offline resources.

status

Current online/offline status of nodes(s): "online", "offline"

up

Displays a if the node is online, or if offline. An ascii y or n may be used instead with up.ascii.

nnodes

number of nodes

ranks

ranks of nodes

nodelist

node names

timestamp

If node(s) in drain/draining/drained state, timestamp of node(s) set to drain.

reason

If node(s) in drain/draining/drained state, reason node(s) set to drain.

The following field names can be specified for the list subcommand:

state

State of node(s): "up", "down", "allocated", "free", "all"

queue

Queue(s) associated with resources. When -q, --queue is used, only the specified queues are shown.

properties

Properties associated with resources.

propertiesx

Properties associated with resources, but with all configured queue names removed, regardless of any -q, --queue filter in effect.

nnodes

number of nodes

ncores

number of cores

ngpus

number of gpus

ranks

ranks of nodes

nodelist

node names

rlist

Short form string of all resources.

CONFIGURATION

Similar to flux-jobs(1), the flux resource command supports loading a set of config files for customizing utility output formats. Currently this can be used to register named format strings for the status, list, and drain subcommands, or to suppress certain queues from the default output of flux resource list.

Configuration for each flux resource subcommand is defined in a separate table, so to add a new format myformat for flux resource list, the following config file could be used:

# $HOME/.config/flux/flux-resource.toml
[list.formats.myformat]
description = "My flux resource list format"
format = "{state} {nodelist}"

The [list] table also supports a hidden-queues option, which is a list of queue names to suppress from the {queue} output field in flux resource list by default. Queues listed in hidden-queues are still shown when explicitly requested via -q, --queue. This is useful for hiding catch-all queues (e.g. a queue that contains all nodes) that would otherwise clutter the default output:

# /etc/xdg/flux/flux-resource.toml
[list]
hidden-queues = ["all", "pall"]

See flux-jobs(1) CONFIGURATION section for more information about the order of precedence for loading these config files.

RESOURCE INVENTORY

The Flux instance's inventory of resources is managed by the resource service, which determines the set of available resources through one of three mechanisms:

configuration

Resources are read from a config file in RFC 20 (R version 1) format. This mechanism is typically used in a system instance of Flux.

enclosing instance

Resources are assigned by the enclosing Flux instance. The assigned resources are read from the job's R key in the enclosing instance KVS.

dynamic discovery

Resources are aggregated from the set of resources reported by hwloc on each broker.

Once the inventory has been determined, it is stored the KVS resource.R key, in RFC 20 (R version 1) format.

Events that affect the availability of resources and should persist across a Flux restart are posted to the KVS resource.eventlog. Such events include:

resource-define

The instance resource set is known (posted each time the resource module is loaded).

drain

One or more nodes are administratively removed from scheduling.

undrain

One or more nodes are no longer drained.

RESOURCES

Flux: http://flux-framework.org

Flux RFC: https://flux-framework.readthedocs.io/projects/flux-rfc

Issue Tracker: https://github.com/flux-framework/flux-core/issues

FLUX RFC