| http_config | R Documentation |
Generates a remote configuration for launching daemons via HTTP API. By default, automatically configures for Posit Workbench using environment variables.
http_config(
url = posit_workbench_url,
method = "POST",
cookie = posit_workbench_cookie,
token = NULL,
data = posit_workbench_data,
...
)
url |
(character or function) URL endpoint for the launch API. May be a function returning the URL value. |
method |
(character) HTTP method, typically |
cookie |
(character or function) session cookie value. May be a
function returning the cookie value. Set to |
token |
(character or function) authentication bearer token. May be a
function returning the token value. Set to |
data |
(character or function) JSON or formatted request body containing
the daemon launch command. May be a function returning the data value.
Should include a placeholder |
... |
additional arguments passed to |
A list in the required format to be supplied to the remote argument
of daemons() or launch_remote().
When using the default value of data, the following arguments may be
supplied via ... to customise the launched job:
rscript (character) Rscript executable path. Default "Rscript".
job_name (character) base name for launched jobs. Default
"mirai_daemon".
cluster (character) name of the cluster to use. Default uses the first
available cluster.
resource_profile (character) named resource profile (e.g. "rstudio").
Default uses the first profile available on the chosen cluster.
cpus (integer) number of CPUs for custom resource allocation. Specify
together with or instead of memory to override resource_profile.
memory (integer) memory in MB for custom resource allocation. Specify
together with or instead of cpus to override resource_profile.
ssh_config(), cluster_config() and remote_config() for other
types of remote configuration.
tryCatch(http_config(), error = identity)
# Custom HTTP configuration example:
http_config(
url = "https://api.example.com/launch",
method = "POST",
cookie = function() Sys.getenv("MY_SESSION_COOKIE"),
token = function() Sys.getenv("MY_API_KEY"),
data = '{"command": "%s"}'
)
## Not run:
# Launch 2 daemons using http config default (for Posit Workbench):
daemons(n = 2, url = host_url(), remote = http_config())
# Customise the default Posit Workbench launch (named cluster and profile):
daemons(
n = 2,
url = host_url(),
remote = http_config(cluster = "Kubernetes", resource_profile = "rstudio")
)
# Or specify custom resources (4 CPUs, 8 GB memory):
daemons(
n = 2,
url = host_url(),
remote = http_config(cluster = "Kubernetes", cpus = 4, memory = 8192)
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.