| crew_class_controller | R Documentation |
R6 class for controllers.
See crew_controller().
profileCharacter string, compute profile of the controller.
clientClient object.
launcherLauncher object.
tasksA list of mirai::mirai() task objects.
The list of tasks is dynamically generated from an internal,
dictionary, so it is not as fast as a simple lookup.
pushedNumber of tasks ever submitted to the mirai
compute profile through the controller.
reset_globalsSee crew_controller().
since the controller was started.
reset_packagesSee crew_controller().
since the controller was started.
reset_optionsSee crew_controller().
since the controller was started.
garbage_collectionSee crew_controller().
since the controller was started.
crashes_maxSee crew_controller().
backupSee crew_controller().
errorTibble of task results (with one result per row)
from the last call to map(error = "stop).
looplater loop if asynchronous auto-scaling is running,
NULL otherwise.
queue_resolvedQueue of resolved tasks.
queue_backlogQueue of explicitly backlogged tasks.
new()mirai controller constructor.
crew_class_controller$new( client = NULL, launcher = NULL, reset_globals = NULL, reset_packages = NULL, reset_options = NULL, garbage_collection = NULL, crashes_max = NULL, backup = NULL )
clientClient object. See crew_controller().
launcherLauncher object. See crew_controller().
reset_globalsSee crew_controller().
reset_packagesSee crew_controller().
reset_optionsSee crew_controller().
garbage_collectionSee crew_controller().
crashes_maxSee crew_controller().
backupSee crew_controller().
An R6 controller object.
if (identical(Sys.getenv("CREW_EXAMPLES"), "true")) {
client <- crew_client()
launcher <- crew_launcher_local()
controller <- crew_controller(client = client, launcher = launcher)
controller$start()
controller$push(name = "task", command = sqrt(4))
controller$wait()
controller$pop()
controller$terminate()
}
validate()Validate the controller.
crew_class_controller$validate()
NULL (invisibly).
size()Number of tasks in the controller.
crew_class_controller$size(controllers = NULL)
controllersNot used. Included to ensure the signature is compatible with the analogous method of controller groups.
Non-negative integer, number of tasks in the controller.
empty()Check if the controller is empty.
crew_class_controller$empty(controllers = NULL)
controllersNot used. Included to ensure the signature is compatible with the analogous method of controller groups.
A controller is empty if it has no mirai::mirai()
task objects in the controller.
There may still be other tasks running on the workers
of an empty controller, but those tasks were not submitted with
push() or collect(),
and they are not part of the controller task queue.
TRUE if the controller is empty, FALSE otherwise.
nonempty()Check if the controller is nonempty.
crew_class_controller$nonempty(controllers = NULL)
controllersNot used. Included to ensure the signature is compatible with the analogous method of controller groups.
A controller is empty if it has no mirai::mirai()
task objects in the controller.
There may still be other tasks running on the workers
of an empty controller, but those tasks were not submitted with
push() or collect(),
and they are not part of the controller task queue.
TRUE if the controller is empty, FALSE otherwise.
resolved()Cumulative number of resolved tasks.
crew_class_controller$resolved(controllers = NULL)
controllersNot used. Included to ensure the signature is compatible with the analogous method of controller groups.
resolved() is cumulative: it counts all the resolved
tasks over the entire lifetime of the controller session.
Non-negative integer of length 1, number of resolved tasks. The return value is 0 if the condition variable does not exist (i.e. if the client is not running).
unresolved()Number of unresolved tasks.
crew_class_controller$unresolved(controllers = NULL)
controllersNot used. Included to ensure the signature is compatible with the analogous method of controller groups.
Non-negative integer of length 1, number of unresolved tasks.
saturated()Check if the controller is saturated.
crew_class_controller$saturated( collect = NULL, throttle = NULL, controller = NULL )
collectDeprecated in version 0.5.0.9003 (2023-10-02). Not used.
throttleDeprecated in version 0.5.0.9003 (2023-10-02). Not used.
controllerNot used. Included to ensure the signature is compatible with the analogous method of controller groups.
A controller is saturated if the number of uncollected tasks
is greater than or equal to the maximum number of workers.
You can still push tasks to a saturated controller, but
tools that use crew such as targets may choose not to
(for performance and user-friendliness).
TRUE if the controller is saturated, FALSE otherwise.
start()Start the controller if it is not already started.
crew_class_controller$start(controllers = NULL)
controllersNot used. Included to ensure the signature is compatible with the analogous method of controller groups.
Register the mirai client and register worker websockets with the launcher.
NULL (invisibly).
started()Check whether the controller is started.
crew_class_controller$started(controllers = NULL)
controllersNot used. Included to ensure the signature is compatible with the analogous method of controller groups.
Actually checks whether the client is started.
TRUE if the controller is started, FALSE otherwise.
launch()Launch one or more workers.
crew_class_controller$launch(n = 1L, controllers = NULL)
nNumber of workers to launch.
controllersNot used. Included to ensure the signature is compatible with the analogous method of controller groups.
NULL (invisibly).
scale()Auto-scale workers out to meet the demand of tasks.
crew_class_controller$scale(throttle = TRUE, controllers = NULL)
throttleTRUE to skip auto-scaling if it already happened
within the last polling interval. FALSE to auto-scale
every time scale() is called. Throttling avoids
overburdening the local R process.
controllersNot used. Included to ensure the signature is compatible with the analogous method of controller groups.
The scale() method launches new workers to
run tasks if needed.
Invisibly returns TRUE if auto-scaling was attempted
(throttling can skip it) and there was any relevant
auto-scaling activity (new worker launches or worker
connection/disconnection events). FALSE otherwise.
autoscale()Run worker auto-scaling in a later loop
in polling intervals determined by exponential backoff.
crew_class_controller$autoscale( loop = later::global_loop(), controllers = NULL )
loopA later loop to run auto-scaling.
controllersNot used. Included to ensure the signature is compatible with the analogous method of controller groups.
Call controller$descale() to terminate the
auto-scaling loop.
NULL (invisibly).
descale()Terminate the auto-scaling loop started by
controller$autoscale().
crew_class_controller$descale(controllers = NULL)
controllersNot used. Included to ensure the signature is compatible with the analogous method of controller groups.
NULL (invisibly).
crashes()Report the number of consecutive crashes of a task.
crew_class_controller$crashes(name, controllers = NULL)
nameCharacter string, name of the task to check.
controllersNot used. Included to ensure the signature is compatible with the analogous method of controller groups.
See the crashes_max argument of crew_controller().
Non-negative integer, number of consecutive times the task crashed.
push()Push a task to the head of the task list.
crew_class_controller$push( command, data = list(), globals = list(), substitute = TRUE, seed = NULL, algorithm = NULL, packages = character(0), library = NULL, seconds_timeout = NULL, scale = TRUE, throttle = TRUE, name = NULL, save_command = NULL, controller = NULL )
commandLanguage object with R code to run.
dataNamed list of local data objects in the evaluation environment.
globalsNamed list of objects to temporarily assign to the
global environment for the task.
This list should
include any functions you previously defined in the global
environment which are required to run tasks.
See the reset_globals argument
of crew_controller_local().
substituteLogical of length 1, whether to call
base::substitute() on the supplied value of the
command argument. If TRUE (default) then command is quoted
literally as you write it, e.g.
push(command = your_function_call()). If FALSE, then crew
assumes command is a language object and you are passing its
value, e.g. push(command = quote(your_function_call())).
substitute = TRUE is appropriate for interactive use,
whereas substitute = FALSE is meant for automated R programs
that invoke crew controllers.
seedInteger of length 1 with the pseudo-random number generator
seed to set for the evaluation of the task. Passed to the
seed argument of set.seed() if not NULL.
If seed and algorithm are both non-missing in the output
of pop(), then you can recover the pseudo-random number generator state
of the task using set.seed(seed = seed, kind = algorithm).
Otherwise, if the algorithm and seed are both NULL (recommended),
then the random number generator defaults to the
widely spaced worker-specific
L'Ecuyer streams as supported by mirai::nextstream().
See vignette("parallel", package = "parallel") for details.
algorithmInteger of length 1 with the pseudo-random number
generator algorithm to set for the evaluation of the task.
Passed to the kind argument of RNGkind() if not NULL.
If seed and algorithm are both non-missing in the output
of pop(), then you can recover the pseudo-random number generator state
of the task using set.seed(seed = seed, kind = algorithm).
Otherwise, if the algorithm and seed are both NULL (recommended),
then the random number generator defaults to the
widely spaced worker-specific
L'Ecuyer streams as supported by mirai::nextstream().
See vignette("parallel", package = "parallel") for details.
packagesCharacter vector of packages to load for the task.
libraryLibrary path to load the packages. See the lib.loc
argument of require().
seconds_timeoutOptional task timeout passed to the .timeout
argument of mirai::mirai() (after converting to milliseconds).
scaleLogical, whether to automatically call scale()
to auto-scale workers to meet the demand of the task load. Also
see the throttle argument.
throttleTRUE to skip auto-scaling if it already happened
within the last polling interval. FALSE to auto-scale
every time scale() is called. Throttling avoids
overburdening the local R process.
nameCharacter string, name of the task. If NULL, then
a random name is generated automatically.
The name of the task must not conflict with the name of another
task pushed to the controller. Any previous task with the same name
must first be popped before a new task with that name can be pushed.
save_commandDeprecated on 2025-01-22 (crew version
0.10.2.9004) and no longer used.
controllerNot used. Included to ensure the signature is compatible with the analogous method of controller groups.
Invisibly return the mirai object of the pushed task.
This allows you to interact with the task directly, e.g.
to create a promise object with promises::as.promise().
synced()Check if the controller is synced.
crew_class_controller$synced(controllers = NULL)
controllersNot used. Included to ensure the signature is compatible with the analogous method of controller groups.
A controller is synced if all pushed tasks in the controller
show up in the task counts in mirai::info().
walk()Apply a single command to multiple inputs, and return control to the user without waiting for any task to complete.
crew_class_controller$walk( command, iterate, data = list(), globals = list(), substitute = TRUE, seed = NULL, algorithm = NULL, packages = character(0), library = NULL, seconds_timeout = NULL, names = NULL, save_command = NULL, verbose = interactive(), scale = TRUE, throttle = TRUE, controller = NULL )
commandLanguage object with R code to run.
iterateNamed list of vectors or lists to iterate over.
For example, to run function calls
f(x = 1, y = "a") and f(x = 2, y = "b"),
set command to f(x, y), and set iterate to
list(x = c(1, 2), y = c("a", "b")). The individual
function calls are evaluated as
f(x = iterate$x[[1]], y = iterate$y[[1]]) and
f(x = iterate$x[[2]], y = iterate$y[[2]]).
All the elements of iterate must have the same length.
If there are any name conflicts between iterate and data,
iterate takes precedence.
dataNamed list of constant local data objects in the evaluation environment. Objects in this list are treated as single values and are held constant for each iteration of the map.
globalsNamed list of constant objects to temporarily
assign to the global environment for each task. This list should
include any functions you previously defined in the global
environment which are required to run tasks.
See the reset_globals argument of crew_controller_local().
Objects in this list are treated as single
values and are held constant for each iteration of the map.
substituteLogical of length 1, whether to call
base::substitute() on the supplied value of the
command argument. If TRUE (default) then command is quoted
literally as you write it, e.g.
push(command = your_function_call()). If FALSE, then crew
assumes command is a language object and you are passing its
value, e.g. push(command = quote(your_function_call())).
substitute = TRUE is appropriate for interactive use,
whereas substitute = FALSE is meant for automated R programs
that invoke crew controllers.
seedInteger of length 1 with the pseudo-random number generator
seed to set for the evaluation of the task. Passed to the
seed argument of set.seed() if not NULL.
If algorithm and seed are both NULL,
then the random number generator defaults to the
recommended widely spaced worker-specific
L'Ecuyer streams as supported by mirai::nextstream().
See vignette("parallel", package = "parallel") for details.
algorithmInteger of length 1 with the pseudo-random number
generator algorithm to set for the evaluation of the task.
Passed to the kind argument of RNGkind() if not NULL.
If algorithm and seed are both NULL,
then the random number generator defaults to the
recommended widely spaced worker-specific
L'Ecuyer streams as supported by mirai::nextstream().
See vignette("parallel", package = "parallel") for details.
packagesCharacter vector of packages to load for the task.
libraryLibrary path to load the packages. See the lib.loc
argument of require().
seconds_timeoutOptional task timeout passed to the .timeout
argument of mirai::mirai() (after converting to milliseconds).
namesOptional character of length 1, name of the element of
iterate with names for the tasks. If names is supplied,
then iterate[[names]] must be a character vector.
save_commandDeprecated on 2025-01-22 (crew version
0.10.2.9004). The command is always saved now.
verboseLogical of length 1, whether to print to a progress bar when pushing tasks.
scaleLogical, whether to automatically scale workers to meet
demand. See also the throttle argument.
throttleTRUE to skip auto-scaling if it already happened
within the last polling interval. FALSE to auto-scale
every time scale() is called. Throttling avoids
overburdening the local R process.
controllerNot used. Included to ensure the signature is compatible with the analogous method of controller groups.
In contrast to walk(), map() blocks the local R session
and waits for all tasks to complete.
Invisibly returns a list of mirai task objects for the
newly created tasks. The order of tasks in the list matches the
order of data in the iterate argument.
map()Apply a single command to multiple inputs, wait for all tasks to complete, and return the results of all tasks.
crew_class_controller$map( command, iterate, data = list(), globals = list(), substitute = TRUE, seed = NULL, algorithm = NULL, packages = character(0), library = NULL, seconds_interval = NULL, seconds_timeout = NULL, names = NULL, save_command = NULL, error = "stop", warnings = TRUE, verbose = interactive(), scale = TRUE, throttle = TRUE, controller = NULL )
commandLanguage object with R code to run.
iterateNamed list of vectors or lists to iterate over.
For example, to run function calls
f(x = 1, y = "a") and f(x = 2, y = "b"),
set command to f(x, y), and set iterate to
list(x = c(1, 2), y = c("a", "b")). The individual
function calls are evaluated as
f(x = iterate$x[[1]], y = iterate$y[[1]]) and
f(x = iterate$x[[2]], y = iterate$y[[2]]).
All the elements of iterate must have the same length.
If there are any name conflicts between iterate and data,
iterate takes precedence.
dataNamed list of constant local data objects in the evaluation environment. Objects in this list are treated as single values and are held constant for each iteration of the map.
globalsNamed list of constant objects to temporarily
assign to the global environment for each task. This list should
include any functions you previously defined in the global
environment which are required to run tasks.
See the reset_globals argument of crew_controller_local().
Objects in this list are treated as single
values and are held constant for each iteration of the map.
substituteLogical of length 1, whether to call
base::substitute() on the supplied value of the
command argument. If TRUE (default) then command is quoted
literally as you write it, e.g.
push(command = your_function_call()). If FALSE, then crew
assumes command is a language object and you are passing its
value, e.g. push(command = quote(your_function_call())).
substitute = TRUE is appropriate for interactive use,
whereas substitute = FALSE is meant for automated R programs
that invoke crew controllers.
seedInteger of length 1 with the pseudo-random number generator
seed to set for the evaluation of the task. Passed to the
seed argument of set.seed() if not NULL.
If algorithm and seed are both NULL,
then the random number generator defaults to the
recommended widely spaced worker-specific
L'Ecuyer streams as supported by mirai::nextstream().
See vignette("parallel", package = "parallel") for details.
algorithmInteger of length 1 with the pseudo-random number
generator algorithm to set for the evaluation of the task.
Passed to the kind argument of RNGkind() if not NULL.
If algorithm and seed are both NULL,
then the random number generator defaults to the
recommended widely spaced worker-specific
L'Ecuyer streams as supported by mirai::nextstream().
See vignette("parallel", package = "parallel") for details.
packagesCharacter vector of packages to load for the task.
libraryLibrary path to load the packages. See the lib.loc
argument of require().
seconds_intervalDeprecated on 2025-01-17 (crew version
0.10.2.9003). Instead, the seconds_interval argument passed
to crew_controller_group() is used as seconds_max
in a crew_throttle() object which orchestrates exponential
backoff.
seconds_timeoutOptional task timeout passed to the .timeout
argument of mirai::mirai() (after converting to milliseconds).
namesOptional character string, name of the element of
iterate with names for the tasks. If names is supplied,
then iterate[[names]] must be a character vector.
save_commandDeprecated on 2025-01-22 (crew version
0.10.2.9004). The command is always saved now.
errorCharacter of length 1, choice of action if a task was not successful. Possible values:
"stop": throw an error in the main R session instead of returning
a value. In case of an error, the results from the last errored
map() are in the error field
of the controller, e.g. controller_object$error. To reduce
memory consumption, set controller_object$error <- NULL after
you are finished troubleshooting.
"warn": throw a warning. This allows the return value with
all the error messages and tracebacks to be generated.
"silent": do nothing special.
NOTE: the only kinds of errors considered here are errors at the R
level. A crashed tasks will return a status of "crash" in the output
and not trigger an error in map() unless crashes_max is reached.
warningsLogical of length 1, whether to throw a warning in the interactive session if at least one task encounters an error.
verboseLogical of length 1, whether to print to a progress bar as tasks resolve.
scaleLogical, whether to automatically scale workers to meet
demand. See also the throttle argument.
throttleTRUE to skip auto-scaling if it already happened
within the last polling interval. FALSE to auto-scale
every time scale() is called. Throttling avoids
overburdening the local R process.
controllerNot used. Included to ensure the signature is compatible with the analogous method of controller groups.
map() cannot be used unless all prior tasks are
completed and popped. You may need to wait and then pop them
manually. Alternatively, you can start over: either call
terminate() on the current controller object to reset it, or
create a new controller object entirely.
A tibble of results and metadata: one row per task
and columns corresponding to the output of pop().
pop()Pop a completed task from the results data frame.
crew_class_controller$pop( scale = TRUE, collect = NULL, throttle = TRUE, error = NULL, controllers = NULL )
scaleLogical of length 1,
whether to automatically call scale()
to auto-scale workers to meet the demand of the task load.
Scaling up on pop() may be important
for transient or nearly transient workers that tend to drop off
quickly after doing little work.
See also the throttle argument.
collectDeprecated in version 0.5.0.9003 (2023-10-02).
throttleTRUE to skip auto-scaling if it already happened
within the last polling interval. FALSE to auto-scale
every time scale() is called. Throttling avoids
overburdening the local R process.
errorNULL or character of length 1, choice of action if
the popped task threw an error. Possible values:
"stop": throw an error in the main R session instead of returning
a value.
"warn": throw a warning.
NULL or "silent": do not react to errors.
NOTE: the only kinds of errors considered here are errors at the R
level. A crashed tasks will return a status of "crash" in the output
and not trigger an error in pop() unless crashes_max is reached.
controllersNot used. Included to ensure the signature is compatible with the analogous method of controller groups.
If not task is currently completed, pop()
will attempt to auto-scale workers as needed.
If there is no task to collect, return NULL. Otherwise,
return a one-row tibble with the following columns.
name: the task name.
command: a character string with the R command.
result: a list containing the return value of the R command.
NA if the task failed.
status: a character string. "success" if the task succeeded,
"cancel" if the task was canceled with
the cancel() controller method,
"crash" if the worker running the task exited before
it could complete the task, or "error"
for any other kind of error.
error: the first 2048 characters of the error message if
the task status is not "success", NA otherwise.
Messages for crashes and cancellations are captured here
alongside ordinary R-level errors.
code: an integer code denoting the specific exit status:
0 for successful tasks, -1 for tasks with an error in the R
command of the task, and another positive integer with an NNG
status code if there is an error at the NNG/nanonext level.
nanonext::nng_error() can interpret these codes.
trace: the first 2048 characters of the text of the traceback
if the task threw an error, NA otherwise.
warnings: the first 2048 characters. of the text of
warning messages that the task may have generated, NA otherwise.
seconds: number of seconds that the task ran.
seed: the single integer originally supplied to push(),
NA otherwise. The pseudo-random number generator state
just prior to the task can be restored using
set.seed(seed = seed, kind = algorithm), where seed and
algorithm are part of this output.
algorithm: name of the pseudo-random number generator algorithm
originally supplied to push(),
NA otherwise. The pseudo-random number generator state
just prior to the task can be restored using
set.seed(seed = seed, kind = algorithm), where seed and
algorithm are part of this output.
controller: name of the crew controller where the task ran.
worker: name of the crew worker that ran the task.
collect()Pop all available task results and return them in a tidy
tibble.
crew_class_controller$collect( scale = TRUE, throttle = TRUE, error = NULL, controllers = NULL )
scaleLogical of length 1,
whether to automatically call scale()
to auto-scale workers to meet the demand of the task load.
throttleTRUE to skip auto-scaling if it already happened
within the last polling interval. FALSE to auto-scale
every time scale() is called. Throttling avoids
overburdening the local R process.
errorNULL or character of length 1, choice of action if
the popped task threw an error. Possible values:
* "stop": throw an error in the main R session instead of
returning a value.
* "warn": throw a warning.
* NULL or "silent": do not react to errors.
NOTE: the only kinds of errors considered here are errors at the R
level. A crashed tasks will return a status of "crash" in the output
and not trigger an error in collect()
unless crashes_max is reached.
controllersNot used. Included to ensure the signature is compatible with the analogous method of controller groups.
A tibble of results and metadata of all resolved tasks,
with one row per task. Returns NULL if there are no tasks
to collect. See pop() for details on the columns of the
returned tibble.
wait()Wait for tasks.
crew_class_controller$wait( mode = "all", seconds_interval = NULL, seconds_timeout = Inf, scale = TRUE, throttle = TRUE, controllers = NULL )
modeCharacter string, name of the waiting condition.
wait(mode = "all") waits until all tasks in the mirai
compute profile resolve, and
wait(mode = "one") waits until at least one task is available
to push() or collect() from the controller.
The former still works if the controller is not the only
means of submitting tasks to the compute profile,
whereas the latter assumes only the controller submits tasks.
seconds_intervalDeprecated on 2025-01-17 (crew version
0.10.2.9003). Instead, the seconds_interval argument passed
to crew_controller_group() is used as seconds_max
in a crew_throttle() object which orchestrates exponential
backoff.
seconds_timeoutTimeout length in seconds waiting for tasks.
scaleLogical, whether to automatically call scale()
to auto-scale workers to meet the demand of the task load.
See also the throttle argument.
throttleTRUE to skip auto-scaling if it already happened
within the last polling interval. FALSE to auto-scale
every time scale() is called. Throttling avoids
overburdening the local R process.
controllersNot used. Included to ensure the signature is compatible with the analogous method of controller groups.
The wait() method blocks the calling R session
and (optionally) auto-scales workers
until the condition in the mode argument is met.
NOTE: wait() may register a task as resolved
a split second before the task handle is ready for pop()
or collect().
If wait() returns but pop() returns NULL, simply retry pop()
a short time later.
A logical of length 1, invisibly.
wait(mode = "all") returns TRUE if all tasks in the mirai
compute profile have resolved (FALSE otherwise).
wait(mode = "one") returns TRUE if the controller is ready
to pop or collect at least one resolved task (FALSE otherwise).
wait(mode = "one") assumes all
tasks were submitted through the controller and not by other means.
push_backlog()Push the name of a task to the backlog.
crew_class_controller$push_backlog(name, controller = NULL)
nameCharacter of length 1 with the task name to push to the backlog.
controllerNot used. Included to ensure the signature is compatible with the analogous method of controller groups.
pop_backlog() pops the tasks that can be pushed
without saturating the controller.
NULL (invisibly).
pop_backlog()Pop the task names from the head of the backlog which can be pushed without saturating the controller.
crew_class_controller$pop_backlog(controllers = NULL)
controllersNot used. Included to ensure the signature is compatible with the analogous method of controller groups.
Character vector of task names which can be pushed to the
controller without saturating it. If the controller is saturated,
character(0L) is returned.
summary()Summarize the collected tasks of the controller.
crew_class_controller$summary(controllers = NULL)
controllersNot used. Included to ensure the signature is compatible with the analogous method of controller groups.
A data frame of cumulative summary statistics on the tasks
collected through pop() and collect().
It has one row and the following columns:
controller: name of the controller.
seconds: total number of runtime in seconds.
tasks: total number of tasks collected.
success: total number of collected tasks that did not crash
or error.
error: total number of tasks with errors, either in the R code
of the task or an NNG-level error that is not a cancellation
or crash.
crash: total number of crashed tasks (where the worker exited
unexpectedly while it was running the task).
cancel: total number of tasks interrupted with the cancel()
controller method.
warning: total number of tasks with one or more warnings.
cancel()Cancel one or more tasks.
crew_class_controller$cancel(names = character(0L), all = FALSE)
namesCharacter vector of names of tasks to cancel.
Those names must have been manually supplied by push().
allTRUE to cancel all tasks, FALSE otherwise.
all = TRUE supersedes the names argument.
NULL (invisibly).
pids()Deprecated on 2025-08-26 in crew version 1.2.1.9005.
crew_class_controller$pids(controllers = NULL)
controllersNot used. Included to ensure the signature is compatible with the analogous method of controller groups.
The integer process ID of the current process.
terminate()Terminate the workers and the mirai client.
crew_class_controller$terminate(controllers = NULL)
controllersNot used. Included to ensure the signature is compatible with the analogous method of controller groups.
NULL (invisibly).
Other controller:
crew_controller()
if (identical(Sys.getenv("CREW_EXAMPLES"), "true")) {
client <- crew_client()
launcher <- crew_launcher_local()
controller <- crew_controller(client = client, launcher = launcher)
controller$start()
controller$push(name = "task", command = sqrt(4))
controller$wait()
controller$pop()
controller$terminate()
}
## ------------------------------------------------
## Method `crew_class_controller$new`
## ------------------------------------------------
if (identical(Sys.getenv("CREW_EXAMPLES"), "true")) {
client <- crew_client()
launcher <- crew_launcher_local()
controller <- crew_controller(client = client, launcher = launcher)
controller$start()
controller$push(name = "task", command = sqrt(4))
controller$wait()
controller$pop()
controller$terminate()
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.