The Slurm connector makes Flyte submit to the cluster you already have. Your `sbatch` scripts run unchanged, each job becomes a Flyte action with typed inputs and outputs, and the results feed straight into the Python and ML steps you run off the cluster.
If you run a Slurm cluster, you have something that works. The queue is understood, the accounts and QoS are set up the way your institution wants them, and the scripts people submit have been debugged over years. What you probably don't have is an answer to "which version of the model is this, and what produced it?" six months later. Or a tidy way to get a trained model from the cluster into something that serves it.
So teams build the missing parts themselves: a wrapper script that submits and polls `squeue`, a convention about where outputs land on the shared filesystem, a cron job that notices failures, a second system for everything that happens after training. None of it is interesting work and all of it is load-bearing.
The connector's premise is that you shouldn't have to choose between the cluster and the platform. Slurm keeps scheduling. Flyte adds the recovery, the run history, and the hand-off.
Slurm with Flyte as the submitter
Jobs go over SSH to a login node, where the connector runs `sbatch`. Nothing is installed on the cluster, and Slurm itself needs no reconfiguration; partitions, accounts, QoS and reservations behave exactly as they do today, because the connector is just another component submitting jobs as a user you create for it.
From there it polls `squeue`, falls back to `sacct` for jobs that have left the queue, and falls back again to `scontrol show job` for clusters with no accounting database. Cancelling a run runs `scancel`. Job state maps onto the action:
- `PENDING` becomes queued, not running, so a long wait for an allocation doesn't read as a slow job.
- `COMPLETED` succeeds, `FAILED` fails, `CANCELLED` aborts.
- `PREEMPTED` becomes a retryable failure, so with `retries` set the step resubmits itself instead of killing the run.
That last one deserves a caveat, because it depends on your cluster. Slurm's `PreemptMode` decides what a preempted job looks like from outside. With `CANCEL`, the job ends as `PREEMPTED` and Flyte retries it. With `REQUEUE` or `SUSPEND` — more common defaults — Slurm handles it itself: the job returns to the queue under the same ID and Flyte simply reports it as queued for longer. Either way the run isn't lost. Only one of those paths is Flyte doing the work.
There are two task types, served by one connector.
Run your sbatch script on Flyte
A `slurm_script` task submits a script you already have:
Your `#SBATCH` directives are kept; the plugin adds its own below them, and `sbatch` takes the last of any duplicate. Inputs arrive as environment variables — `$FLYTE_INPUT_EPOCHS` here — and each declared output arrives as `$FLYTE_OUTPUT_MODEL`, a path the script writes to:
That's the whole change to the script: one `cp`. By default the destination is an ordinary local path and the connector moves the bytes to object storage afterwards, so the compute node needs no credentials and no cloud client. For a large artifact you flip `output_upload="job"` and the connector is handed the object-storage URI to upload to directly.
Because the script drives `srun` or `mpirun` itself, this is also the path for gang-scheduled multi-node work. The plugin doesn't wrap your launcher.
Every job leaves its generated script and its logs on the login node under `~/.flyte/jobs`. Reading that `.sbatch` file answers most questions outright, and you can re-run it by hand to separate a plugin problem from a cluster problem.
sbatch in, model out
The other task type runs your Python on the SLURM cluster. A native `slurm` task sends the task's own container image and the Flyte entrypoint to a compute node through Pyxis/Enroot or Apptainer, so typed inputs and outputs work exactly as they do anywhere else:
One program, two schedulers. `prepare` and `evaluate` run as Kubernetes pods; `train` runs as a Slurm job. The hand-off in both directions is the run's object storage — `File` and `Dir` contents are offloaded there, so what passes between steps is a reference, and neither side needs to know where the other ran.
This is the part that's usually hard to retrofit onto a wrapper script. The output of `train` is a typed, versioned artifact belonging to a specific run, not a path on `/scratch` that someone may have overwritten. Six months later the run still knows its inputs, its outputs, and the code that produced them.
Caching comes along with it, and it's worth being precise about whose caching it is: Slurm has none. It's a scheduler — submit the same script a thousand times and it runs a thousand times. Flyte computes a cache key before anything reaches the cluster, so an unchanged re-run never gets submitted. The version tracks what changes the answer: edit the script body, add or retype a declared output, or change the allocation and it invalidates. Move to a new login node or rotate the SSH key and it doesn't, because neither changes what the job computes.
A path off the cluster, if you want one
Look at `train` in that example again, then delete `plugin_config`. The same task now runs as a Kubernetes pod.
That's the migration story, and it's deliberately boring. You don't port a pipeline; you move one task at a time, and the program keeps working while the steps live in two places. Teams that want to stay on Slurm indefinitely are a supported outcome — the connector isn't a funnel. But if you're heading for Kubernetes eventually, this lets you get there without a flag day, and without the intermediate state where half your work is on a platform and the other half is in shell scripts nobody wants to touch.
Tradeoffs and current limits
This is a new integration, and you should know where its edges are.
- A native `slurm` task is single-node. It runs `srun --nodes=1 --ntasks=1` on purpose: the Flyte entrypoint isn't rank-aware, and N copies of it would each run your task body and write the same outputs. Raising `nodes` on a native task buys you an allocation you don't use. Multi-node work goes in a `slurm_script` task, which drives its own launcher.
- Transport is SSH only. `slurmrestd` isn't supported.
- Jobs are submitted as one configured SSH user. The cluster attributes all work to that account whoever launched the run, which matters if your accounting or fairshare is per-user.
- The connector won't carry a script-task output larger than 100 MB by default — above that it fails rather than streaming the bytes through a shared pod, and the fix is `output_upload="job"` so the node uploads directly. The limit is configurable on the deployment.
- A declared output the script never writes fails the task, even on exit 0. The alternative is handing a downstream step a URI to nothing.
- The Apptainer path is unit-tested but has not been run against a real Apptainer cluster. Pyxis/Enroot has.
- Native tasks need a container runtime on the compute nodes. If your cluster has neither Pyxis/Enroot nor Apptainer, script tasks are your path.
Try it
Start with a script you already trust. Wrap it in a `SlurmScriptTask`, declare one `File` output, add the `cp`, and run it — then add a Kubernetes step that reads the output and see the two show up in one run.
If you want to learn more, check out the docs.






