Skip to content

Commit

Permalink
fix: $detect_lost_tasks() did not work when no task was running
Browse files Browse the repository at this point in the history
  • Loading branch information
be-marc committed Oct 23, 2023
1 parent 20c55e9 commit efae7dc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions R/Rush.R
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,7 @@ Rush = R6::R6Class("Rush",

if (length(lost_workers)) {
running_tasks = self$fetch_running_tasks(fields = "worker_extra")
if (!nrow(running_tasks)) return(invisible(self))
bin_state = redux::object_to_bin(list(state = "lost"))
keys = running_tasks[lost_workers, keys, on = "worker_id"]

Expand Down
2 changes: 2 additions & 0 deletions tests/testthat/test-Rush.R
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,8 @@ test_that("a lost task is detected", {
expect_data_table(data, nrows = 1)
expect_set_equal(data$state, "lost")

expect_class(rush$detect_lost_tasks(), "Rush")

pids = rush$worker_info$pid
expect_rush_reset(rush)
clean_test_env(pids)
Expand Down

0 comments on commit efae7dc

Please sign in to comment.