knitr::opts_chunk$set( collapse = TRUE, error = FALSE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
Task queues for R, implemented using Redis.
library(rrq)
Create an rrq_controller
object
obj <- rrq_controller("rrq:readme") rrq_default_controller_set(obj)
Submit work to the queue:
t <- rrq_task_create_expr(runif(10)) t
Query task process:
rrq_task_status(t)
Run tasks on workers in the background
rrq_worker_spawn()
Wait for tasks to complete
rrq_task_wait(t)
Retrieve results from a task
rrq_task_result(t)
Query what workers have done
rrq_worker_log_tail(n = Inf)
For more information, see vignette("rrq")
rrq_destroy(timeout_worker_stop = 10)
Install from the mrc-ide package repository:
drat:::add("mrc-ide") install.packages("rrq")
Alternatively, install with remotes
:
remotes::install_github("mrc-ide/rrq", upgrade = FALSE)
To test, we need a redis server that can be automatically connected to using the redux
defaults. This is satisfied if you have an unauthenticated redis server running on localhost, otherwise you should update the environment variable REDIS_URL
to point at a redis server. Do not use a production server, as the package will create and delete a lot of keys.
A suitable redis server can be started using docker with
./scripts/redis start
(and stopped with ./scripts/redis stop
)
MIT © Imperial College of Science, Technology and Medicine
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.