Skip to contents

R6 class to launch and manage local process workers.

Details

See crew_launcher_local().

See also

Super class

crew::crew_class_launcher -> crew_class_launcher_local

Active bindings

options_local

See crew_launcher_local().

Methods

Inherited methods


Method new()

Local launcher constructor.

Usage

crew_class_launcher_local$new(
  name = NULL,
  workers = NULL,
  seconds_interval = NULL,
  seconds_timeout = NULL,
  seconds_launch = NULL,
  seconds_idle = NULL,
  seconds_wall = NULL,
  seconds_exit = NULL,
  tasks_max = NULL,
  tasks_timers = NULL,
  crashes_error = NULL,
  tls = NULL,
  processes = NULL,
  r_arguments = NULL,
  options_metrics = NULL,
  options_local = NULL
)

Arguments

name

See crew_launcher().

workers

See crew_launcher().

seconds_interval

See crew_launcher().

seconds_timeout

See crew_launcher().

seconds_launch

See crew_launcher().

seconds_idle

See crew_launcher().

seconds_wall

See crew_launcher().

seconds_exit

See crew_launcher().

tasks_max

See crew_launcher().

tasks_timers

See crew_launcher().

crashes_error

See crew_launcher().

tls

See crew_launcher().

processes

See crew_launcher().

r_arguments

See crew_launcher().

options_metrics

See crew_launcher_local().

options_local

See crew_launcher_local().

reset_globals

Deprecated. See crew_launcher().

reset_packages

Deprecated. See crew_launcher().

reset_options

Deprecated. See crew_launcher().

garbage_collection

Deprecated. See crew_launcher().

Returns

An R6 object with the local launcher.

Examples

if (identical(Sys.getenv("CREW_EXAMPLES"), "true")) {
client <- crew_client()
client$start()
launcher <- crew_launcher_local(name = client$name)
launcher$start(url = client$url, profile = client$profile)
launcher$launch()
task <- mirai::mirai("result", .compute = client$profile)
mirai::call_mirai(task)
task$data
client$terminate()
}


Method validate()

Validate the local launcher.

Usage

crew_class_launcher_local$validate()

Returns

NULL (invisibly).


Method launch_worker()

Launch a local process worker which will dial into a socket.

Usage

crew_class_launcher_local$launch_worker(call)

Arguments

call

Character of length 1 with a namespaced call to crew_worker() which will run in the worker and accept tasks.

Details

The call argument is R code that will run to initiate the worker. Together, the launcher, worker, and instance arguments are useful for constructing informative job names.

Returns

A handle object to allow the termination of the worker later on.


Method clone()

The objects of this class are cloneable with this method.

Usage

crew_class_launcher_local$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

if (identical(Sys.getenv("CREW_EXAMPLES"), "true")) {
client <- crew_client()
client$start()
launcher <- crew_launcher_local(name = client$name)
launcher$start(url = client$url, profile = client$profile)
launcher$launch()
task <- mirai::mirai("result", .compute = client$profile)
mirai::call_mirai(task)
task$data
client$terminate()
}

## ------------------------------------------------
## Method `crew_class_launcher_local$new`
## ------------------------------------------------

if (identical(Sys.getenv("CREW_EXAMPLES"), "true")) {
client <- crew_client()
client$start()
launcher <- crew_launcher_local(name = client$name)
launcher$start(url = client$url, profile = client$profile)
launcher$launch()
task <- mirai::mirai("result", .compute = client$profile)
mirai::call_mirai(task)
task$data
client$terminate()
}