Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/no-suggest-cmd-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
RUSH_TEST_USE_REDIS: true

strategy:
fail-fast: false
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/r-cmd-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
RUSH_TEST_USE_REDIS: true

strategy:
fail-fast: false
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/revdep-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ jobs:

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
RUSH_TEST_USE_REDIS: true

strategy:
fail-fast: false
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/helper_rush.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# soon replaced by import from rush package
skip_if_no_redis = function() {
testthat::skip_on_cran()
testthat::skip_if_not_installed("redux")

if (identical(Sys.getenv("RUSH_TEST_USE_REDIS"), "true") && redux::redis_available()) {
return(invisible())
Expand Down
5 changes: 3 additions & 2 deletions tests/testthat/test_OptimInstanceAsyncSingleCrit.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,11 @@ test_that("context is initialized correctly", {
})

test_that("point evaluation works", {
rush = start_rush()
# use worker to make its functions available
# FIXME: remove this after rush 1.0.0 is released
rush = start_rush_worker()
on.exit({
rush$reset()
mirai::daemons(0)
})

instance = oi_async(
Expand Down
2 changes: 0 additions & 2 deletions tests/testthat/test_OptimizerAsynGridSearch.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,4 @@ test_that("OptimizerAsyncGridSearch works", {

expect_data_table(optimizer$optimize(instance), nrows = 1)
expect_data_table(instance$archive$data, nrows = 100)

expect_rush_reset(instance$rush)
})
26 changes: 2 additions & 24 deletions tests/testthat/test_OptimizerAsync.R
Original file line number Diff line number Diff line change
@@ -1,30 +1,8 @@
skip_if_not_installed("rush")
skip_if_no_redis()

test_that("OptimizerAsync starts local workers", {
rush = start_rush(n_workers = 1, worker_type = "local") # FIXME: change to "processx" after rush 1.0.0 is released
on.exit({
rush$reset()
walk(rush$processes_processx, function(p) p$kill())
})

instance = oi_async(
objective = OBJ_2D,
search_space = PS_2D,
terminator = trm("evals", n_evals = 50L),
rush = rush
)

optimizer = opt("async_random_search")
optimizer$optimize(instance)

expect_data_table(instance$rush$worker_info, nrows = 1)
expect_list(instance$rush$processes_processx, len = 1)

})

test_that("OptimizerAsync starts remote workers", {
rush = start_rush(n_worker = 1, worker_type = "remote") # FIXME: change to "mirai" after rush 1.0.0 is released
test_that("OptimizerAsync starts workers", {
rush = start_rush(n_workers = 1, worker_type = "remote") # FIXME: change to "mirai" after rush 1.0.0 is released
on.exit({
rush$reset()
mirai::daemons(0)
Expand Down