clean {drake} | R Documentation |
Invalidate and deregister targets.
Description
Force targets to be out of date and remove target names
from the data in the cache. Be careful and run which_clean()
before
clean()
. That way, you know beforehand which targets will be
compromised.
Usage
clean(
...,
list = character(0),
destroy = FALSE,
path = NULL,
search = NULL,
cache = drake::drake_cache(path = path),
verbose = NULL,
jobs = NULL,
force = FALSE,
garbage_collection = FALSE,
purge = FALSE
)
Arguments
... |
Symbols, individual targets to remove. |
list |
Character vector of individual targets to remove. |
destroy |
Logical, whether to totally remove the drake cache.
If |
path |
Path to a |
search |
Deprecated |
cache |
drake cache. See |
verbose |
Deprecated |
jobs |
Deprecated. |
force |
Logical, whether to try to clean the cache even though the project may not be back compatible with the current version of drake. |
garbage_collection |
Logical, whether to call
|
purge |
Logical, whether to remove objects from metadata namespaces such as "meta", "build_times", and "errors". |
Details
By default, clean()
invalidates all targets,
so be careful. clean()
always:
Forces targets to be out of date so the next
make()
does not skip them.Deregisters targets so
loadd(your_target)
andreadd(your_target)
no longer work.
By default, clean()
does not actually remove the underlying data.
Even old targets from the distant past are still in the cache
and recoverable via drake_history()
and make(recover = TRUE)
.
To actually remove target data from the cache, as well as any
file_out()
files from any targets you are currently cleaning,
run clean(garbage_collection = TRUE)
.
Garbage collection is slow, but it reduces the storage burden of the cache.
Value
Invisibly return NULL
.
See Also
Examples
## Not run:
isolate_example("Quarantine side effects.", {
if (suppressWarnings(require("knitr"))) {
load_mtcars_example() # Get the code with drake_example("mtcars").
make(my_plan) # Run the project, build the targets.
# Show all registered targets in the cache.
cached()
# Deregister 'summ_regression1_large' and 'small' in the cache.
clean(summ_regression1_large, small)
# Those objects are no longer registered as targets.
cached()
# Rebuild the invalidated/outdated targets.
make(my_plan)
# Clean everything.
clean()
# But the data objects and files are not actually gone!
file.exists("report.md")
drake_history()
make(my_plan, recover = TRUE)
# You need garbage collection to actually remove the data
# and any file_out() files of any uncleaned targets.
clean(garbage_collection = TRUE)
drake_history()
make(my_plan, recover = TRUE)
}
})
## End(Not run)