In a command in the workflow plan
or the body of an imported function, you can
ignore(some_code)
to
Force drake
to not track dependencies in some_code
, and
Ignore any changes in some_code
when it comes to
deciding which target are out of date.
ignore(x = NULL)
code to ignore
The argument.
# NOT RUN {
test_with_dir("Contain side effects", {
# Normally, `drake` reacts to changes in dependencies.
x <- 4
make(plan = drake_plan(y = sqrt(x)))
x <- 5
make(plan = drake_plan(y = sqrt(x)))
make(plan = drake_plan(y = sqrt(4) + x))
# But not with ignore().
make(plan = drake_plan(y = sqrt(4) + ignore(x))) # Builds y.
x <- 6
make(plan = drake_plan(y = sqrt(4) + ignore(x))) # Skips y.
make(plan = drake_plan(y = sqrt(4) + ignore(x + 1))) # Skips y.
# What about imported functions?
f <- function(x) sqrt(4) + ignore(x + 1)
make(plan = drake_plan(x = f(2)))
readd(x)
f <- function(x) sqrt(4) + ignore(x + 2)
make(plan = drake_plan(x = f(2)))
readd(x)
f <- function(x) sqrt(5) + ignore(x + 2)
make(plan = drake_plan(x = f(2)))
readd(x)
})
# }
Run the code above in your browser using DataLab