Skip to content

Commit

Permalink
docs: fix parameter description
Browse files Browse the repository at this point in the history
  • Loading branch information
be-marc committed Apr 2, 2024
1 parent 7a58f14 commit be8c1b2
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 16 deletions.
20 changes: 12 additions & 8 deletions R/Rush.R
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,8 @@ Rush = R6::R6Class("Rush",
assert_subset(unlist(worker_ids), self$worker_ids)
r = self$connector

# FIXME: Kill workers?

lg$error("Restarting %i worker(s): %s", length(worker_ids), str_collapse(worker_ids))
processes = set_names(map(worker_ids, function(worker_id) {
# restart worker
Expand Down Expand Up @@ -386,11 +388,8 @@ Rush = R6::R6Class("Rush",
#'
#' @param restart_workers (`logical(1)`)\cr
#' Whether to restart lost workers.
#' @param restart_tasks (`logical(1)`)\cr
#' Whether to restart lost tasks.
detect_lost_workers = function(restart_workers = FALSE, restart_tasks = FALSE) {
detect_lost_workers = function(restart_workers = FALSE) {
assert_flag(restart_workers)
assert_flag(restart_tasks)
r = self$connector

# check workers with a heartbeat
Expand Down Expand Up @@ -690,13 +689,13 @@ Rush = R6::R6Class("Rush",
#'
#' @param keys (`character()`)\cr
#' Keys of the tasks to be retried.
#' @param ignore_max_retires (`logical(1)`)\cr
#' @param ignore_max_retries (`logical(1)`)\cr
#' Whether to ignore the maximum number of retries.
#' @param next_seed (`logical(1)`)\cr
#' Whether to change the seed of the task.
retry_tasks = function(keys, ignore_max_retires = FALSE, next_seed = FALSE) {
retry_tasks = function(keys, ignore_max_retries = FALSE, next_seed = FALSE) {
assert_character(keys)
assert_flag(ignore_max_retires)
assert_flag(ignore_max_retries)
assert_flag(next_seed)
tasks = self$read_hashes(keys, fields = c("seed", "max_retries", "n_retries"), flatten = FALSE)
seeds = map(tasks, "seed")
Expand All @@ -707,7 +706,7 @@ Rush = R6::R6Class("Rush",

if (!all(failed)) lg$error("Not all task(s) failed: %s", str_collapse(keys[!failed]))

if (ignore_max_retires) {
if (ignore_max_retries) {
keys = keys[failed]
} else {
if (!all(retrieable)) lg$error("Task(s) reached the maximum number of retries: %s", str_collapse(keys[!retrieable]))
Expand Down Expand Up @@ -932,6 +931,7 @@ Rush = R6::R6Class("Rush",
#' Fetch tasks with different states from the data base.
#' If tasks with different states are to be queried at the same time, this function prevents tasks from appearing twice.
#' This could be the case if a worker changes the state of a task while the tasks are being fetched.
#' Finished tasks are cached.
#'
#' @param fields (`character()`)\cr
#' Fields to be read from the hashes.
Expand Down Expand Up @@ -1445,7 +1445,11 @@ Rush = R6::R6Class("Rush",
# finished tasks keys can be restricted to uncached tasks
.tasks_with_state = function(states, only_new_keys = FALSE) {
r = self$connector

# optionally limit finished tasks to uncached tasks
start_finished_tasks = if (only_new_keys) length(private$.cached_tasks) else 0

# get keys of tasks with different states in one transaction
r$MULTI()
if ("queued" %in% states) r$LRANGE(private$.get_key("queued_tasks"), 0, -1)
if ("running" %in% states) r$SMEMBERS(private$.get_key("running_tasks"))
Expand Down
1 change: 1 addition & 0 deletions R/rush_plan.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#'
#' @template param_n_workers
#' @template param_lgr_thresholds
#' @template param_large_objects_path
#'
#' @export
rush_plan = function(n_workers, config = NULL, lgr_thresholds = NULL, large_objects_path = NULL) {
Expand Down
2 changes: 2 additions & 0 deletions man-roxygen/param_large_objects_path.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#' @param large_objects_path [character(1)]\cr
#' The path to the directory where large objects are stored.
10 changes: 4 additions & 6 deletions man/Rush.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion man/rush_plan.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions man/store_large_object.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/testthat/test-RushWorker.R
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ test_that("retry a failed task works with a maximum of retries", {
rush$push_failed(task$key, condition = list(list(message = "error")))
expect_output(rush$retry_tasks(keys), "reached the maximum number of retries")

rush$retry_tasks(keys, ignore_max_retires = TRUE)
rush$retry_tasks(keys, ignore_max_retries = TRUE)
task_info = rush$read_hash(keys, fields = c("max_retries", "n_retries"))
expect_equal(task_info$max_retries, 1)
expect_equal(task_info$n_retries, 2)
Expand Down

0 comments on commit be8c1b2

Please sign in to comment.