Stores the number of workers and Redis configuration options (redux::redis_config) for Rush. The function tests the connection to Redis and throws an error if the connection fails. This function is usually used in third-party packages to setup how workers are started.
Usage
rush_plan(
n_workers = NULL,
config = NULL,
lgr_thresholds = NULL,
lgr_buffer_size = NULL,
large_objects_path = NULL,
worker_type = "local"
)
Arguments
- n_workers
(
integer(1)
)
Number of workers to be started.- config
(redux::redis_config)
Configuration options used to connect to Redis. IfNULL
, theREDIS_URL
environment variable is parsed. IfREDIS_URL
is not set, a default configuration is used. See redux::redis_config for details.- lgr_thresholds
(named
character()
| namednumeric()
)
Logger threshold on the workers e.g.c(rush = "debug")
.- lgr_buffer_size
(
integer(1)
)
By default (lgr_buffer_size = 0
), the log messages are directly saved in the Redis data store. Iflgr_buffer_size > 0
, the log messages are buffered and saved in the Redis data store when the buffer is full. This improves the performance of the logging.- large_objects_path
(
character(1)
)
The path to the directory where large objects are stored.- worker_type
(
character(1)
)
The type of worker to use. Options are"local"
to start with processx,"remote"
to use mirai or"script"
to get a script to run.
Value
list()
with the stored configuration.
Examples
# This example is not executed since Redis must be installed
# \donttest{
config_local = redux::redis_config()
rush_plan(config = config_local, n_workers = 2)
rush = rsh(network_id = "test_network")
rush
#> <Rush>
#> * Running Workers: 0
#> * Queued Tasks: 0
#> * Queued Priority Tasks: 0
#> * Running Tasks: 0
#> * Finished Tasks: 0
#> * Failed Tasks: 0
# }