Learn R Programming

parallelly (version 1.32.1)

autoStopCluster: Automatically Stop a Cluster when Garbage Collected

Description

Registers a finalizer to a cluster such that the cluster will be stopped when garbage collected

Usage

autoStopCluster(cl, debug = FALSE)

Value

The cluster object with attribute gcMe set.

Arguments

cl

A cluster object created by for instance makeClusterPSOCK() or parallel::makeCluster().

debug

If TRUE, then debug messages are produced when the cluster is garbage collected.

See Also

The cluster is stopped using stopCluster(cl).

Examples

Run this code
cl <- makeClusterPSOCK(2, dryrun = TRUE)
cl <- autoStopCluster(cl)
print(cl)
rm(list = "cl")
gc()

Run the code above in your browser using DataLab