knitr::opts_chunk$set(
  collapse = TRUE,
  error = FALSE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

rrq

Project Status: WIP - Initial development is in progress, but there has not yet been a stable, usable release suitable for the public. R-CMD-check codecov.io CodeFactor

Task queues for R, implemented using Redis.

Getting started

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)

Installation

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)

Testing

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)

License

MIT © Imperial College of Science, Technology and Medicine



mrc-ide/rrq documentation built on April 25, 2024, 11:59 p.m.