Skip to main content

run_parallel_chunks

Function run_parallel_chunks 

Source
pub fn run_parallel_chunks<J, T, F>(
    jobs: &[J],
    parallelism: usize,
    stage_name: &'static str,
    run_job: F,
) -> Result<Vec<T>>
where J: Sync, T: Send, F: Fn(&J) -> Result<T> + Sync,
Expand description

Run run_job across jobs with bounded parallelism. Returns the per-job results in submission order.

stage_name is embedded in the panic error message so a crash in one stage is attributable at a glance ("nfpm worker thread panicked" vs "snapcraft worker thread panicked").

parallelism is clamped to >= 1 internally, so callers can pass ctx.options.parallelism without pre-clamping.