Retry a task (or set of tasks). Typically this is after failure
(e.g., ERROR
, DIED
or similar) but you can retry even
successfully completed tasks. Once retried, functions that
retrieve information about a task (e.g., rrq_task_status()
, [rrq_task_result()]) will behave differently depending on the value of their
followargument. See
vignette("fault-tolerance")` for more details.
Arguments
- task_ids
Task ids to retry.
- controller
The controller to use. If not given (or
NULL
) we'll use the controller registered withrrq_default_controller_set()
.
Examples
obj <- rrq_controller("rrq:example")
# It's straightforward to see the effect of retrying a task with
# one that produces a different value each time, so here, we use a
# simple task that draws one normally distributed random number
t1 <- rrq_task_create_expr(rnorm(1), controller = obj)
rrq_task_wait(t1, controller = obj)
#> [1] TRUE
rrq_task_result(t1, controller = obj)
#> [1] -0.6648678
# If we retry the task we'll get a different value:
t2 <- rrq_task_retry(t1, controller = obj)
rrq_task_wait(t2, controller = obj)
#> [1] TRUE
rrq_task_result(t2, controller = obj)
#> [1] 0.7877277
# Once a task is retried, most of the time (by default) you can use
# the original id and the new one exchangeably:
rrq_task_result(t1, controller = obj)
#> [1] 0.7877277
rrq_task_result(t2, controller = obj)
#> [1] 0.7877277
# Use the 'follow' argument to modify this behaviour
rrq_task_result(t1, follow = FALSE, controller = obj)
#> [1] -0.6648678
rrq_task_result(t2, follow = FALSE, controller = obj)
#> [1] 0.7877277
# See the retry chain with rrq_task_info
rrq_task_info(t1, controller = obj)
#> $id
#> [1] "d0b91033a5eac68ddf20c4b549f55eec"
#>
#> $status
#> [1] "MOVED"
#>
#> $queue
#> [1] "default"
#>
#> $separate_process
#> [1] FALSE
#>
#> $timeout
#> NULL
#>
#> $worker
#> [1] "exhaustible_umbrette"
#>
#> $pid
#> NULL
#>
#> $depends
#> $depends$up
#> NULL
#>
#> $depends$down
#> NULL
#>
#>
#> $moved
#> $moved$up
#> NULL
#>
#> $moved$down
#> [1] "a48b72e80b66c2ce40fbb24c83a6536b"
#>
#>
rrq_task_info(t2, controller = obj)
#> $id
#> [1] "a48b72e80b66c2ce40fbb24c83a6536b"
#>
#> $status
#> [1] "COMPLETE"
#>
#> $queue
#> NULL
#>
#> $separate_process
#> logical(0)
#>
#> $timeout
#> NULL
#>
#> $worker
#> [1] "exhaustible_umbrette"
#>
#> $pid
#> NULL
#>
#> $depends
#> $depends$up
#> NULL
#>
#> $depends$down
#> NULL
#>
#>
#> $moved
#> $moved$up
#> [1] "d0b91033a5eac68ddf20c4b549f55eec"
#>
#> $moved$down
#> NULL
#>
#>