View source: R/worker_runner.R
| rrq_worker_script | R Documentation |
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.
rrq_worker_script(path, versioned = FALSE)
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 |
versioned |
Logical, indicating if we should write a
versioned R script that will use the same path to |
If you need to launch rrq workers from a script, it's convenient not to have to embed R code like:
Rscript -e 'rrq::rrq_worker$new("myqueue")'
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:
./path/rrq_worker myqueue
instead.
The helper script supports the same arguments as
the [rrq::rrq_worker] constructor:
queue_id as the sole positional argument
name_config as --config
worker_id as --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
./rrq_worker --config=myconfig --worker-id=myworker myqueue
Invisibly, the path to the script
path <- rrq::rrq_worker_script(tempfile())
readLines(path)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.