Worker loop that pops a single task from the queue, executes the function in an external callr session and pushes the results. Supports timeouts on the tasks.
Arguments
- fun
(
function
)
Function to be executed.- constants
(
list
)
List of constants passed tofun
.- rush
(RushWorker)
Rush worker instance.
Examples
# This example is not executed since Redis must be installed
# \donttest{
config_local = redux::redis_config()
rush = rsh(network_id = "test_network", config = config_local)
#> Error in initialize(...): Can't connect to Redis. Check the configuration.
fun = function(x1, x2, ...) list(y = x1 + x2)
rush$start_local_workers(
fun = fun,
worker_loop = worker_loop_callr)
#> Error: object 'rush' not found
rush$stop_workers()
#> Error: object 'rush' not found
# }