Title: | Redirects Your Plumbing For You |
---|---|
Description: | Scales Plumber APIs in parallel on demand. Valve is a Rust library, cli tool, and R package, that spawns plumber APIs in parallel. Valve creates a connection pool of Plumber APIs which are fetched based on availability. Unused connections are terminated. Valve is built using the powerful extendr, tokio, and deadpool libraries. |
Authors: | Josiah Parry [aut, cre] |
Maintainer: | Josiah Parry <[email protected]> |
License: | BSD_3_clause + file LICENSE |
Version: | 0.1.3 |
Built: | 2024-11-15 06:23:08 UTC |
Source: | https://github.com/josiahparry/valve |
Run a plumber API in parallel using valve. Plumber APIs are spawned on
n_threads
asynchronous threads on random ports. Incoming requests are handled
on a single port and redirected to the plumber APIs in a
simple round-robin fashion.
valve_run( filepath = "plumber.R", host = "127.0.0.1", port = 3000, n_min = 1, n_max = 3, workers = n_max, check_unused = 10, max_age = 300 )
valve_run( filepath = "plumber.R", host = "127.0.0.1", port = 3000, n_min = 1, n_max = 3, workers = n_max, check_unused = 10, max_age = 300 )
filepath |
default |
host |
default |
port |
default |
n_min |
default |
n_max |
default |
workers |
default |
check_unused |
default |
max_age |
default |
if (interactive()) { plumber_api_path <- system.file("plumber.R", package = "valve") valve_run(plumber_api_path) }
if (interactive()) { plumber_api_path <- system.file("plumber.R", package = "valve") valve_run(plumber_api_path) }
A Valve powered vetiver Dockerfile will run prediction endpoints concurrently.
valve_write_vetiver( vetiver_model, plumber_file = "plumber.R", path = ".", port = 8000, vetiver_args = list(), workers = NULL, n_max = NULL, check_unused = NULL, max_age = NULL )
valve_write_vetiver( vetiver_model, plumber_file = "plumber.R", path = ".", port = 8000, vetiver_args = list(), workers = NULL, n_max = NULL, check_unused = NULL, max_age = NULL )
vetiver_model |
A deployable |
plumber_file |
A path for your Plumber file, created via
|
path |
A path to write the Dockerfile and |
port |
The server port for listening: a number such as 8080 or an
expression like |
vetiver_args |
additional arguments passed to |
This function is a modification of vetiver::vetiver_write_docker()
. It
modifies the created Dockerfile to install Valve, changes the ENTRYPOINT
to
use the Valve executable instead of a single plumber API via an R command.
The content of the Dockerfile, invisibly.