Skip to content

Commit

Permalink
Save common load tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wlandau committed Jan 28, 2024
1 parent a4f5694 commit 39c7f3b
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 9 deletions.
35 changes: 26 additions & 9 deletions tests/hpc/test-crew_local.R
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,25 @@ tar_test("prevent high-memory data via target objects", {
pryr::object_size(self)
})

tar_test("saturated controllers should get tasks", {
# Also watch CPU usage on htop. Should be low.
skip_on_cran()
skip_if_not_installed("crew")
tar_script({
library(targets)
controller <- crew::crew_controller_local(workers = 2)
tar_option_set(controller = controller)
list(
tar_target(w, Sys.sleep(10)),
tar_target(x, Sys.sleep(10)),
tar_target(y, Sys.sleep(10)),
tar_target(z, Sys.sleep(10))
)
})
tar_make() # All 4 targets should start and the last 2 should be "pending".
expect_equal(tar_outdated(callr_function = NULL), character(0))
})

tar_test("heavily parallel workload should run fast", {
skip_on_cran()
skip_if_not_installed("crew")
Expand Down Expand Up @@ -120,21 +139,19 @@ tar_test("heavily parallel workload should run fast", {
expect_equal(tar_outdated(callr_function = NULL), character(0))
})

tar_test("saturated controllers should get tasks", {
# Also watch CPU usage on htop. Should be low.
tar_test("crew local with many tasks and many workers", {
skip_on_cran()
skip_if_not_installed("crew")
tar_script({
library(crew)
library(targets)
controller <- crew::crew_controller_local(workers = 2)
controller <- crew_controller_local(workers = 25, tasks_max = 100)
tar_option_set(controller = controller)
list(
tar_target(w, Sys.sleep(10)),
tar_target(x, Sys.sleep(10)),
tar_target(y, Sys.sleep(10)),
tar_target(z, Sys.sleep(10))
tar_target(x, seq_len(10000)),
tar_target(y, Sys.sleep(1), pattern = map(x))
)
})
tar_make() # All 4 targets should start and the last 2 should be "pending".
expect_equal(tar_outdated(callr_function = NULL), character(0))
tar_make()
expect_equal(tar_outdated(reporter = "forecast"), character(0))
})
20 changes: 20 additions & 0 deletions tests/hpc/test-crew_sge.R.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
tar_test("crew SGE with many tasks and many workers", {
skip_on_cran()
skip_if_not_installed("crew.cluster")
tar_script({
library(crew.cluster)
library(targets)
controller <- crew_controller_sge(
workers = 25,
tasks_max = 100,
script_lines = "module load R/4.2.2"
)
tar_option_set(controller = controller)
list(
tar_target(x, seq_len(10000)),
tar_target(y, Sys.sleep(1), pattern = map(x))
)
})
tar_make()
expect_equal(tar_outdated(reporter = "forecast"), character(0))
})

0 comments on commit 39c7f3b

Please sign in to comment.