Skip to content

nmcapule/rmachinery

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Machinery R SDK

This is a subset R implementation of a worker for RichardKnop/machinery.

The package was created using this guide: https://tinyheero.github.io/jekyll/update/2015/07/26/making-your-first-R-package.html

Limitations

  • Broker is strictly only for Redis
  • BackendResult is strictly only for MongoDB

Development Environment

Need to install the following packages:

install.packages("redux", repos="https://cran.us.r-project.org")
install.packages("mongolite", repos="https://cran.us.r-project.org")
install.packages("urltools", repos="https://cran.us.r-project.org")
install.packages("jsonlite", repos="https://cran.us.r-project.org")
install.packages("uuid", repos="https://cran.us.r-project.org")

Usage

To create a machinery instance and handle a task:

machinery <- machineryInit(
    brokerURI="redis:https://:helloworld@localhost:6379",
    backendURI="mongodb:https://mongo:moonbucks@localhost:27017/?authSource=admin",
    queue="machinery_tasks"
)
# Note that the inputs / ouputs of a task handler must be data frames.
printHandler <- function(args) {
    print(args)
    args
}
machinery <- machineryRegisterTask(machinery, "print", printHandler)
machineryStart(machinery)

To send a task and wait for results:

task <- machinerySendSimpleTask(machinery, "my-queue", "add", args)
results <- machineryWaitForResults(machinery, task)

About

Create RichardKnop/machinery workers for R

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages