R6 abstract class to build other subclasses
which launch and manage workers.
See also
Other launcher:
crew_launcher()
Active bindings
nameSee
crew_launcher().workersSee
crew_launcher().seconds_intervalSee
crew_launcher().seconds_timeoutSee
crew_launcher().seconds_launchSee
crew_launcher().seconds_idleSee
crew_launcher().seconds_wallSee
crew_launcher().tasks_maxSee
crew_launcher().tasks_timersSee
crew_launcher().tlsSee
crew_launcher().r_argumentsSee
crew_launcher().options_metricsSee
crew_launcher().urlWebsocket URL for worker connections.
profilemiraicompute profile of the launcher.launchesData frame tracking worker launches with one row per launch. Each launch may create more than one worker. Old superfluous rows are periodically discarded for efficiency.
throttleA
crew_throttle()object to throttle scaling.failedNumber of failed worker launches (launches that exceed
seconds_launchseconds to dial in).
Methods
Method new()
Launcher constructor.
Usage
crew_class_launcher$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,
reset_globals = NULL,
reset_packages = NULL,
reset_options = NULL,
garbage_collection = NULL,
crashes_error = NULL,
launch_max = NULL,
tls = NULL,
processes = NULL,
r_arguments = NULL,
options_metrics = NULL
)Arguments
nameSee
crew_launcher().workersSee
crew_launcher().seconds_intervalSee
crew_launcher().seconds_timeoutSee
crew_launcher().seconds_launchSee
crew_launcher().seconds_idleSee
crew_launcher().seconds_wallSee
crew_launcher().seconds_exitSee
crew_launcher().tasks_maxSee
crew_launcher().tasks_timersSee
crew_launcher().reset_globalsDeprecated. See
crew_launcher().reset_packagesDeprecated. See
crew_launcher().reset_optionsDeprecated. See
crew_launcher().garbage_collectionDeprecated. See
crew_launcher().crashes_errorSee
crew_launcher().launch_maxDeprecated.
tlsSee
crew_launcher().processesDeprecated on 2025-08-27 (
crewversion 1.2.1.9009).r_argumentsSee
crew_launcher().options_metricsSee
crew_launcher().
Examples
if (identical(Sys.getenv("CREW_EXAMPLES"), "true")) {
client <- crew_client()
client$start()
launcher <- crew_launcher_local()
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 settings()
List of arguments for mirai::daemon().
Returns
List of arguments for mirai::daemon().
Method call()
Create a call to crew_worker() to
help create custom launchers.
Returns
Character string with a call to crew_worker().
Examples
launcher <- crew_launcher_local()
launcher$start(url = "tcp://127.0.0.1:57000", profile = "profile")
launcher$call()
launcher$terminate()Method start()
Start the launcher.
Method launch_worker()
Abstract worker launch method.
Arguments
callCharacter of length 1 with a namespaced call to
crew_worker()which will run in the worker and accept tasks.
Method launch_workers()
Launch multiple workers.
Arguments
callCharacter of length 1 with a namespaced call to
crew_worker()which will run in each worker and accept tasks.nPositive integer, number of workers to launch.
Method scale()
Auto-scale workers out to meet the demand of tasks.
Examples
if (identical(Sys.getenv("CREW_EXAMPLES"), "true")) {
client <- crew_client()
client$start()
launcher <- crew_launcher_local()
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$new`
## ------------------------------------------------
if (identical(Sys.getenv("CREW_EXAMPLES"), "true")) {
client <- crew_client()
client$start()
launcher <- crew_launcher_local()
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$call`
## ------------------------------------------------
launcher <- crew_launcher_local()
launcher$start(url = "tcp://127.0.0.1:57000", profile = "profile")
launcher$call()
#> [1] "crew::crew_worker(settings = list(url = \"tcp://127.0.0.1:57000\", dispatcher = TRUE, asyncdial = FALSE, autoexit = 15L, cleanup = FALSE, output = TRUE, maxtasks = Inf, idletime = Inf, walltime = Inf, timerstart = 0L, tlscert = NULL, rs = NULL), controller = \"35f712e9\", options_metrics = crew::crew_options_metrics(path = NULL, seconds_interval = 5))"
launcher$terminate()