Package 'tinyqueue'

Title: A Simple Task Queue
Description: A task queue is provided with simple operator modeled after existing task queue functionality. By relying on either Redis or Valkey as a backend, a suitable degree of concurrency of worker nodes is provided.
Authors: Dirk Eddelbuettel [aut, cre]
Maintainer: Dirk Eddelbuettel <[email protected]>
License: GPL (>= 2)
Version: 0.0.1
Built: 2026-05-21 09:35:59 UTC
Source: https://github.com/eddelbuettel/tinyqueue

Help Index


A Simple Task Queue

Description

A task queue is provided with simple operator modeled after existing task queue functionality. By relying on either Redis or Valkey as a backend, a suitable degree of concurrency of worker nodes is provided.

Package Content

Index of help topics:

simpletask              simpletask: A Simple Task Object
tinyqueue               tinyqueue: A Simple Workqueue Object
tinyqueue-package       A Simple Task Queue

Maintainer

Dirk Eddelbuettel <[email protected]>

Author(s)

Dirk Eddelbuettel [aut, cre]


simpletask: A Simple Task Object

Description

Represent a simpletask object suitable for queuing

Usage

simpletask(pkg, ver, ...)

## Default S3 method:
simpletask(pkg, ver, ...)

## S3 method for class 'simpletask'
format(x, ...)

## S3 method for class 'simpletask'
print(x, ...)

enqueue_task(q, st)

start_task(q)

end_task(q, st, res)

Arguments

pkg

character A package name

ver

character A package version number

...

dots Currently ignored

x

simpletask A task object

q

tinyqueue A tinyqueue object

st

object An R object describing the task that is serialized

res

numeric The result code of the completed task, must be between 0 and 2

Details

A simpletask objects describes a task, here usually a package name for a package to be tested along with a version number. It can be any R object as the simplequeue serializes and de-serializes the object apropriately

See Also

tinyqueue


tinyqueue: A Simple Workqueue Object

Description

Create a tinyqueue object

Usage

tinyqueue(name, ...)

## Default S3 method:
tinyqueue(name, ...)

## S3 method for class 'tinyqueue'
print(x, ...)

## S3 method for class 'tinyqueue'
format(x, ...)

## S3 method for class 'tinyqueue'
summary(object, ...)

ensure_queue(name)

publish(queue, message)

list_messages(queue)

try_consume(queue)

ack(queue, message, res = 0)

cleanup(queue)

Arguments

name

character The task name for the queue

...

other arguments

x

tinyqueue A tinyqueue object task name for

object

tinyqueue A tinyqueue object

queue

tinyqueue A tinyqueue object task name for

message

object A R object describing a task that is serialized

res

numeric The task result that is acknowledged where default is zero for success, one signals failure, and two that the task was skipped

Details

A tinyqueue object manages a job queue for a given and named task, using either Redis or Valkey as a backend. The (basic) functionality is modelled after the liteq package.

A tinyqueue is created and returned by function ensure_queue. The function publish_queue, try_consume and ack serve to, respectively, enqueue a task, dequeue it in order to do the designated work and then acknowledge completion. list_message reports the status, and cleanup finalize and cleans up.

The tinyqueue object has several associated methods to print, summarize, or format the object.

The functionality takes advantage of package RcppRedis and its ability to process arbitrary R objects. This allows task descriptions to be data.frame or list objects as needed by the application. For the same reason, no ‘schema’ or alike has to be created as the queued task objects are self-sufficient as R objects.

Examples

# This requires Redis or Valkey to run
## Not run: tinyqueue("sometask")