Learn R Programming

doRedis (version 3.0.2)

redisWorker: Initialize a doRedis worker process.

Description

The redisWorker function enrolls the current R session in one or more doRedis worker pools specified by the work queue names. The worker loop takes over the R session until the work queue(s) are deleted, after which the worker loop exits after the linger period, or until the worker has processed iter tasks. Running workers also terminate after network activity with Redis remains inactive for longer than the timeout period set in the redisConnect function. That value defaults internally to 30 seconds in redisWorker. You can increase it by including a timeout=n argument value.

Usage

redisWorker(
  queue,
  host = "localhost",
  port = 6379,
  iter = Inf,
  linger = 30,
  log = stderr(),
  connected = FALSE,
  password = NULL,
  loglevel = 0,
  timelimit = 0,
  ...
)

Value

NULL is invisibly returned.

Arguments

queue

work queue name or a vector of queue names

host

Redis database host name or IP address

port

Redis database port number

iter

maximum number of tasks to process before exiting the worker loop

linger

timeout in seconds after which the work queue is deleted that the worker terminates

log

print messages to the specified file connection

connected

set to TRUE to reuse an existing open connection to Redis, otherwise establish a new one

password

optional Redis database password

loglevel

set to > 0 to increase verbosity in the log

timelimit

set to > 0 to specify a task time limit in seconds, after which worker processes are killed; beware that setting this value > 0 will terminate any R worker process if their task takes too long.

...

Optional additional parameters passed to redisConnect

See Also

registerDoRedis, startLocalWorkers