> This page is for Remediation Orchestrator.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/remediation-orchestrator/llms.txt.

# slurm

**Experimental.** For evaluation. Interfaces, configuration, and behavior may change incompatibly.

Synchronizes Slurm cluster state and supports node, reservation and topology operations.

### Prerequisites

* Configured [history](https://github.com/dsx-ai-factory/remediation-orchestrator/blob/1785e695a8bff76c910115b3c96398a5a59a7183/fern/pages/reference/starlark/catalog.mdx#history) and [command](https://github.com/dsx-ai-factory/remediation-orchestrator/blob/1785e695a8bff76c910115b3c96398a5a59a7183/fern/pages/reference/starlark/catalog.mdx#command) modules.
* Slurm control host with `scontrol` JSON support and management permissions.

### Setup

* Enable Slurm:

```toml
[modules.slurm]
cluster_id = "example"
scontrol_node_tag = "scontrol-host"
breakfix_batch_size = 5
sync_enabled = true
sync_interval = "1m"
```

* Register the execution host in noderegistry with the matching cluster ID and tag.
* See [configuration and inventory examples](https://github.com/dsx-ai-factory/remediation-orchestrator/blob/1785e695a8bff76c910115b3c96398a5a59a7183/config_files/examples/workflows.toml).

> **Note**
>
> This module must be enabled in your Remediation Orchestrator config before it is available to scripts.

This module provides functionality for interacting with slurm.

## Members

* [add_node_to_reservation](#add_node_to_reservation)
* [add_tag_to_drain_reason](#add_tag_to_drain_reason)
* [bulk_drain](#bulk_drain)
* [bulk_set_slurm_state](#bulk_set_slurm_state)
* [check_availability](#check_availability)
* [drain_node](#drain_node)
* [get_available_datacenter_node](#get_available_datacenter_node)
* [get_available_node](#get_available_node)
* [get_breakfix_policies](#get_breakfix_policies)
* [get_cluster_id](#get_cluster_id)
* [get_domain_name](#get_domain_name)
* [get_drained_nodes](#get_drained_nodes)
* [get_node_by_key](#get_node_by_key)
* [get_nodes](#get_nodes)
* [get_rack_name](#get_rack_name)
* [get_scontrol_node](#get_scontrol_node)
* [on_drain_node](#on_drain_node)
* [on_reserve_node](#on_reserve_node)
* [parse_drain_reason](#parse_drain_reason)
* [remove_all_and_add_new_reservation](#remove_all_and_add_new_reservation)
* [remove_all_and_add_new_reservation_batch](#remove_all_and_add_new_reservation_batch)
* [remove_all_reservations](#remove_all_reservations)
* [remove_node_from_reservation](#remove_node_from_reservation)
* [set_slurm_state](#set_slurm_state)
* [wait_for_node_has_active_reservations](#wait_for_node_has_active_reservations)
* [wait_for_node_state](#wait_for_node_state)
* [wait_for_slurm_update](#wait_for_slurm_update)

## add_node_to_reservation

Add a node to a reservation.

Deprecated; ignored. The deployment cluster ID is resolved internally.

The node ID of the node.

The name of the reservation to move the node to.

Whether to use the new v2 reservation change method.

Whether to wait for slurm updates before getting the datacenter node.

## add_tag_to_drain_reason

Add a tag to the drain reason of a node.

Deprecated; ignored. The deployment cluster ID is resolved internally.

The node ID of the node.

The tag to add to the drain reason.

The message to add to the drain reason.

Whether to use the new v2 reservation change method.

Whether to wait for slurm updates before getting the datacenter node.

## bulk_drain

Drain a batch of nodes in a single scontrol call. The node list is compressed to Slurm's hostlist range syntax before being passed to scontrol (e.g. \['nvl72D001-T01', ..., 'nvl72D001-T72'] becomes 'nvl72D001-T\[01-72]'). Atomic at the slurmctld layer. When wait_for_sync is true, the call blocks until every node has reached the DRAIN or DOWN state. Example: slurm.bulk_drain(domains.get_nodes(hostname), reason).

List of node IDs to drain. Empty list is a no-op.

The reason to drain the nodes.

If true, block until every node has reached the DRAIN or DOWN state.

## bulk_set_slurm_state

Set the same Slurm state on a batch of nodes in a single scontrol call. The node list is compressed to Slurm's hostlist range syntax before being passed to scontrol (e.g. \['nvl72D001-T01', ..., 'nvl72D001-T72'] becomes 'nvl72D001-T\[01-72]'). scontrol applies the list element by element, so a rejected node does not stop the others and nothing is rolled back; a failure means one or more nodes were rejected, not that the whole cohort was left unchanged. Example: slurm.bulk_set_slurm_state(node_ids, "RESUME").

List of node IDs to update. Empty list is a no-op.

The state to set the nodes to.

Whether to wait for slurm updates before getting the datacenter node.

Bulk state update result with .status, .summary, .results, .workflow_run_id, and .timestamp.

## check_availability

Check if Slurm is available by running scontrol ping on a management node. This call respects the Slurm rate limiter and includes retry logic for transient errors.

Deprecated; ignored. The deployment cluster ID is resolved internally.

Maximum number of retry attempts for transient errors. Default is 3.

Base delay between retries as a duration string (e.g., '10s', '1m'). Default is '10s'. See [https://pkg.go.dev/time#ParseDuration](https://pkg.go.dev/time#ParseDuration) for full specification.

Maximum delay between retries as a duration string (e.g., '1m', '5m'). Default is '1m'. See [https://pkg.go.dev/time#ParseDuration](https://pkg.go.dev/time#ParseDuration) for full specification.

The command execution result with exit_code, stdout, and stderr fields.

## drain_node

Drain a node.

Deprecated; ignored. The deployment cluster ID is resolved internally.

The node ID of the node.

The reason to drain the node.

Whether to use the new v2 reservation change method.

Whether to wait for slurm updates before getting the datacenter node.

## get_available_datacenter_node

Get a random available datacenter node from the deployment's configured Slurm cluster.

Deprecated; ignored. The deployment cluster ID is resolved internally.

Whether to wait for slurm updates before getting the available datacenter node.

The available datacenter node.

## get_available_node

Get a random available node (ALLOCATED or IDLE) from the deployment's configured Slurm cluster.

Deprecated; ignored. The deployment cluster ID is resolved internally.

Whether to wait for slurm updates before getting the available node.

The available node.

## get_breakfix_policies

Get an immutable snapshot of the breakfix policies.

The configured breakfix policy snapshot.

## get_cluster_id

Get the cluster ID from the Slurm module configuration

The configured cluster ID.

## get_domain_name

Get the domain name for a given hostname using the configured rack naming pattern.

The hostname to extract the domain name from.

The domain name (e.g., 'nvl72D008').

## get_drained_nodes

Get drained node objects.

Whether to wait for slurm updates before getting drained nodes.

List of drained node objects.

## get_node_by_key

Get a node by its node ID.

Deprecated; ignored. The deployment cluster ID is resolved internally.

The node ID of the node.

Whether to wait for slurm updates before getting the node.

The node object.

## get_nodes

Get an iterator over node objects.

Filter by node ID. Supports SLURM node list syntax.

Filter by node state.

Filter by node reason.

Filter by partition.

Filter by reservation.

Filter by exact list of node IDs.

Filter by exact list of node states.

Filter by exact list of node reasons.

Filter by exact list of partitions.

Filter by exact list of reservations.

Whether to wait for slurm updates before getting nodes.

Only return nodes updated at or after this time.

Only return nodes updated before this time.

Only return nodes last busy at or after this time.

Only return nodes last busy before this time.

Only return nodes whose reason changed at or after this time.

Only return nodes whose reason changed before this time.

Iterator over node objects.

## get_rack_name

Get the rack name for a given hostname using the configured rack naming pattern.

The hostname to extract the rack name from.

The rack name.

## get_scontrol_node

Get a datacenter node that has scontrol available for executing slurm commands.

Deprecated; ignored. The deployment cluster ID is resolved internally.

Whether to wait for slurm updates before getting the scontrol node.

The scontrol-capable datacenter node.

## on_drain_node

Register a callback workflow to be launched when a node is drained.

The name of the callback to register.

The workflow to launch when a node is drained.

The duration to wait before draining the node.

Whether to run the workflow in dry-run mode.

A function to exclude a node from the callback.

A function that receives the node and configured breakfix policies and returns whether to exclude the node.

## on_reserve_node

Register a callback workflow to be launched when a node enters a named reservation.

The name of the callback to register.

The workflow to launch when a node enters the reservation.

A regex pattern (or exact name) to match reservation names that trigger the callback.

Optional function to compute the workflow ID. Called with (node, reservation_name) and must return a string.

Optional function called with the error string when a workflow execution fails.

A function to exclude a node from the callback.

## parse_drain_reason

Parse a drain reason string and extract all tags in the format \[TAG]. Returns a structured object with tags and cleaned reason.

The drain reason string to parse.

A ParsedDrainReason object containing tags and cleaned reason.

## remove_all_and_add_new_reservation

Remove a node from all current reservations, and add it to the specified reservation.

Deprecated; ignored. The deployment cluster ID is resolved internally.

The node ID of the node.

The name of the reservation to move the node to.

Whether to use the new v2 reservation change method.

Optional list of reservations that are safe to remove the node from. If empty, all reservations, that the node is attached to, are considered safe.

Whether to wait for slurm updates before getting the datacenter node.

## remove_all_and_add_new_reservation_batch

Remove current reservations from multiple nodes and add them to a reservation in batched Slurm updates.

List of node IDs to move. Empty list is a no-op.

The name of the reservation to move the nodes to.

Optional list of reservations that are safe to remove from the nodes. If empty, all reservations attached to the nodes are considered safe.

Whether to wait for slurm updates before reading current node reservations.

## remove_all_reservations

Remove all reservations from a node.

Deprecated; ignored. The deployment cluster ID is resolved internally.

The node ID of the node.

Whether to use the new v2 reservation change method.

Optional list of reservations that are safe to remove the node from. If empty, all reservations, that the node is attached to, are considered safe.

Whether to wait for slurm updates before getting the datacenter node.

## remove_node_from_reservation

Remove a node from a reservation.

Deprecated; ignored. The deployment cluster ID is resolved internally.

The node ID of the node.

The name of the reservation to remove the node from.

Whether to wait for slurm updates before getting the datacenter node.

## set_slurm_state

Set the state of a node.

Deprecated; ignored. The deployment cluster ID is resolved internally.

The node ID of the node.

The state to set the node to.

Whether to use the new v2 reservation change method.

Whether to wait for slurm updates before getting the datacenter node.

## wait_for_node_has_active_reservations

Wait for a node to have at least one of the desired reservations and none of the undesired reservations.

Deprecated; ignored. The deployment cluster ID is resolved internally.

The node ID of the node.

List of desired reservations of the node.

List of undesired reservations of the node.

## wait_for_node_state

Wait for a node to reach a desired state.

Deprecated; ignored. The deployment cluster ID is resolved internally.

The node ID of the node.

List of desired states of the node.

List of undesired states of the node.

Optional Go duration string (e.g., '30s', '1m', '1h').

Optional function to call on timeout. It may accept the node ID and must return bool.

## wait_for_slurm_update

Wait for a specified number of Slurm database updates.

The number of Slurm database updates to wait for.