Learn R Programming

drake (version 7.5.2)

drake_cache: Get the cache of a drake project.

Description

make() saves the values of your targets so you rarely need to think about output files. By default, the cache is a hidden folder called .drake/. You can also supply your own storr cache to the cache argument of make(). The drake_cache() function retrieves this cache.

Usage

drake_cache(path = NULL, verbose = 1L, console_log_file = NULL)

Arguments

path

Character. Set path to the path of a storr::storr_rds() cache to retrieve a specific cache generated by storr::storr_rds() or drake::new_cache(). If the path argument is NULL, drake_cache() searches up through parent directories to find a folder called .drake/.

verbose

Integer, control printing to the console/terminal.

  • 0: print nothing.

  • 1: print targets, retries, and failures.

  • 2: also show a spinner when preprocessing tasks are underway.

console_log_file

Optional character scalar of a file name or connection object (such as stdout()) to dump maximally verbose log information for make() and other functions (all functions that accept a config argument, plus drake_config()). If you choose to use a text file as the console log, it will persist over multiple function calls until you delete it manually. Fields in each row the log file, from left to right: - The node name (short host name) of the computer (from Sys.info()["nodename"]). - The process ID (from Sys.getpid()). - A timestamp with the date and time (in microseconds). - A brief description of what drake was doing. The fields are separated by pipe symbols ("|"`).

Value

A drake/storr cache in a folder called .drake/, if available. NULL otherwise.

See Also

new_cache(), drake_config()

Examples

Run this code
# NOT RUN {
isolate_example("Quarantine side effects.", {
if (suppressWarnings(require("knitr"))) {
clean(destroy = TRUE)
# No cache is available.
drake_cache() # NULL
load_mtcars_example() # Get the code with drake_example("mtcars").
make(my_plan) # Run the project, build the targets.
x <- drake_cache() # Now, there is a cache.
y <- storr::storr_rds(".drake") # Equivalent.
# List the objects readable from the cache with readd().
x$list()
}
})
# }

Run the code above in your browser using DataLab