Create an R6 object to submit tasks and
launch workers on LSF workers.
Usage
crew_controller_lsf(
name = NULL,
workers = 1L,
host = NULL,
port = NULL,
tls = crew::crew_tls(mode = "automatic"),
tls_enable = NULL,
tls_config = NULL,
serialization = NULL,
profile = crew::crew_random_name(),
seconds_interval = 0.5,
seconds_timeout = 60,
seconds_launch = 86400,
seconds_idle = 300,
seconds_wall = Inf,
seconds_exit = NULL,
retry_tasks = NULL,
tasks_max = Inf,
tasks_timers = 0L,
reset_globals = TRUE,
reset_packages = FALSE,
reset_options = FALSE,
garbage_collection = FALSE,
crashes_error = NULL,
r_arguments = c("--no-save", "--no-restore"),
crashes_max = 5L,
backup = NULL,
options_metrics = crew::crew_options_metrics(),
options_cluster = crew.cluster::crew_options_lsf(),
verbose = NULL,
command_submit = NULL,
command_terminate = NULL,
command_delete = NULL,
script_directory = NULL,
script_lines = NULL,
lsf_cwd = NULL,
lsf_log_output = NULL,
lsf_log_error = NULL,
lsf_memory_gigabytes_limit = NULL,
lsf_memory_gigabytes_required = NULL,
lsf_cores = NULL
)Arguments
- name
Character string, name of the launcher. If the name is
NULL, then a name is automatically generated when the launcher starts.- workers
Maximum number of workers to run concurrently when auto-scaling, excluding task retries and manual calls to
launch(). Special workers allocated for task retries do not count towards this limit, so the number of workers running at a given time may exceed this maximum. A smaller number of workers may run if the number of executing tasks is smaller than the supplied value of theworkersargument.- host
IP address of the
miraiclient to send and receive tasks. IfNULL, the host defaults tonanonext::ip_addr()[1].- port
TCP port to listen for the workers. If
NULL, then an available ephemeral port is automatically chosen. Controllers running simultaneously on the same computer (as in a controller group) must not share the same TCP port.- tls
A TLS configuration object from
crew_tls().- tls_enable
Deprecated on 2023-09-15 in version 0.4.1. Use argument
tlsinstead.- tls_config
Deprecated on 2023-09-15 in version 0.4.1. Use argument
tlsinstead.- serialization
Either
NULL(default) or an object produced bymirai::serial_config()to control the serialization of data sent to workers. This can help with either more efficient data transfers or to preserve attributes of otherwise non-exportable objects (such astorchtensors orarrowtables). See?mirai::serial_configfor details.- profile
Character string, compute profile for
mirai::daemons().- seconds_interval
Number of seconds between polling intervals waiting for certain internal synchronous operations to complete. In certain cases, exponential backoff is used with this argument passed to
seconds_maxin acrew_throttle()object.- seconds_timeout
Number of seconds until timing out while waiting for certain synchronous operations to complete, such as checking
mirai::info().- seconds_launch
Seconds of startup time to allow. A worker is unconditionally assumed to be alive from the moment of its launch until
seconds_launchseconds later. Afterseconds_launchseconds, the worker is only considered alive if it is actively connected to its assign websocket.- seconds_idle
Maximum number of seconds that a worker can idle since the completion of the last task. If exceeded, the worker exits. But the timer does not launch until
tasks_timerstasks have completed. See theidletimeargument ofmirai::daemon().crewdoes not excel with perfectly transient workers because it does not micromanage the assignment of tasks to workers, so please allow enough idle time for a new worker to be delegated a new task.- seconds_wall
Soft wall time in seconds. The timer does not launch until
tasks_timerstasks have completed. See thewalltimeargument ofmirai::daemon().- seconds_exit
Deprecated on 2023-09-21 in version 0.1.2.9000. No longer necessary.
- retry_tasks
Deprecated on 2025-01-13 (
crewversion 0.10.2.9002).- tasks_max
Maximum number of tasks that a worker will do before exiting. Also determines how often the controller auto-scales. See the Auto-scaling section for details.
- tasks_timers
Number of tasks to do before activating the timers for
seconds_idleandseconds_wall. See thetimerstartargument ofmirai::daemon().- reset_globals
TRUEto reset global environment variables between tasks,FALSEto leave them alone.- reset_packages
TRUEto detach any packages loaded during a task (runs between each task),FALSEto leave packages alone. In either case, the namespaces are not detached.- reset_options
TRUEto reset global options to their original state between each task,FALSEotherwise. It is recommended to only setreset_options = TRUEifreset_packagesis alsoTRUEbecause packages sometimes rely on options they set at loading time. for this and other reasons,reset_optionsonly resets options that were nonempty at the beginning of the task. If your task sets an entirely new option not already inoptions(), thenreset_options = TRUEdoes not delete the option.- garbage_collection
TRUEto run garbage collection after each task task,FALSEto skip.- crashes_error
Deprecated on 2025-01-13 (
crewversion 0.10.2.9002).- r_arguments
Optional character vector of command line arguments to pass to
Rscript(non-Windows) orRscript.exe(Windows) when starting a worker. Example:r_arguments = c("--vanilla", "--max-connections=32").- crashes_max
In rare cases, a worker may exit unexpectedly before it completes its current task. If this happens,
pop()returns a status of"crash"instead of"error"for the task. The controller does not automatically retry the task, but you can retry it manually by callingpush()again and using the same task name as before. (However,targetspipelines runningcrewdo automatically retry tasks whose workers crashed.)crashes_maxis a non-negative integer, and it sets the maximum number of allowable consecutive crashes for a given task. If a task's worker crashes more thancrashes_maxtimes in a row, thenpop()throws an error when it tries to return the results of the task.- backup
An optional
crewcontroller object, orNULLto omit. If supplied, thebackupcontroller runs any pushed tasks that have already reachedcrashes_maxconsecutive crashes. Usingbackup, you can create a chain of controllers with different levels of resources (such as worker memory and CPUs) so that a task that fails on one controller can retry using incrementally more powerful workers. All controllers in a backup chain should be part of the same controller group (seecrew_controller_group()) so you can call the group-levelpop()andcollect()methods to make sure you get results regardless of which controller actually ended up running the task.Limitations of
backup: *crashes_maxneeds to be positive in order forbackupto be used. Otherwise, every task would always skip the current controller and go tobackup. *backupcannot be a controller group. It must be an ordinary controller.- options_metrics
Either
NULLto opt out of resource metric logging for workers, or an object fromcrew_options_metrics()to enable and configure resource metric logging for workers. For resource logging to run, theautometricR package version 0.1.0 or higher must be installed.- options_cluster
An options list from
crew_options_lsf()with cluster-specific configuration options.- verbose
Deprecated. Use
options_clusterinstead.- command_submit
Deprecated. Use
options_clusterinstead.- command_terminate
Deprecated. Use
options_clusterinstead.- command_delete
Deprecated on 2024-01-08 (version 0.1.4.9001). Use
command_terminateinstead.- script_directory
Deprecated. Use
options_clusterinstead.- script_lines
Deprecated. Use
options_clusterinstead.- lsf_cwd
Deprecated. Use
options_clusterinstead.- lsf_log_output
Deprecated. Use
options_clusterinstead.- lsf_log_error
Deprecated. Use
options_clusterinstead.- lsf_memory_gigabytes_limit
Deprecated. Use
options_clusterinstead.- lsf_memory_gigabytes_required
Deprecated. Use
options_clusterinstead.- lsf_cores
Deprecated. Use
options_clusterinstead.
Details
WARNING: the crew.cluster LSF plugin is experimental
and has not actually been tested on a LSF cluster. Please proceed
with caution and report bugs to
https://github.com/wlandau/crew.cluster.
Attribution
The template files at
https://github.com/mschubert/clustermq/tree/master/inst
informed the development of the crew launcher plugins in
crew.cluster, and we would like to thank
Michael Schubert for developing clustermq and releasing it under
the permissive Apache License 2.0.
See the NOTICE and README.md files in the crew.cluster
source code for additional attribution.
See also
Other lsf:
crew_class_launcher_lsf,
crew_launcher_lsf(),
crew_options_lsf()
Examples
if (identical(Sys.getenv("CREW_EXAMPLES"), "true")) {
controller <- crew_controller_lsf()
controller$start()
controller$push(name = "task", command = sqrt(4))
controller$wait()
controller$pop()$result
controller$terminate()
}