Skip to content

Commit 8206a61

Browse files
authored
refactor: remove rush backward compatibility (#328)
* refactor: remove rush backward compatibility * ... * ...
1 parent 0077d32 commit 8206a61

28 files changed

+47
-118
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Suggests:
4545
progressr,
4646
redux,
4747
RhpcBLASctl,
48-
rush (>= 0.4.1),
48+
rush (>= 1.0.0),
4949
testthat (>= 3.0.0)
5050
Config/testthat/edition: 3
5151
Config/testthat/parallel: false

NEWS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# bbotk (development version)
22

3+
* Minimum required version of `rush` is now 1.0.0. Removed all compatibility workarounds for older versions.
34
* feat: Add `mlr_test_functions` dictionary with well-known 2-D optimization test functions (Branin, Rosenbrock, Himmelblau, Rastrigin, etc.) and sugar functions `otfun()` / `otfuns()`.
45

56
# bbotk 1.9.0

R/ArchiveAsync.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
#' )
4646
#'
4747
#' # start workers
48-
#' rush::rush_plan(worker_type = "remote")
48+
#' rush::rush_plan(worker_type = "mirai")
4949
#' mirai::daemons(1)
5050
#'
5151
#' # initialize instance
@@ -134,7 +134,7 @@ ArchiveAsync = R6Class("ArchiveAsync",
134134
#' Named list of additional information.
135135
push_result = function(key, ys, x_domain, extra = NULL) {
136136
extra = c(list(x_domain = list(x_domain), timestamp_ys = Sys.time()), extra)
137-
self$rush$push_results(key, list(ys), extra = list(extra))
137+
self$rush$finish_tasks(key, list(ys), extra = list(extra))
138138
},
139139

140140
#' @description
@@ -145,7 +145,7 @@ ArchiveAsync = R6Class("ArchiveAsync",
145145
#' @param message (`character()`)\cr
146146
#' Error message.
147147
push_failed_point = function(key, message) {
148-
self$rush$push_failed(key, list(list(message = message)))
148+
self$rush$fail_tasks(key, list(list(message = message)))
149149
},
150150

151151
#' @description

R/ArchiveAsyncFrozen.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
#' )
4545
#'
4646
#' # start workers
47-
#' rush::rush_plan(worker_type = "remote")
47+
#' rush::rush_plan(worker_type = "mirai")
4848
#' mirai::daemons(1)
4949
#'
5050
#' # initialize instance

R/OptimInstanceAsyncMultiCrit.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
#' )
4949
#'
5050
#' # start workers
51-
#' rush::rush_plan(worker_type = "remote")
51+
#' rush::rush_plan(worker_type = "mirai")
5252
#' mirai::daemons(1)
5353
#'
5454
#' # initialize instance

R/OptimInstanceAsyncSingleCrit.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
#' )
4545
#'
4646
#' # start workers
47-
#' rush::rush_plan(worker_type = "remote")
47+
#' rush::rush_plan(worker_type = "mirai")
4848
#' mirai::daemons(1)
4949
#'
5050
#' # initialize instance

R/OptimizerAsync.R

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,12 @@
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) {

R/OptimizerAsyncDesignPoints.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
#' )
4747
#'
4848
#' # start workers
49-
#' rush::rush_plan(worker_type = "remote")
49+
#' rush::rush_plan(worker_type = "mirai")
5050
#' mirai::daemons(1)
5151
#'
5252
#' # initialize instance

R/OptimizerAsyncGridSearch.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
#' )
5252
#'
5353
#' # start workers
54-
#' rush::rush_plan(worker_type = "remote")
54+
#' rush::rush_plan(worker_type = "mirai")
5555
#' mirai::daemons(1)
5656
#'
5757
#' # initialize instance

R/OptimizerAsyncRandomSearch.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
#' )
4343
#'
4444
#' # start workers
45-
#' rush::rush_plan(worker_type = "remote")
45+
#' rush::rush_plan(worker_type = "mirai")
4646
#' mirai::daemons(1)
4747
#'
4848
#' # initialize instance

0 commit comments

Comments
 (0)