cluster_apply: Parallelize function calls on LSF cluster.

View source: R/cluster_execution.R

cluster_applyR Documentation

Parallelize function calls on LSF cluster.

Description

Run function for each row of input dataframe in LSF job.

Usage

cluster_apply(
  df_iter,
  func,
  .bsub_params = c("-n", "2", "-W", "24:00", "-R", "rusage[mem=10000]"),
  .tempdir = ".",
  .packages = c(),
  ...
)

Arguments

df_iter

Dataframe over whose rows to iterate.

func

Function to apply to each dataframe row. Its arguments must be all dataframe columns.

.bsub_params

Parameters to pass to 'bsub' during job submission.

.tempdir

Location to store auxiliary files in.

.packages

Packages to import in each job.

...

Extra arguments for function.

Value

Dataframe created by concatenating results of each function call.

Examples

## Not run: 
foo <- 42
cluster_apply(
  data.frame(i = seq_len(3), group = c("A", "B", "C")),
  function(i, group) {
    log_debug("hello")
    data.frame(group = group, i = i, foo = foo, result = foo + 2 * i)
  },
  .packages = c(logger)
)

## End(Not run)

cbg-ethz/pareg documentation built on July 20, 2023, 7:30 p.m.