FaaSr / FaaSr-package

Function-as-a-Service package for R
https://faasr.io
Other
4 stars 8 forks source link

FaaSr

R-CMD-check CRAN
status DOI

Overview

The goal of FaaSr is to make it easy for developers to create R functions and workflows that can run in the cloud, on-demand, based on triggers - such as timers, or repository commits. It is built for Function-as-a-Service (FaaS) cloud computing, and supports both widely-used commercial (GitHub Actions, AWS Lambda, IBM Cloud) and open-source platforms (OpenWhisk). It is also built for cloud storage, and supports the S3 standard also widely used in commercial (AWS S3), open-source (Minio) and research platforms (Open Storage Network). With FaaSr, you can focus on developing the R functions, and leave dealing with the idiosyncrasies of different FaaS platforms and their APIs to the FaaSr package.

FaaSr allows you to: * Develop one or more functions natively in R in your own GitHub repository * Deploy actions that invoke your functions in Docker containers * Compose workflows consisting of multiple actions in a pre-determined order, described by a Directed Acyclic Graph (DAG) * Register your workflows for cloud-native execution in one of the supported FaaS providers * Invoke your workflows with events, including scheduled timers * Use S3-based cloud storage to provide file inputs and outputs to each action in the workflow

Usage

The functions exposed by FaaSr can be broadly divided as follows: * Server-side functions: are executed automatically in the cloud, by your functions/workflows. These deal with moving data from/to S3 storage and logging * Client-side functions: are executed interactively by you, in your local desktop. These deal with registering and invoking your workflows for execution in your FaaS provider of choice

Server-side FaaSr functions

Client-side FaaSr functions

Workflow configuration

Workflows are configured using the JSON file format and the FaaSr configuration schema.

You may use the FaaSr-JSON-Builder Shiny app to create and edit workflows using a graphical user interface (GUI) rather than a text editor. This GUI can be used to create FaaSr-compliant JSON files from scratch (or starting from an exiting configuration you can upload using the tool). The generated configuration can be downloaded to your computer.

Cloud credential configuration

The client-side FaaSr functions expect both a JSON configuration file describing a workflow, and an environment variable file storing the credentials for your FaaS cloud platforms of choice. The example below shows a template for S3 cloud storage, GitHub Actions, OpenWhisk and AWS Lambda credentials:

"My_GitHub_Account_TOKEN"="REPLACE_WITH_YOUR_GITHUB_TOKEN" "My_Minio_Bucket_ACCESS_KEY"="REPLACE_WITH_S3_ACCESS_KEY" "My_Minio_Bucket_SECRET_KEY"="REPLACE_WITH_S3_SECRET_KEY" "My_OW_Account_API_KEY"="REPLACE_WITH_YOUR_OPENWHISK_ID:SECRET_KEY" "My_Lambda_Account_ACCESS_KEY"="REPLACE_WITH_YOUR_AWS_LAMBDA_ACCESS_KEY" "My_Lambda_Account_SECRET_KEY"="REPLACE_WITH_YOUR_AWS_LAMBDA_SECRET_KEY"

Installation

FaaSr can be installed from CRAN with:

install.packages("FaaSr")

You can install the development version of FaaSr from GitHub with:

devtools::install_github("FaaSr/FaaSr-package")

Example

Please refer to the FaaSr tutorial for a detailed step-by-step example that you can run on your own desktop (using Rocker) or on Posit Cloud, using just a GitHub account and the free-for-testing Minio S3 Play server