R/cache_log.R
This functionality is like
make(..., cache_log_file = TRUE)
,
but separated and more customizable.
The drake_cache_log_file()
function writes a flat text file
to represents the state of all the targets and imports in the cache.
If you call it after each make()
and put the log file under version control,
you can track the changes to your results over time.
This way, your data is versioned alongside your code
in a easy-to-view format. Hopefully, this functionality
is a step toward better data versioning tools.
drake_cache_log_file(file = "drake_cache.log", path = getwd(), search = TRUE, cache = drake::get_cache(path = path, search = search, verbose = verbose), verbose = drake::default_verbose(), jobs = 1, targets_only = FALSE)
file | character scalar, name of the flat text log file. |
---|---|
path | Root directory of the drake project,
or if |
search | logical. If |
cache | drake cache. See |
verbose | logical or numeric, control printing to the console.
Use
|
jobs | number of jobs/workers for parallel processing |
targets_only | logical, whether to output information
only on the targets in your workflow plan data frame.
If |
There is no return value, but a log file is generated.
drake_cache_log()
,
make()
,
get_cache()
,
default_long_hash_algo()
,
short_hash()
,
long_hash()
# NOT RUN { test_with_dir("Quarantine side effects.", { # Load drake's canonical example. load_basic_example() # Get the code with drake_example() # Run the project and save a flat text log file. make(my_plan) drake_cache_log_file() # writes drake_cache.log # The above 2 lines are equivalent to make(my_plan, cache_log_file = TRUE) # nolint # At this point, put drake_cache.log under version control # (e.g. with 'git add drake_cache.log') alongside your code. # Now, every time you run your project, your commit history # of hash_lot.txt is a changelog of the project's results. # It shows which targets and imports changed on every commit. # It is extremely difficult to track your results this way # by putting the raw '.drake/' cache itself under version control. }) # }