nbrOfWorkers: Get the number of workers available

Description Usage Arguments Value Examples

View source: R/nbrOfWorkers.R

Description

Get the number of workers available

Usage

1
2
3
nbrOfWorkers(evaluator = NULL)

nbrOfFreeWorkers(evaluator = NULL, background = FALSE, ...)

Arguments

evaluator

A future evaluator function. If NULL (default), the current evaluator as returned by plan() is used.

background

If TRUE, only workers that can process a future in the background are considered. If FALSE, also workers running in the main R process are considered, e.g. when using the 'sequential' backend.

...

Not used; reserved for future use.

Value

nbrOfWorkers() returns a positive number in {1, 2, 3, ...}, which for some future backends may also be +Inf.

nbrOfFreeWorkers() returns a non-negative number in {0, 1, 2, 3, ...} which is less than or equal to nbrOfWorkers().

Examples

1
2
3
4
5
plan(multisession)
nbrOfWorkers()  ## == availableCores()

plan(sequential)
nbrOfWorkers()  ## == 1

Example output

sh: 1: wc: Permission denied
system 
     1 
[1] 1

future documentation built on Jan. 8, 2021, 5:36 p.m.

Related to nbrOfWorkers in future...