Specification | R Documentation |
This class contains the information required to start a backend. An instance
of this class is used by the start
method of the
BackendService
interface.
cores
The number of nodes to use in the cluster creation.
type
The type of cluster to create.
types
The supported cluster types.
set_cores()
Set the number of nodes to use in the cluster.
Specification$set_cores(cores)
cores
The number of nodes to use in the cluster.
This method also performs a validation of the requested number of
cores, ensuring that the the value lies between 1
and
parallel::detectCores() - 1
.
set_type()
Set the type of cluster to create.
Specification$set_type(type)
type
The type of cluster to create. Possible values are
"fork"
and "psock"
. Defaults to "psock"
.
If no type is explicitly requested (i.e., type = NULL
), the type is
determined based on the operating system. On Unix-like systems, the
type is set to "fork"
, while on Windows systems, the type is set to
"psock"
. If an unknown type is requested, a warning is issued and
the type is set to "psock"
.
clone()
The objects of this class are cloneable with this method.
Specification$clone(deep = FALSE)
deep
Whether to make a deep clone.
BackendService
, Backend
, SyncBackend
,
and AsyncBackend
.
# Create a specification object.
specification <- Specification$new()
# Set the number of cores.
specification$set_cores(cores = 4)
# Set the cluster type.
specification$set_type(type = "psock")
# Get the number of cores.
specification$cores
# Get the cluster type.
specification$type
# Attempt to set too many cores.
specification$set_cores(cores = 100)
# Check that the cores were reasonably set.
specification$cores
# Allow the object to determine the adequate cluster type.
specification$set_type(type = NULL)
# Check the type determined.
specification$type
# Attempt to set an invalid cluster type.
specification$set_type(type = "invalid")
# Check that the type was set to `psock`.
specification$type
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.