Define error handling policy for jobs
on_error.RdCreate an error handling policy that defines how to handle job failures, including retry logic, failure thresholds, and recovery strategies.
Examples
# \donttest{
# Retry failed jobs up to 3 times with exponential backoff
policy <- on_error(
action = "retry",
max_retries = 3,
backoff = "exponential",
backoff_base = 60
)
# Continue on errors and collect them
policy <- on_error(
action = "continue",
collect_errors = TRUE
)
# Use with job submission
risky_function <- function(x) if (runif(1) > 0.5) stop("Random error") else x^2
if (Sys.which("squeue") != "") {
jobs <- slurm_map(1:10, risky_function, .error_policy = policy)
}
# }