Skip to contents

Defines the bakerrr S7 class for parallel and background job execution. Stores the function to run (fun), argument lists (args_list), background job arguments (bg_args), job objects, results, and runtime properties. Supports retrieval of job status/results and validation of provided properties.

Usage

bakerrr(
  fun,
  args_list,
  bg_args = list(),
  n_daemons = ceiling(parallel::detectCores()/5),
  cleanup = TRUE
)

Arguments

fun

Function to be executed for each job.

args_list

List of argument sets for each job.

bg_args

List of arguments passed to background job handler.

n_daemons

Number of parallel workers (default: ceiling of cores/5).

cleanup

Logical; whether to clean up jobs after execution (default: TRUE).

Value

An S7 bakerrr class object with job orchestration methods and properties.

Examples

# Create a bakerrr object to process jobs in parallel
bakerrr::bakerrr(fun = sum, args_list = list(list(1:10), list(10:20)))
#> 
#> 🔄 bakerrr
#> ├─ Status: CREATED
#> ├─ Function: .Primitive("sum")
#> ├─ Args: 2 sets
#> ├─ Daemons: 7
#> ├─ Cleanup: enabled
#> ├─ Result:
#>      └─  - bakerrr:: Job not started. Start job by calling