fix(trimgalore): stack process_low_memory on top of process_low#11541
Merged
pinin4fjords merged 4 commits intonf-core:masterfrom May 7, 2026
Merged
Conversation
Now that nf-core/tools#4264 has merged and the pipeline-template `base.config` defines `process_low_memory` (1 GB * task.attempt), the trimgalore module can drop its memory ceiling without giving up the cpu/time bands set by process_low. Composed budget on first attempt: - cpus = 2 (process_low; 1 worker thread paired) - memory = 1 GB (process_low_memory; ~10x observed peak_rss of ~100 MB on 30M PE) - time = 4 h (process_low; ~160x observed runtime of ~1.5 min on 30M PE) The tool itself caps trim_galore --cores at 8 worker threads, so allocating more cpus is wasted unless paired with very large inputs; pipelines that genuinely need that throughput can override per-process or stack `process_high` instead. This is the conservative default that satisfies Felix's original 100 MB / 10 min ask while keeping existing 1-worker-paired throughput intact for typical use.
The template's process default is cpus=1 / time=4.h, which is what process_low_memory already inherits when no other resource label is applied. process_low's cpus=2 changes nothing useful here: trim_galore's --cores formula (`cores = max(1, task.cpus - 4)` paired) saturates at 1 worker thread for any cpus <= 5, so 1 vs 2 cpus gives the same worker count. Drop the redundant label.
Stack process_medium with process_low_memory so the cpu allocation is enough to give trim_galore 2 paired worker threads on production data, while keeping the memory ceiling tight at 1 GB. trim_galore's --cores formula derives worker count from task.cpus: cores = max(1, task.cpus - 4) // paired cores = max(1, task.cpus - 3) // single (capped at 8) Implications: - cpus = 1 (default) -> 1 worker thread paired - cpus = 2 (process_low) -> 1 worker thread paired (no gain) - cpus = 6 (process_medium) -> 2 worker threads paired (~2x throughput) - cpus = 12 (process_high) -> 8 worker threads paired (saturates the cap) process_medium is the cheapest band that crosses the 1->2 worker threshold, where actual trimming throughput first improves. Useful for real production inputs (100M+ PE) where the extra worker materially shortens wall time; small test data won't notice the difference. Memory stays at process_low_memory's 1 GB regardless.
Contributor
|
Why not just hardcode it for now. Like the bwa/index module: https://github.com/nf-core/modules/blob/master/modules/nf-core/bwa/index/main.nf#L5 |
Member
Author
The label is a thing now anyway nf-core/tools#4264, no need to hard code |
ewels
approved these changes
May 6, 2026
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.
Summary
Replaces
label 'process_low'withprocess_medium+process_low_memory(the latter shipped in nf-core/tools#4264).Effective first-attempt budget: 6 cpus / 1 GB / 8 h.
Why
#11531 couldn't drop memory below 12 GB without also losing the cpu band;
process_low_memorynow lets us pick the axes independently.process_mediumis the first cpu band where trim_galore actually gets a second worker thread (cores = max(1, task.cpus - 4)paired → 2 workers at cpus=6, still 1 at cpus≤5). Memory drops to 1 GB, ~10× the observed ~100 MB peak on 30M PE.Downstream
Requires the consuming pipeline's
base.configto defineprocess_low_memory(synced from a tools release including #4264). Otherwise memory falls through to the process default; the module still works.