| name | flux |
| description | Commands for running and monitoring jobs on a Flux (flux-framework) HPC scheduler: submitting jobs, checking whether a job is running, reading job output and exit codes, and cancelling jobs. Use this whenever a task involves submitting, monitoring, inspecting, or cancelling work on a Flux cluster, or running builds / test suites / model serving on compute nodes rather than the login node. Trigger it on any mention of `flux submit`, `flux run`, `flux jobs`, `flux batch`, Flux job IDs, or "is my job running / done" on an HPC system where Flux is the main scheduler.
|
Flux job management
Flux is a resource manager / scheduler used on HPC clusters. Use it to run
anything heavy — builds, test suites, model serving, data processing — as a job
on compute nodes. Do not run heavy work directly on the login node.
Queue names, bank/account, and node counts are cluster-specific. This skill
covers the generic commands only; get the per-machine values (queue, bank,
typical -N/-n) from the project's machine-specific setup notes before
submitting. In general, you want to use --exclusive when you request nodes.
Interactive allocations
flux alloc -B <bank> --exclusive -N1 -q pdebug -t 1h
flux alloc -B <bank> --exclusive -N4 -t 8h
Submitting jobs
flux submit ./script.sh
flux run ./script.sh
flux batch ./batch.sh
flux submit -N2 -n8 ./script.sh
flux submit --queue=<queue> --name=<name> ./script.sh
A batch script declares its resources with # flux: directive lines, e.g.:
#!/bin/sh
flux run -n16 ./my_step.sh
Checking whether a job is running
flux jobs
flux jobs -a
flux jobs --filter=running
flux job last
Reading output and exit code
flux submit --watch ./script.sh
flux job attach $(flux job last)
flux submit --output=job-{{id}}.out ./script.sh
flux jobs --no-header -o '{status}:{returncode}' <jobid>
A non-zero returncode means the job failed — inspect its output before assuming
the step succeeded. Do not report a job as "passed" until you have confirmed both
that it is inactive and that its return code is 0.
Cancelling jobs
flux cancel <jobid>
flux cancel --all
flux cancel --states=RUN
Inspecting resources
flux resource list
flux uptime
flux overlay status
Notes for agents
- Prefer
flux submit (non-blocking) for long work, then poll with flux jobs;
use flux run only for quick interactive checks.
- Always capture the job ID from
flux submit (or use flux job last) so you can
check status and output later.
- Never launch a full model-serving stack or a long test run on the login node —
submit it as a Flux job.
Full command reference: https://flux-framework.org/cheat-sheet/