Skip to contents

Sends a task to a specific worker and waits for the result.

Usage

pool_dispatch(
  worker_id,
  expr,
  envir = parent.frame(),
  pool = NULL,
  timeout = 3600
)

Arguments

worker_id

Integer. Worker to dispatch to.

expr

Expression to evaluate.

envir

Environment containing variables needed by expr.

pool

A shard_pool object. If NULL, uses the current pool.

timeout

Numeric. Seconds to wait for result (default 3600).

Value

The result of evaluating expr in the worker.

Examples

# \donttest{
p <- pool_create(2)
pool_dispatch(1, quote(1 + 1), pool = p)
#> [1] 2
pool_stop(p)
# }