1919# ' The [rush::rush_plan()] function defines the number of workers and their type.
2020# ' There are three types of workers:
2121# '
22- # ' - "local": Workers are started as local processes with \CRANpkg{processx}.
23- # ' See `$start_local_workers()` in [Rush] for more details.
24- # ' - "remote": Workers are started with \CRANpkg{mirai} on local or remote machines.
22+ # ' - "mirai": Workers are started with \CRANpkg{mirai} on local or remote machines.
23+ # ' See `$start_workers()` in [Rush] for more details.
2524# ' [mirai::daemons()] must be created before starting the optimization.
26- # ' See `$start_remote_workers()` in [Rush] for more details.
25+ # ' - "processx": Workers are started as local processes with \CRANpkg{processx}.
26+
27+ # ' See `$start_local_workers()` in [Rush] for more details.
2728# ' - "script": Workers are started by the user with a custom script.
2829# ' See `$create_worker_script()` in [Rush] for more details.
2930# '
@@ -111,8 +112,7 @@ optimize_async_default = function(instance, optimizer, design = NULL, n_workers
111112 } else {
112113 # run .optimize() on workers
113114 rush = instance $ rush
114- # FIXME: change to "mirai" after rush 1.0.0 is released
115- worker_type = rush :: rush_config()$ worker_type %??% " remote"
115+ worker_type = rush :: rush_config()$ worker_type %??% " mirai"
116116
117117 if (worker_type == " script" ) {
118118 # worker script
@@ -123,18 +123,18 @@ optimize_async_default = function(instance, optimizer, design = NULL, n_workers
123123 instance = instance )
124124
125125 rush $ wait_for_workers(n = 1 )
126- } else if (worker_type %in% c( " remote " , " mirai" )) { # FIXME: change to "mirai" after rush 1.0.0 is released
127- # remote workers
128- worker_ids = rush $ start_remote_workers (
126+ } else if (worker_type == " mirai" ) {
127+ # mirai workers
128+ worker_ids = rush $ start_workers (
129129 n_workers = n_workers ,
130130 worker_loop = bbotk_worker_loop ,
131131 packages = c(optimizer $ packages , instance $ objective $ packages , " bbotk" ),
132132 optimizer = optimizer ,
133133 instance = instance )
134134
135135 rush $ wait_for_workers(n = 1 , worker_ids )
136- } else if (worker_type %in% c( " local " , " processx" )) { # FIXME: change to "processx" after rush 1.0.0 is released
137- # local workers
136+ } else if (worker_type == " processx" ) {
137+ # processx workers
138138 worker_ids = rush $ start_local_workers(
139139 n_workers = n_workers ,
140140 worker_loop = bbotk_worker_loop ,
@@ -191,7 +191,7 @@ optimize_async_default = function(instance, optimizer, design = NULL, n_workers
191191 # move queued and running tasks to failed
192192 failed_tasks = unlist(rush $ tasks_with_state(states = c(" queued" , " running" )))
193193 if (length(failed_tasks )) {
194- rush $ push_failed (failed_tasks , conditions = replicate(length(failed_tasks ), list (message = " Optimization terminated" ), simplify = FALSE ))
194+ rush $ fail_tasks (failed_tasks , conditions = replicate(length(failed_tasks ), list (message = " Optimization terminated" ), simplify = FALSE ))
195195 }
196196
197197 if (! instance $ archive $ n_finished ) {
0 commit comments