Allow multiple SLURM partitions for structure inference#50
Merged
DimaMolod merged 1 commit intoJul 8, 2026
Merged
Conversation
`slurm_partition` in config.yaml accepted only a single partition, so GPU inference jobs were pinned to one queue. SLURM's `sbatch -p` natively takes a comma-separated partition list and starts the job on whichever partition frees up first, so support that here. Add `normalize_partitions()` in common.smk: it accepts a single name, a comma/space-separated string, or a YAML list and emits a de-duplicated, comma-joined string (no spaces, so it survives the plugin's shlex.quote and reaches sbatch verbatim). The Snakefile runs the config value through it before setting the `slurm_partition` resource; only structure_inference uses it. Documented in config.yaml and README; removed the now-obsolete "multi-partition routing is out of scope" note. Added unit tests (test_normalize_partitions.py). Verified on the EMBL cluster: config `[gpu-el8, transform]` produced `sbatch -p gpu-el8,transform`, and SLURM scheduled the job onto the free `transform` partition (H100 node) to COMPLETED. Co-Authored-By: Claude Opus 4.8 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
slurm_partitioninconfig/config.yamlaccepted only a single partition, so GPUstructure_inferencejobs were pinned to one queue and stuck waiting whenever that partition was busy — even if another GPU partition (e.g.gpu-training/transform) had idle nodes.Change
SLURM's
sbatch -pnatively accepts a comma-separated partition list and starts the job on whichever partition frees up first. This PR letsslurm_partitionbe several partitions and forwards them to the plugin (which passes them straight tosbatch -p).normalize_partitions()(new, inworkflow/rules/common.smk, unit-testable): accepts any of- a single name —
- a comma/space-separated string —
- a YAML list —
and emits a de-duplicated, order-preserving, comma-joined string ("gpu-el8"(unchanged behaviour),"gpu-el8, gpu-training",gpu-el8,gpu-training). No spaces, so it survives the SLURM plugin'sshlex.quoteunquoted and reachessbatchverbatim.Snakefile:DEFAULT_SLURM_PARTITIONnow runs the config value throughnormalize_partitions. Onlystructure_inferenceuses it; the CPU rules keep using the cluster default partition.config.yaml+ README document multi-partition usage; removed the now-obsolete "multi-partition routing is out of scope" note. Every listed partition must accept the job's GPUs/--mem/walltime (structure_inference_max_runtime≤ each partition'sMaxTime); a partition the job doesn't fit is simply skipped by SLURM.Testing
test/test_normalize_partitions.py(8 cases: single/list/comma/whitespace inputs, dedup,None/empty,shlex.quoteno-op). Full suite: 38 passed.slurm_partition: [gpu-el8, transform], Snakemake (slurm executor) builtsbatch ... -p gpu-el8,transform ...and SLURM scheduled the job onto the freetransformpartition (H100 nodehgx1), running on GPU toCOMPLETED(exit 0). Verified the plugin path is version-agnostic (installed1.9.2and workspace2.0.0both pass the partition throughshlex.quoteunchanged).🤖 Generated with Claude Code