Learn R Programming

shard (version 0.1.0)

pool_dispatch: Dispatch Task to Worker

Description

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
)

Value

The result of evaluating expr in the worker.

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).

Examples

Run this code
# \donttest{
p <- pool_create(2)
pool_dispatch(1, quote(1 + 1), pool = p)
pool_stop(p)
# }

Run the code above in your browser using DataLab