drake (version 6.2.1)

rescue_cache: Try to repair a drake cache that is prone to throwing storr-related errors.

Description

Sometimes, storr caches may have dangling orphaned files that prevent you from loading or cleaning. This function tries to remove those files so you can use the cache normally again.

Usage

rescue_cache(targets = NULL, path = getwd(), search = TRUE,
  verbose = drake::default_verbose(), force = FALSE,
  cache = drake::get_cache(path = path, search = search, verbose =
  verbose, force = force), jobs = 1, garbage_collection = FALSE)

Arguments

targets

Character vector, names of the targets to rescue. As with many other drake utility functions, the word target is defined generally in this case, encompassing imports as well as true targets. If targets is NULL, everything in the cache is rescued.

path

Root directory of the drake project, or if search is TRUE, either the project root or a subdirectory of the project. Ignored if a cache is supplied.

search

logical. If TRUE, search parent directories to find the nearest drake cache. Otherwise, look in the current working directory only. Ignored if a cache is supplied.

verbose

logical or numeric, control printing to the console. Use pkgconfig to set the default value of verbose for your R session: for example, pkgconfig::set_config("drake::verbose" = 2).

  • 0 or FALSE: print nothing.

  • 1 or TRUE: print only targets to build.

  • 2: also print checks and cache info.

  • 3: also print any potentially missing items.

  • 4: also print imports and writes to the cache.

force

deprecated

cache

a storr cache object

jobs

number of jobs for light parallelism (disabled on Windows)

garbage_collection

logical, whether to do garbage collection as a final step. See drake_gc() and clean() for details.

Value

The rescued drake/storr cache.

See Also

get_cache(), cached(), drake_gc(), clean()

Examples

Run this code
# NOT RUN {
test_with_dir("Quarantine side effects.", {
load_mtcars_example() # Get the code with drake_example("mtcars").
make(my_plan) # Run the project, build targets. This creates the cache.
# Remove dangling cache files that could cause errors.
rescue_cache(jobs = 2)
# Alternatively, just rescue targets 'small' and 'large'.
# Rescuing specific targets is usually faster.
rescue_cache(targets = c("small", "large"))
})
# }

Run the code above in your browser using DataLab