Skip to contents

A wrapper around parallel::parLapply() that handles evoland_db connection management. It uses a PSOCK cluster (via parallel::makeCluster()) to support Windows and ensures a clean environment for each worker.

Usage

run_parallel_task(items, worker_fun, db, cores = 1L, ...)

Arguments

items

A list or vector of items to iterate over.

worker_fun

A function to apply to each item. Must accept item as the first argument and db (the database instance) as the second argument.

db

The current evoland_db instance (typically self).

cores

Integer. Number of cores to use.

...

Additional arguments passed to worker_fun.

Value

A list of results, same as lapply().