Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make worker spawning in Slurm allocations more robust #741

Merged
merged 1 commit into from
Aug 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion crates/hyperqueue/src/server/autoalloc/queue/slurm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,17 @@ fn build_slurm_submit_script(
writeln!(script, "#SBATCH {sbatch_args}").unwrap();
}

let prefix = if nodes > 1 { "srun --overlap " } else { "" };
// Some Slurm clusters have a default that does not play well with simply running
// `srun`. For example, they can configure `--ntasks-per-node X` as a default option.
// We should make sure that we execute exactly the number of workers that we want, on exactly
// the number of nodes that we want. Therefore, we use `--ntasks` and `--nodes`.
// The `--overlap` parameter is then used to make sure that nested invocations within the HQ
// worker will be able to still consume Slurm resources.
let prefix = if nodes > 1 {
format!("srun --overlap --ntasks={nodes} --nodes={nodes} ")
} else {
"".to_string()
};
write!(script, "\n{prefix}{worker_cmd}").unwrap();
script
}
2 changes: 1 addition & 1 deletion tests/autoalloc/test_autoalloc.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ def test_slurm_multinode_allocation(hq_env: HqEnv):
with open(sbatch_script_path) as f:
commands = normalize_output(hq_env, "slurm", extract_script_commands(f.read()))
assert commands == snapshot(
'srun --overlap RUST_LOG=tako=trace,hyperqueue=trace <hq-binary> worker start --idle-timeout "5m"'
'srun --overlap --ntasks=2 --nodes=2 RUST_LOG=tako=trace,hyperqueue=trace <hq-binary> worker start --idle-timeout "5m"'
' --manager "<manager>" --server-dir "<server-dir>/001" --on-server-lost "finish-running" --time-limit'
' "1h"'
)
Expand Down
Loading