powered by
Splits identifier vectors into chunks, applies a worker function per chunk, and records per-chunk success and error metadata.
pc_batch( ids, fn, chunk_size = 100, parallel = FALSE, workers = NULL, checkpoint_dir = NULL, checkpoint_id = NULL, resume = FALSE, rerun_failed = TRUE, ... )
A typed `PubChemBatchResult` object.
Identifier vector.
Function to run on each chunk of `ids`.
Chunk size.
Logical; use parallel execution.
Number of workers.
Optional directory to persist per-chunk checkpoint files.
Optional checkpoint run id. If `NULL`, a deterministic id is generated.
Logical; resume from an existing checkpoint manifest.
Logical; when resuming, rerun chunks previously marked as failed.
Additional arguments passed into `fn`.
Checkpoint files can be written to disk and resumed later. Parallel execution is available on supported platforms when checkpointing is disabled.
batch <- pc_batch( ids = 1:6, fn = function(chunk_ids, ...) sum(chunk_ids), chunk_size = 2 ) length(batch$results)
Run the code above in your browser using DataLab