redisWorker {doRedis}R Documentation

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

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

Value

NULL is invisibly returned.

Note

The worker connection to Redis uses a TCP timeout value of 30 seconds by default. That means that the worker will exit after about 30 seconds of inactivity. If you want the worker to remain active for longer periods, set the timeout option to a larger value.

Use the linger option to instruct the worker to linger for up to the indicated number of seconds after the listening work queue has been removed. After at most that interval, the worker will exit after removing the queue.

See Also

registerDoRedis, startLocalWorkers


[Package doRedis version 3.0.2 Index]