Skip to contents

Executes a list of fmri_jobs, returning an fmri_batch_result. By default each job is isolated: a failure is captured rather than aborting the batch. Set parallel = TRUE to dispatch through the active future::plan() (e.g. multisession, cluster, or a future.batchtools cluster backend).

Usage

run_jobs(
  jobs,
  parallel = FALSE,
  progress = FALSE,
  on_error = c("isolate", "stop"),
  backend = NULL
)

Arguments

jobs

A single fmri_job or a list of them.

parallel

Logical shorthand; TRUE selects the "future" backend, FALSE the "sequential" one. Ignored if backend is given.

progress

Logical; per-job fitting progress.

on_error

Either "isolate" (default; capture per-job errors) or "stop" (fail the batch on the first error).

backend

Optional execution backend name (see run_backends()). Overrides parallel. The "future" backend honours the active future::plan() (including future.batchtools cluster plans).

Value

An object of class fmri_batch_result.

Examples

if (FALSE) { # \dontrun{
jobs <- instantiate(tmpl, manifest)
future::plan(future::multisession, workers = 4)
res <- run_jobs(jobs, parallel = TRUE)
values <- batch_values(res)
} # }