Skip to content

feat(spur-cli): add -w/--nodelist and -x/--exclude to srun and salloc #375

Description

@shiv-tyagi

Problem

srun and salloc do not accept -w/--nodelist (or -x/--exclude). sbatch accepts both. This breaks a common Slurm workflow: pinning an interactive or parallel job to specific nodes.

$ spur srun -w node1 hostname
Error: error: unexpected argument '-w' found

$ spur sbatch --help
  -w, --nodelist <NODELIST>

Root cause

This is a CLI wiring gap, not a scheduler limitation. SrunArgs and SallocArgs have no nodelist/exclude fields and never populate JobSpec.nodelist / JobSpec.exclude.

The backend already supports both end to end:

  • Proto: JobSpec.nodelist (proto/slurm.proto:113), JobSpec.exclude (:114)
  • sbatch already sets them (crates/spur-cli/src/sbatch.rs)
  • The backfill scheduler honors nodelist as an allow-list and exclude as a deny-list (crates/spur-sched/src/backfill.rs:76)

Expected behavior

  • srun -w <nodes> and salloc -w <nodes> restrict placement to the listed nodes.
  • srun -x <nodes> and salloc -x <nodes> exclude the listed nodes.
  • CLI flags override any env-var defaults, matching sbatch.

Acceptance criteria

  • SrunArgs gains -w/--nodelist and -x/--exclude, wired into JobSpec
  • SallocArgs gains -w/--nodelist and -x/--exclude, wired into JobSpec
  • srun -w <node> runs only on that node; srun -x <node> avoids it
  • Behavior matches sbatch for the same flags

Notes

Scope is comma-separated explicit node names. Slurm hostlist patterns (node[001-010]) are out of scope here; the scheduler filter currently does exact-name matching, and sbatch -w has the same limitation today. Track pattern expansion separately if needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions