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.
See also
BackendService
, Backend
, SyncBackend
,
and AsyncBackend
.
Active bindings
cores
The number of nodes to use in the cluster creation.
type
The type of cluster to create.
types
The supported cluster types.
Methods
Method set_type()
Set the type of cluster to create.
Arguments
type
The type of cluster to create. Possible values are
"fork"
and"psock"
. Defaults to"psock"
.
Details
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"
.
Examples
# Create a specification object.
specification <- Specification$new()
# Set the number of cores.
specification$set_cores(cores = 4)
#> Warning: Argument `cores` cannot be larger than 3. Setting to 3.
# Set the cluster type.
specification$set_type(type = "psock")
# Get the number of cores.
specification$cores
#> [1] 3
# Get the cluster type.
specification$type
#> [1] "PSOCK"
# Attempt to set too many cores.
specification$set_cores(cores = 100)
#> Warning: Argument `cores` cannot be larger than 3. Setting to 3.
# Check that the cores were reasonably set.
specification$cores
#> [1] 3
# Allow the object to determine the adequate cluster type.
specification$set_type(type = NULL)
# Check the type determined.
specification$type
#> unix
#> "FORK"
# Attempt to set an invalid cluster type.
specification$set_type(type = "invalid")
#> Warning: Argument `type` must be 'fork' or 'psock'. Defaulting to 'psock'.
# Check that the type was set to `psock`.
specification$type
#> windows
#> "PSOCK"