drake (version 6.2.1)

configure_cache: Configure the hash algorithms, etc. of a drake cache.

Description

The purpose of this function is to prepare the cache to be called from make().

Usage

configure_cache(cache = drake::get_cache(verbose = verbose),
  short_hash_algo = drake::default_short_hash_algo(cache = cache),
  long_hash_algo = drake::default_long_hash_algo(cache = cache),
  log_progress = FALSE, overwrite_hash_algos = FALSE,
  verbose = drake::default_verbose(), jobs = 1,
  init_common_values = FALSE)

Arguments

cache

cache to configure

short_hash_algo

short hash algorithm for drake. The short algorithm must be among available_hash_algos(), which is just the collection of algorithms available to the algo argument in digest::digest(). See default_short_hash_algo() for more.

long_hash_algo

long hash algorithm for drake. The long algorithm must be among available_hash_algos(), which is just the collection of algorithms available to the algo argument in digest::digest(). See default_long_hash_algo() for more.

log_progress

deprecated logical. Previously toggled whether to clear the recorded build progress if this cache was used for previous calls to make().

overwrite_hash_algos

logical, whether to try to overwrite the hash algorithms in the cache with any user-specified ones.

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.

jobs

number of jobs for parallel processing

init_common_values

logical, whether to set the initial drake version in the cache and other common values. Not always a thread safe operation, so should only be TRUE on the master process

Value

A drake/storr cache.

See Also

default_short_hash_algo(), default_long_hash_algo()

Examples

Run this code
# NOT RUN {
test_with_dir("Quarantine side effects.", {
clean(destroy = TRUE)
load_mtcars_example() # Get the code with drake_example("mtcars").
config <- make(my_plan) # Run the project, build all the targets.
# Locate the drake/storr cache of the project
# inside the master internal configuration list.
cache <- config$cache
long_hash(cache) # Return the long hash algorithm used.
# Change the long hash algorithm of the cache.
cache <- configure_cache(
  cache = cache,
  long_hash_algo = "murmur32",
  overwrite_hash_algos = TRUE
)
long_hash(cache) # Show the new long hash algorithm.
make(my_plan) # Changing the long hash puts the targets out of date.
})
# }

Run the code above in your browser using DataLab