R6
abstract class to build other subclasses
which launch and manage workers.
See also
Other launcher:
crew_launcher()
Active bindings
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()
.tasks_max
See
crew_launcher()
.tasks_timers
See
crew_launcher()
.tls
See
crew_launcher()
.r_arguments
See
crew_launcher()
.options_metrics
See
crew_launcher()
.url
Websocket URL for worker connections.
profile
mirai
compute profile of the launcher.launches
Data 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.
throttle
A
crew_throttle()
object to throttle scaling.failed
Number of failed worker launches (launches that exceed
seconds_launch
seconds 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
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()
.reset_globals
Deprecated. See
crew_launcher()
.reset_packages
Deprecated. See
crew_launcher()
.reset_options
Deprecated. See
crew_launcher()
.garbage_collection
Deprecated. See
crew_launcher()
.crashes_error
See
crew_launcher()
.launch_max
Deprecated.
tls
See
crew_launcher()
.processes
Deprecated on 2025-08-27 (
crew
version 1.2.1.9009).r_arguments
See
crew_launcher()
.options_metrics
See
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
call
Character 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
call
Character of length 1 with a namespaced call to
crew_worker()
which will run in each worker and accept tasks.n
Positive 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 = \"280e7dff\", options_metrics = crew::crew_options_metrics(path = NULL, seconds_interval = 5))"
launcher$terminate()