Write a small script that can be used to launch a rrq worker. The resulting script takes the same arguments as the rrq_worker constructor, but from the command line. See Details.
Arguments
- path
The path to write to. Should be a directory (or one will be created if it does not yet exist). The final script will be
file.path(path, "rrq_worker")- versioned
Logical, indicating if we should write a versioned R script that will use the same path to
Rscriptas the running session. IfFALSEwe use#!/usr/bin/env Rscriptwhich will pick upRscriptfrom the path. You may want to use a versioned script in tests or if you have multiple R versions installed simultaneously.
Details
If you need to launch rrq workers from a script, it's convenient not to have to embed R code like:
as this is error-prone and unpleasant to quote and read. You can
use the function rrq_worker_script to write out a small helper
script which lets you write:
instead.
The helper script supports the same arguments as
the [rrq::rrq_worker] constructor:
queue_idas the sole positional argumentname_configas--configworker_idas--worker-id
To change the redis connection settings, set the REDIS_URL
environment variable (see redux::hiredis() for details).
For example to create a worker myworker with configuration
myconfig on queue myqueue you might use