Replies: 1 comment 5 replies
-
Yes, the current behavior is the intended behavior. If a target errors out, it should not return a value. Returning any value, no matter what the value is, implies success. Before that commit, errored targets with In your case, you might consider pre-filling the values of your targets using # _targets.R
library(targets)
library(tarchetypes)
tar_option_set(
error = "continue",
deployment = "main" # Do not run targets on the cluster the first time.
)
prefill_values <- function(code) {
NULL # Do not run the code and just return NULL for the target.
}
list(
tar_target(x, stop("message")),
tar_target(y, x),
tar_target(z, y)
) |>
tar_hook_outer(prefill_values(.x), all_of("x")) # Drop all_of("x") to apply the hook to all targets. > tar_make()
• start target x
• built target x
• start target y
• built target y
• start target z
• built target z
• end pipeline Then, just remove the hook remove # _targets.R
library(targets)
library(tarchetypes)
tar_option_set(error = "continue")
list(
tar_target(x, stop("message")),
tar_target(y, x),
tar_target(z, y)
) > tar_make()
• start target x
x error target x
Error: message
✓ skip target y
✓ skip target z
• end pipeline |
Beta Was this translation helpful? Give feedback.
-
Hi @wlandau,
I'm wondering if cb85323 had the intended effect when
error = 'continue'
?Expected Behaviour
error = 'continue'
, the whole pipeline keeps going.Observed Behaviour
Before cb85323
error = 'continue'
( &retrieval = 'main'
), the pipeline keeps going, treating the errored targets as having no outputerror = 'stop'
orerror = 'abridge'
After cb85323
error = 'continue'
, the pipeline keeps going, but (as far as I can see) all targets downstream of an errored target throw an error too.error = 'continue'
almost mirrors settingerror = 'abridge'
on the erroring targets, as far as I understand it.Is this the desired behaviour for
error = 'continue'
? Perhaps so, & it's the safest option in some cases, but it risks making large pipelines fragile if certain errors are considered acceptable by the user (e.g. infrastructure preemption). If this behaviour were desired, perhaps users could seterror = 'abridge'
instead?Beta Was this translation helpful? Give feedback.
All reactions