| Title: | Background-Parallel Jobs |
|---|---|
| Description: | Easily launch, track, and control functions as background-parallel jobs. Includes robust utilities for job status, error handling, resource monitoring, and result collection. Designed for scalable workflows in interactive and automated settings (local or remote). Integrates with multiple backends; supports flexible automation pipelines and live job tracking. For more information, see <https://anirbanshaw24.github.io/bakerrr/>. |
| Authors: | Anirban Shaw [aut, cre] (ORCID: <https://orcid.org/0000-0003-4021-513X>) |
| Maintainer: | Anirban Shaw <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.2.0 |
| Built: | 2026-05-14 08:04:48 UTC |
| Source: | https://github.com/anirbanshaw24/bakerrr |
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.
bakerrr( fun, args_list, bg_args = list(), n_daemons = ceiling(parallel::detectCores()/5), cleanup = TRUE )bakerrr( fun, args_list, bg_args = list(), n_daemons = ceiling(parallel::detectCores()/5), cleanup = TRUE )
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). |
An S7 bakerrr class object with job orchestration methods and properties.
# Create a bakerrr object to process jobs in parallel bakerrr::bakerrr(fun = sum, args_list = list(list(1:10), list(10:20)))# Create a bakerrr object to process jobs in parallel bakerrr::bakerrr(fun = sum, args_list = list(list(1:10), list(10:20)))
Executes a list of job specifications in parallel, applies the given function with error handling, and collects the results or error messages.
bg_func(jobs, n_daemons)bg_func(jobs, n_daemons)
jobs |
A list of job specifications, each containing
a function ( |
n_daemons |
Number of parallel workers |
A list of results, with error messages in case of failure.
Displays a concise summary of the bakerrr job object,
including current status,
function name, number of argument sets, daemon count,
cleanup setting, process status, and result summary.
Outputs a status icon and key runtime information for
quick inspection.
x |
A |
... |
Additional arguments (currently ignored). |
The input x, invisibly, after printing the summary.
Initiates background execution for a bakerrr job object,
launching jobs via callr::r_bg.
Stores process status in bg_job_status.
run_bg(x, ...)run_bg(x, ...)
x |
A |
... |
Not used. For future expansion. |
The input x, invisibly, after launching background jobs.
Launches the parallel jobs, manages daemon setup (mirai::daemons),
initiates background jobs, provides a console spinner for progress,
and optionally waits for results. Cleans up daemons after execution.
run_jobs(job, wait_for_results, ...)run_jobs(job, wait_for_results, ...)
job |
A |
wait_for_results |
Logical; whether to block and wait for completion (default: TRUE). |
... |
Not used. For future expansion. |
The updated bakerrr job object, invisibly.
Returns job status as "waiting", "running", or "done".
status(x, ...)status(x, ...)
x |
A |
... |
Further arguments (ignored). |
One of "waiting", "running", "done".
Provides a one-line summary of a bakerrr job object,
indicating the status,
function name, number of worker daemons, and total jobs.
Prints a status icon and brief job info.
summary(x, ...)summary(x, ...)
x |
A |
... |
Additional arguments (currently ignored). |
The input x, invisibly, after printing the summary.