is there a way to process n number of files at a time? #4083
-
Hello there, I've 11 samples (11 tumors, 11 normals) that I'd like to process using nextflow pipeline I've put. At the moment all 11 are processed in parallel. Is there a way that can restrict the number of samples to process in parallel? For example process 4 at a time, then next 4 then remaining, in this case 3. I have code as: But it only takes 3 sample, remaining are not processed. I'd like to have three-three at a time. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
You can use the collate operator to group the samples into groups of 4 (including the remainder group): read_pairs_ch = Channel.fromFilePairs( params.raw_files).collate(4) Alternatively, you can use the maxForks directive to limit the number of parallel tasks. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Understood, thank you 🙏 so much. |
Beta Was this translation helpful? Give feedback.
Yes, this is because your process expects a single sample, whereas collate groups multiple samples into a tuple. This is why I suggested
maxForks
as the better way to limit the parallelism.