FutureBackend {future} | R Documentation |
Configure a backend that controls how and where futures are evaluated
Description
This functionality is only for developers who wish to implement their own future backend. End-users and package developers use futureverse, does not need to know about these functions.
If you are looking for available future backends to choose from, please see the 'A Future for R: Available Future Backends' vignette and https://www.futureverse.org/backends.html.
Usage
FutureBackend(
...,
earlySignal = FALSE,
gc = FALSE,
maxSizeOfObjects = getOption("future.globals.maxSize", +Inf),
interrupts = TRUE,
hooks = FALSE
)
launchFuture(backend, future, ...)
listFutures(backend, ...)
interruptFuture(backend, future, ...)
validateFutureGlobals(backend, future, ...)
stopWorkers(backend, ...)
MultiprocessFutureBackend(
...,
wait.timeout = getOption("future.wait.timeout", 24 * 60 * 60),
wait.interval = getOption("future.wait.interval", 0.01),
wait.alpha = getOption("future.wait.alpha", 1.01)
)
ClusterFutureBackend(
workers = availableWorkers(constraints = "connections"),
gc = TRUE,
earlySignal = TRUE,
interrupts = FALSE,
persistent = FALSE,
...
)
MulticoreFutureBackend(
workers = availableCores(constraints = "multicore"),
maxSizeOfObjects = +Inf,
...
)
SequentialFutureBackend(..., maxSizeOfObjects = +Inf)
MultisessionFutureBackend(
workers = availableCores(),
rscript_libs = .libPaths(),
interrupts = TRUE,
gc = FALSE,
earlySignal = FALSE,
...
)
Arguments
earlySignal |
Overrides the default behavior on whether futures
should resignal ("relay") conditions captured as soon as possible, or
delayed, for instance, until |
gc |
Overrides the default behavior of whether futures should trigger
garbage collection via |
maxSizeOfObjects |
The maximum allowed total size, in bytes, of all
objects to and from the parallel worker allows.
This can help to protect against unexpectedly large data transfers between
the parent process and the parallel workers - data that is often transferred
over the network, which sometimes also includes the internet. For instance,
if you sit at home and have set up a future backend with workers running
remotely at your university or company, then you might want to use this
protection to avoid transferring giga- or terabytes of data without noticing.
(Default: |
interrupts |
If FALSE, attempts to interrupt futures will not take place on this backend, even if the backend supports it. This is useful when, for instance, it takes a long time to interrupt a future. |
backend |
|
future |
a Future to be started. |
wait.timeout |
Number of seconds before timing out. |
wait.interval |
Baseline number of seconds between retries. |
wait.alpha |
Scale factor increasing waiting interval after each attempt. |
workers |
... |
persistent |
(deprecated) ... |
... |
(optional) not used. |
Details
The ClusterFutureBackend
is selected by
plan(cluster, workers = workers)
.
The MulticoreFutureBackend
backend is selected by
plan(multicore, workers = workers)
.
The SequentialFutureBackend
is selected by plan(sequential)
.
The MultisessionFutureBackend
backend is selected by
plan(multisession, workers = workers)
.
Value
FutureBackend()
returns a FutureBackend object, which inherits an
environment. Specific future backends are defined by subclasses
implementing the FutureBackend API.
launchFuture()
returns the launched Future
object.
interruptFuture()
returns the interrupted Future
object,
if supported, other the unmodified future.
stopWorkers()
returns TRUE if the workers were shut down,
otherwise FALSE.
The FutureBackend API
The FutureBackend
class specifies FutureBackend API,
that all backends must implement and comply to. Specifically,
See Also
For alternative future backends, see the 'A Future for R: Available Future Backends' vignette and https://www.futureverse.org/backends.html.
For alternative future backends, see the 'A Future for R: Available Future Backends' vignette and https://www.futureverse.org/backends.html.