| Title: | A Peer-to-Peer Compute Cluster via Futureverse |
|---|---|
| Description: | Implementation of the 'Future' API <doi:10.32614/RJ-2021-048> that resolves futures on a peer-to-peer ('P2P') compute environment. By using this future backend, you and your friends can share your spare compute resources with each other. |
| Authors: | Henrik Bengtsson [aut, cre, cph] |
| Maintainer: | Henrik Bengtsson <[email protected]> |
| License: | GPL (>= 3) |
| Version: | 0.5.0 |
| Built: | 2026-05-25 07:32:37 UTC |
| Source: | https://github.com/futureverse/future.p2p |
WARNING: This function must never be called.
It may only be used with future::plan()
cluster( cluster = p2p_cluster_name(), host = "pipe.pico.sh", ssh_args = NULL, ... )cluster( cluster = p2p_cluster_name(), host = "pipe.pico.sh", ssh_args = NULL, ... )
cluster |
The p2p cluster to connect to. |
host |
(character string) The hostname serving the pico service. |
ssh_args |
(character vector) Optional SSH arguments. |
... |
Not used. |
A 'p2p' future is an asynchronous multiprocess future that will be evaluated in a background R session.
The Pico P2P future backend relies on Pico (1) to distribute futures among a peer-to-peer (P2P) cluster of R workers. Users with a Pico account can join the P2P cluster by being invited to a shared folder.
Users who wish to contribute their compute power to the P2P cluster
should call worker().
Users who wish to take advantage of the compute power of the
P2P cluster should use plan(future.p2p::cluster).
An object of class PicoP2PFuture.
pico.sh, The ultimate ssh powered services for developers, https://pico.sh/.
# Connect to personal P2P cluster, which is automatically launched plan(future.p2p::cluster) ## Create future a <- 42 f <- future({ 2 * a }) ## Get results v <- value(f) print(v)# Connect to personal P2P cluster, which is automatically launched plan(future.p2p::cluster) ## Create future a <- 42 f <- future({ 2 * a }) ## Get results v <- value(f) print(v)
Hosts a shared P2P cluster
host_cluster( cluster = p2p_cluster_name(users, host = host, ssh_args = ssh_args), users = character(0L), host = "pipe.pico.sh", ssh_args = NULL, duration = 14 * 24 * 60 * 60 )host_cluster( cluster = p2p_cluster_name(users, host = host, ssh_args = ssh_args), users = character(0L), host = "pipe.pico.sh", ssh_args = NULL, duration = 14 * 24 * 60 * 60 )
cluster |
(character string) The name of the p2p cluster. |
users |
(character vector) Names of Pico users who should have access, in addition to the owner. The default is a personal cluster that only you have access to. |
host |
(character string) The hostname serving the pico service. |
ssh_args |
(character vector) Optional SSH arguments. |
duration |
Duration (in seconds) to offer this cluster. |
# Connect to personal P2P cluster, which is automatically launched host_cluster(users = c("bob", "carol"))# Connect to personal P2P cluster, which is automatically launched host_cluster(users = c("bob", "carol"))
Gets the default name of the P2P cluster
p2p_cluster_name(users = character(0), ...)p2p_cluster_name(users = character(0), ...)
users |
Users to have access to the cluster. This controls whether the default cluster names should be "personal" or "friends". |
... |
Passed as-is to |
p2p_cluster_name() returns R option future.p2p.cluster, if set.
If not set, it returns {pico_name}/personal if length(users) == 0,
otherwise {pico_name}/friends.
Gets your pico.sh username
pico_username(host = "pico.sh", ssh_args = NULL, timeout = 10)pico_username(host = "pico.sh", ssh_args = NULL, timeout = 10)
host |
(character string) The hostname serving the pico service. |
ssh_args |
(character vector) Optional SSH arguments. |
timeout |
(numeric scalar) Maximum number of seconds before giving up. |
A character string or a timeout error.
Launches a P2P worker and adds it to a P2P cluster
worker( cluster = p2p_cluster_name(host = host, ssh_args = ssh_args), host = "pipe.pico.sh", ssh_args = NULL, duration = 60 * 60, sandbox = FALSE )worker( cluster = p2p_cluster_name(host = host, ssh_args = ssh_args), host = "pipe.pico.sh", ssh_args = NULL, duration = 60 * 60, sandbox = FALSE )
cluster |
The p2p cluster to contribute to. |
host |
(character string) The hostname serving the pico service. |
ssh_args |
(character vector) Optional SSH arguments. |
duration |
Duration (in seconds) to offer working on futures. |
sandbox |
If TRUE, the future is resolved in R WebAssembly (webR),
using the external |
Nothing.
A P2P worker runs sequentially and is configured with a single CPU core to prevent nested parallelization.
rw: CLI for webR with Sandboxing Features, under development, https://github.com/HenrikBengtsson/rw.
## Start a P2P cluster worker future.p2p::worker()## Start a P2P cluster worker future.p2p::worker()
Below are the R options and environment variables that are used by the
future.p2p package.
WARNING: Note that the names and the default values of these options may
change in future versions of the package. Please use with care until
further notice.
Just like for other R options, as a package developer you must not change any of the below options. Only the end-user should set these. If you find yourself having to tweak one of the options, make sure to undo your changes immediately afterward.
(character)
Specifies the absolute path to the wormhole executable. If not
specified, a default one will be installed.
(logical)
If TRUE, extensive debug messages are generated.
All of the above R future.p2p.* options can be set by
corresponding environment variable R_FUTURE_P2P_* when the
future.p2p package is loaded.
This means that those environment variables must be set before
the future.p2p package is loaded in order to have an effect.
For example, if R_FUTURE_P2P_DEBUG=true, then option
future.p2p.debug is set to TRUE (logical).
# See debug messages options(future.p2p.debug = TRUE)# See debug messages options(future.p2p.debug = TRUE)