Specification {parabar}R Documentation

Specification

Description

This class contains the information required to start a backend. An instance of this class is used by the start method of the Service interface.

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

Public methods


Method set_cores()

Set the number of nodes to use in the cluster.

Usage
Specification$set_cores(cores)
Arguments
cores

The number of nodes to use in the cluster.

Details

This method also performs a validation of the requested number of cores, ensuring that the the value lies between 2 and parallel::detectCores() - 1.


Method set_type()

Set the type of cluster to create.

Usage
Specification$set_type(type)
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".


Method clone()

The objects of this class are cloneable with this method.

Usage
Specification$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

See Also

Service, Backend, SyncBackend, and AsyncBackend.

Examples

# 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


[Package parabar version 1.1.1 Index]