In SUNK, Slurm nodes run in Kubernetes Pods. These aren’t the same as Kubernetes Nodes, which are the worker machines that run the Pods. To distinguish between the two, this documentation capitalizes Kubernetes Nodes, while Slurm nodes aren’t capitalized.
How SUNK handles a Spot preemption
When CoreWeave selects a Spot Node for preemption, it follows the preemption timeline. It cordons the Node and adds the labelqos.coreweave.cloud/pending-preemption: "true", then drains the Node when the warning window ends. SUNK uses that window to move Slurm jobs off the node while it’s still running:
- The warning label triggers the Syncer’s preemption controller. The cordon also makes the Syncer drain the Slurm node, so Slurm schedules no new jobs on it.
- The controller confirms that the Slurm node is in the
DRAINstate, then finds every Slurm job running on it. - The Syncer requeues the job. Slurm sends
SIGTERMto the job, waits forKillWaitseconds, sendsSIGKILL, and then runs the Epilog. The job returns to the queue in thePENDINGstate with the same job ID. If Slurm can’t requeue the job, the Syncer cancels it by default, so it also ends cleanly while the node is still up. - When the warning window ends, CoreWeave drains the Kubernetes Node, and the Syncer sets the Slurm node to
DOWN. A job still running at that point ends asNODE_FAIL, without an Epilog. If the job is eligible for requeue, Slurm then requeues it, the same way it does after any node failure.
Prerequisites
Before you begin, make sure you have the following:- A SUNK cluster. Spot capacity works with both SUNK Self-Service and SUNK Standard.
- Spot capacity for your instance type in the cluster’s Availability Zone. Check with Capacity Finder before you provision.
- For SUNK Standard,
kubectlaccess to the CoreWeave Kubernetes Service (CKS) cluster with permission to create Node Pools, and write access to the Slurm Helm chart values.
Add Spot capacity on SUNK Self-Service
On a SUNK Self-Service cluster, add an entry tospec.nodes with computeClass: spot. The out-of-band operator creates a Spot Node Pool and a NodeSet for that entry and binds the NodeSet to that Node Pool by name. On-demand and Spot capacity therefore never share a NodeSet. In this example, replace CLUSTER_NAME with the name of your SunkCluster:
SunkCluster with on-demand and Spot capacity
computeClass accepts default or spot. It defaults to default, the compute class for Reserved and On-Demand capacity. You can’t change it after you create the entry, and control-plane entries can’t use spot. To move a node group between on-demand and Spot capacity, add a new entry and scale the old one to 0. For every field in a spec.nodes entry, see NodeSpec.
SUNK creates a Slurm partition for each NodeSet, named after the entry, so this example produces h100 and h100-spot partitions. SUNK also creates an all partition that contains every node and is the default partition. A job submitted without -p can therefore run on Spot nodes. Ask users to submit jobs that can’t be interrupted to an on-demand partition, such as -p h100.
SUNK Self-Service requeues jobs on Spot nodes with the default preemption-handling settings.
Add Spot capacity on SUNK Standard
On SUNK Standard, you create the Spot Node Pool yourself and add a NodeSet for it in the Slurm chart values. Give Spot capacity its own Node Pool and its own NodeSet rather than mixing it with on-demand capacity. A separate NodeSet gets its own partition, and jobs choose Spot capacity by partition. A taint on the Spot Node Pool keeps every Pod that doesn’t explicitly tolerate it, including the on-demand NodeSet’sslurmd Pods, off the Spot Nodes.
Create a Spot Node Pool
Create a Node Pool withcomputeClass: spot, and add a taint to its Nodes. CoreWeave doesn’t taint Spot Nodes, so add the taint yourself. Use the key sunk.coreweave.com/compute-class with the Node Pool’s compute class, spot, as the value. CKS drops Node Pool labels in the reserved coreweave.com and coreweave.cloud namespaces, but applies taints in those namespaces to the Nodes:
slurm-h100-spot-nodepool.yaml
compute.coreweave.com/compute-class, set to spot or default. The NodeSet in the following section selects on that label.
You can’t change computeClass after you create the Node Pool. For the rest of the Node Pool spec, see Create a Node Pool. For why taints belong on the Node Pool rather than on individual Nodes, see Dedicate a Node Pool to a NodeSet.
Create a NodeSet for the Spot Node Pool
Add a node definition undercompute.nodes that tolerates the Spot taint and requires Nodes whose compute class is spot. The toleration matches the taint’s spot value with operator: Equal, so the NodeSet tolerates only Spot Nodes, not Nodes tainted with a different compute class:
On-demand and Spot NodeSets
h100 node definition doesn’t tolerate the Spot taint, so its slurmd Pods never land on Spot Nodes, even without an affinity of its own. For more information, see Bind NodeSets to Node Pools for SUNK Standard.
With partitions.auto enabled (the default), SUNK creates one partition for each NodeSet, named after the NodeSet. The Slurm chart names each NodeSet RELEASE_NAME-NODE_NAME, where NODE_NAME is the node’s key under compute.nodes, so with a Helm release named slurm, this example produces slurm-h100 and slurm-h100-spot partitions. To confirm the names, run sinfo on a login node.
Keep other jobs off Spot nodes
The automatic partitions already separate the two kinds of capacity. Jobs submitted to the on-demand partition,slurm-h100 in this example, never run on Spot nodes, so you don’t need to define a partition of your own.
By default, SUNK also creates an all partition that contains every node, including Spot nodes. Unless another partition is marked as the default, all is the default partition, so a job submitted without -p can run on a Spot node. Ask users to submit jobs that can’t be interrupted to an on-demand partition.
To require every job to choose a partition, disable the all partition:
Disable the all partition
-p. This also applies to Pods scheduled by the SUNK Pod Scheduler without the sunk.coreweave.com/partition annotation. For more information about partitions, see partitions.
Configure preemption handling
The Syncer’s preemption controller is on by default. It requeues Slurm jobs on any Node whose warning label is set to"true". On SUNK Standard, you configure it in syncer.config.syncer.nodesetUpdateJobPreemption in the Slurm chart values. For every field and its default, see syncer.config.syncer in the Slurm parameters reference. SUNK Self-Service doesn’t expose these fields, so SUNK Self-Service clusters always use the defaults, so jobs that Slurm can’t requeue are canceled. These settings apply only to Spot preemption warnings, not to NodeSet rolling updates or scale-down.
Jobs that Slurm cannot requeue
Slurm can’t requeue jobs submitted with--no-requeue, jobs submitted without --requeue on a cluster with JobRequeue=0, and interactive salloc or srun allocations. With the default syncer.config.syncer.nodesetUpdateJobPreemption.onNotRequeueable: cancel, these jobs end as CANCELLED and run their Epilog. Set onNotRequeueable: ignore only if you want them to keep running until the Node is removed.
Set the checkpoint window
KillWait is the time Slurm gives a job to checkpoint and exit. It’s the time between SIGTERM and SIGKILL, and it defaults to 30 seconds on SUNK. To give jobs more time to checkpoint, raise it in slurmConfig on SUNK Standard, or in spec.slurmConfig on SUNK Self-Service:
KillWait doesn’t extend the warning window. If CoreWeave drains the Node while the job is still checkpointing, the job’s processes stop immediately. The job is already requeued, so it still runs again, but its checkpoint might be only partially written. Keep KillWait plus the Epilog well under the warning window. Keep the previous checkpoint until a new one is completely written, so an interrupted write doesn’t leave the job with nothing to resume from.
KillWait applies to every job termination, including scancel and time limits, not only to Spot preemption.
Submit a job to Spot capacity
A job that runs on Spot capacity must survive being stopped and started again. We recommend that you submit a job with--requeue, so it stays eligible for requeue even if the cluster’s JobRequeue default changes. --requeue isn’t required. By default, a job that Slurm can’t requeue is canceled instead, as described in Jobs that Slurm cannot requeue. Also use --open-mode=append, so a requeued run doesn’t overwrite its earlier output.
Target Spot capacity with the Spot partition. In this example, replace SPOT_PARTITION with the name of the Spot partition, such as h100-spot on SUNK Self-Service or slurm-h100-spot on SUNK Standard. Replace TRAINING_COMMAND with your training command, which must resume from its latest checkpoint:
spot-training.sbatch
ON_DEMAND_PARTITION with the name of an on-demand partition, such as h100 on SUNK Self-Service:
SIGTERM by saving a checkpoint and exiting within KillWait. On restart, it must detect the requeue and resume from that checkpoint. Slurm sets SLURM_RESTART_COUNT on every restart. For complete examples, see Handle Slurm signals for graceful shutdown and Checkpoint and restart Slurm jobs after a node failure. Store checkpoints somewhere every node can reach, such as CoreWeave AI Object Storage, because a requeued job can start on different nodes.
Verify
After a Spot preemption, check what happened to the jobs that were running on the Slurm node whose Spot Node CoreWeave reclaimed. From a Slurm login node, replaceJOB_ID with the job ID:
Example output
REQUEUED entry followed by a new run with the same job ID and a higher Restarts count. Before the new run starts, squeue might show the job as pending with the reason BeginTime. A job that couldn’t be requeued shows CANCELLED. A NODE_FAIL entry means the job was still running when the Kubernetes Node drained, for example because the warning window ended before SUNK requeued it, or because onNotRequeueable: ignore left a job that Slurm couldn’t requeue running. If the job is eligible for requeue, a new run with the same job ID follows the NODE_FAIL entry. A job that Slurm can’t requeue ends at NODE_FAIL.
To watch for preemption warnings from Kubernetes, see Monitor preemption events.
Related pages
- Spot Node Pools: Spot availability, the preemption timeline, and usage monitoring.
- Bind NodeSets to Node Pools for SUNK Standard: matching Node Pool labels and taints in a NodeSet.
- Syncer: how SUNK keeps Slurm node state in sync with Kubernetes.
- Handle Slurm signals for graceful shutdown: signal handlers and
KillWait. - Checkpoint and restart Slurm jobs after a node failure: resuming a requeued job from its last checkpoint.
- SunkCluster reference: the
computeClassfield.