Skip to content

Commit

Permalink
Testing
Browse files Browse the repository at this point in the history
  • Loading branch information
wlandau-lilly committed Jan 9, 2024
1 parent 4c1b5df commit 8cf036b
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions tests/sge/monitor.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,21 @@ test_that("SGE monitor terminate one job at a time", {
on.exit(controller$terminate())
controller$start()
controller$launch(n = 2L)
names <- vapply(
controller$launcher$workers$handle,
function(handle) handle$name,
FUN.VALUE = character(1L)
)
monitor <- crew_monitor_sge(verbose = TRUE)
envir <- new.env(parent = emptyenv())
crew::crew_retry(
~ nrow(monitor$jobs()) > 1L,
~ all(names %in% monitor$jobs()$name),
seconds_interval = 1,
seconds_timeout = 60,
message = "could not submit jobs"
)
jobs <- monitor$jobs()
expect_true(nrow(jobs) > 1L)
jobs <- jobs[jobs$name %in% names, ]
expect_equal(nrow(jobs), 2L)
expect_true(is.character(jobs$job_number))
expect_false(anyNA(jobs$job_number))
expect_true(all(nzchar(jobs$job_number)))
Expand All @@ -43,16 +48,21 @@ test_that("THIS TEST DELETES ALL USER JOBS! USE WITH CAUTION!", {
on.exit(controller$terminate())
controller$start()
controller$launch(n = 2L)
names <- vapply(
controller$launcher$workers$handle,
function(handle) handle$name,
FUN.VALUE = character(1L)
)
monitor <- crew_monitor_sge(verbose = TRUE)
envir <- new.env(parent = emptyenv())
crew::crew_retry(
~ nrow(monitor$jobs()) > 1L,
~ all(names %in% monitor$jobs()$name),
seconds_interval = 1,
seconds_timeout = 60,
message = "could not submit jobs"
)
jobs <- monitor$jobs()
expect_true(nrow(jobs) > 1L)
jobs <- jobs[jobs$name %in% names, ]
expect_equal(nrow(jobs), 2L)
expect_true(is.character(jobs$job_number))
expect_false(anyNA(jobs$job_number))
expect_true(all(nzchar(jobs$job_number)))
Expand Down

0 comments on commit 8cf036b

Please sign in to comment.