Learn R Programming

PubChemR (version 3.0.0)

pc_resume_batch: Resume a Checkpointed Batch Workflow

Description

Reloads a previously checkpointed `pc_batch()` run and executes pending or failed chunks.

Usage

pc_resume_batch(
  fn,
  checkpoint_dir,
  checkpoint_id,
  parallel = FALSE,
  workers = NULL,
  rerun_failed = TRUE,
  ...
)

Value

A typed `PubChemBatchResult` object.

Arguments

fn

Function to run on each pending chunk.

checkpoint_dir

Directory containing checkpoint manifest/files.

checkpoint_id

Checkpoint run id.

parallel

Logical; use parallel execution where supported.

workers

Number of workers.

rerun_failed

Logical; rerun chunks previously marked as failed.

...

Additional arguments passed into `fn`.

Details

This helper reads the batch manifest created by `pc_batch()` and preserves the original chunking strategy.

Examples

Run this code
cp_dir <- tempdir()
cp_id <- "pc-doc-example"

pc_batch(
  ids = 1:4,
  fn = function(chunk_ids, ...) sum(chunk_ids),
  chunk_size = 2,
  checkpoint_dir = cp_dir,
  checkpoint_id = cp_id
)

resumed <- pc_resume_batch(
  fn = function(chunk_ids, ...) sum(chunk_ids),
  checkpoint_dir = cp_dir,
  checkpoint_id = cp_id
)
resumed$checkpoint$resumed

Run the code above in your browser using DataLab