Quick question about expected scheduling behaviour...
# help
y
Quick question about expected scheduling behaviour. I’m seeing downstream processes wait until all upstream tasks for a sample set finish before any downstream tasks start. For example:
Copy code
executor >  slurm (6)
[4d/0abfaf] YPE…RBASE:FASTQC (sub_tes33d6) | 0 of 3
[6a/6d8f03] YPE…BASE:FASTP (sub_spike0125) | 2 of 3
[-        ] YPE…NCLE_FGBIO_PERBASE:BWA_MEM -

executor >  slurm (6)
[2a/cfa7f3] YPE…ASE:FASTQC (sub_spike0125) | 1 of 3
[6a/6d8f03] YPE…BASE:FASTP (sub_spike0125) | 2 of 3
[-        ] YPE…NCLE_FGBIO_PERBASE:BWA_MEM -

executor >  slurm (9)
[4d/0abfaf] YPE…RBASE:FASTQC (sub_tes33d6) | 3 of 3 ✔
[fd/92aa1d] YPE…ERBASE:FASTP (sub_tes33d6) | 3 of 3 ✔
[50/b7a700] YPE…BASE:BWA_MEM (sub_tes33d6) | 0 of 3
It looks like BWA_MEM only starts once all 3 FASTP tasks for that sample have finished, rather than as each FASTP task completes. Is that expected Nextflow behaviour? Or is there a way to configure Nextflow (or Slurm/executor) to let downstream tasks be scheduled as each upstream task finishes (like a per-task streaming)?
n
This is usually due to some channel operation that waits for the full channel(s) (such as
join
)
y
Don’t think there’s any join or collect operators though
Copy code
FASTP(
        ch_samplesheet,
        params.adapter_fasta,
        params.discard_trimmed_pass,
        params.save_trimmed_fail,
        params.save_merged,
    )

    BWA_MEM(
        FASTP.out.reads,
        tuple("index_meta", params.bwa_index),
        tuple("fasta_meta", params.bwa_ref_fasta),
        params.bwa_samsort,
    )
n
Doesnt look like it. If you have set the slurm executor to use arrays it will also wait for all (or enough to fill the array) tasks to arrive before submitting the array
😮 1
💯 1
y
I see! I’ve indeed been using arrays since they’re supposed to help with SLURM scheduling, but if they actually block task streaming, that’s a real drawback
n
Yeah they do help reduce load on the slurm scheduler, but they can only be submitted once everything is ready. I feel like this requires optimization at the pipeline config, there may be steps that can be arrays (initial tasks, something that produces many tasks from one input), but overall I also feel like arrays extend total execution time, due to waiting
t
FWIW, someone who is helping with the administration of the cluster I use recommended against using arrays when optimizing for speed. I use them outside the pipeline for convenience, and for those tasks there doesn't seem to be a huge difference, but I don't use them for the pipeline (since Nextflow coordinates the individual jobs, so I don't have to).
n
Yup, I also tend to not use them, but for example I have been approached by our HPC people about how nextflow seems to be somewhat stressful for the slurm backend, and arrays can contribute to reducing load on the scheduler. As I understand, especially during backfilling, an array of size X is checked once if a job would fit, but with 200 individual, but identical jobs this is done 200 times
👍 1