Skip to content

fix(slurm): make slurm submit and slurm convert output launchable - #1329

Merged
scttfrdmn merged 1 commit into
mainfrom
fix/1217-1242-slurm-bridge
Oct 26, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
fix/1217-1242-slurm-bridge

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Fixes #1217
Fixes #1242

What changed

#1217, spawn slurm submit

  • The hand-off to spawn launch now includes a spore name: slurm.SporeName takes --job-name, else the script's file name, else slurm-job, and reduces it to a valid DNS label (lowercase [a-z0-9-], 63 chars max). Launch registers the name in DNS and uses it as the hostname, and a Slurm job name is free text.
  • It passes --no-detach. A detached sweep launches its rows with no user data, so the job script would never run (Detached sweep members launch with no UserData, so spored never runs on them (#725 follow-up; blocks #1313) #1323).
  • An --array=...%N limit becomes --max-concurrent N. max_concurrent: is a param-file key that launch rejects.
  • The converted file is pinned to the region the cost was quoted for (est.Region), so the launch can't land in a region nobody priced.
  • It converts before the cost prompt, so a job that can't be converted fails before the user says yes.
  • The dead --spot propagation is removed: slurm submit has no --spot flag, and spot comes from the script's #SPAWN --spot.

#1242, spawn slurm convert

  • Job scripts now go under the row key command: (was script:, which launch always rejected).
  • Each array member gets its own valid name.
  • max_concurrent is no longer written.
  • The printed launch line is the real argv. It used to say spawn launch --params, which is not implemented.
  • Multi-node MPI jobs are refused, with a pointer to spawn launch --mpi --count N. The old output launched one instance with PARAM_mpi/PARAM_count and no MPI setup. Follow-up: slurm convert/submit: support multi-node MPI jobs (--nodes > 1) #1328.

Launch side (outside the slurm area, kept minimal): cmd/sweep.go, cmd/launch_config.go

  • A sweep row's command: rode only the spawn:command tag. EC2 caps tag values at 256 chars, so any real job script was refused at RunInstances. A row command the tag can't carry (over 256 chars, or multi-line) is now embedded in that row's user data, the same way a single launch's --command is (nonSweepCommand was renamed embeddedCommand). Short one-line commands keep the tag path unchanged.
  • Side effect: a row's command: now beats a CLI --command, which matches the documented precedence (row > flag). Before, the CLI value got the tag first and appendTagUnique dropped the row's.

Gates (each watched failing against a compiling revert)

  • TestSlurmSubmitArgvIsAcceptedByLaunch resolves the exact argv through rootCmd.Find, then launch's own flag set, then launchCmd.Args (the real launchNameArgs). It also checks the name with isValidDNSName, plus --no-detach and --max-concurrent.
    • Revert: drop the name. Fails with "a spore name is required".
    • Revert: drop --no-detach. Fails.
  • TestSlurmConvertOutputIsAcceptedByLaunch converts real sbatch scripts (a single task, and an array with a step and a %N limit, whose body is longer than 256 chars). It writes the YAML and runs it through parseParamFile, validateTopLevelParamKeys, validateSweepParamKeys, validateSweepDurations and sweepRowsWithoutBound. For each row it then runs buildLaunchConfigFromParams and buildUserData, and requires the script body and the right SLURM_ARRAY_TASK_ID in the user data, the user data within EC2's size limit, no tag over 256 chars, and distinct valid names.
    • Revert: script key. Fails as unusable keys.
    • Revert: max_concurrent restored. Fails as an unusable key.
    • Revert: embedding. Fails with the script not in the user data.
    • Revert: tag always set. Fails with an 816/977-char tag.
    • Revert: raw job name. Fails with an invalid spore name.
  • TestSweepRowCommandTheTagCannotCarryIsEmbedded covers the tag-vs-embed split and the row-beats-CLI precedence.

Checks

  • make lint: 0 issues in all 10 modules.
  • make check: everything passes up to check-build-tags, which fails on the /private/tmp path issue that is present on unmodified main. It lists only test/e2e files.
  • make gen-docs + make check-docs: clean. The slurm convert help text changed.
  • semgrep --config=auto --error on the changed files: 0 findings.
  • No AWS calls. Not run end to end on AWS.

Not covered / known

@codecov

codecov Bot commented Oct 26, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 23.91304% with 35 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/slurm/convert.go 0.00% 27 Missing ⚠️
cmd/slurm.go 36.36% 7 Missing ⚠️
cmd/sweep.go 80.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

slurm submit handed off to `spawn launch --param-file` with no spore name,
which launch refuses, so every submit failed after the cost was approved
(#1217). It now passes a name derived from --job-name (else the script's
file name) reduced to a valid DNS label, launches in the foreground
(--no-detach: detached sweeps run no row commands, #1323), carries %N as
--max-concurrent, and pins the file to the region the cost was quoted in.

slurm convert put each job script under `script:`, which launch rejects
(#1242). Scripts now go under `command:`; a sweep row's command that the
256-char spawn:command tag cannot carry is embedded in the row's user
data instead. max_concurrent is no longer written as a param key, array
members get distinct valid names, and multi-node MPI jobs (which a param
file cannot express) are refused before the cost prompt.

Gates run argv through launch's own Args validator and the converted
file through launch's parser, key/duration validators, config builder
and user-data builder.

Fixes #1217
Fixes #1242
@scttfrdmn
scttfrdmn force-pushed the fix/1217-1242-slurm-bridge branch from daf1cc8 to bbf56fc Compare October 26, 2026 22:27
@scttfrdmn
scttfrdmn merged commit 42942ec into main Oct 26, 2026
9 checks passed
@scttfrdmn
scttfrdmn deleted the fix/1217-1242-slurm-bridge branch October 26, 2026 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant