knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" ) library(drake.hasty)
Hasty mode is accelerated execution with all of drake
's storage and reproducibility guarantees stripped away. For experimentation only. Use at your own risk.
config$hasty_build()
), andknitr
/rmarkdown
reports with calls to loadd()
/readd()
will no longer work properly as pieces of the pipeline.hasty_build
function to your drake_config()
object, you can experiment with different ways to process targets.drake
's standard modes.drake
still builds the correct targets in the correct order, waiting for dependencies to finish before advancing downstream.library(remotes) install_github("ropensci/drake") install_github("wlandau/drake.hasty")
We begin with a drake
project.
library(drake.hasty) plan <- drake_plan(x = rnorm(100), y = mean(x), z = median(x)) plan
First, create a drake_config()
object from your workflow.
config <- drake_config(plan)
You really only need the plan
, schedule
, and envir
slots of config
. Feel free to create them yourself.
config <- list( plan = config$plan, schedule = config$schedule, envir = config$envir )
Then run the project.
hasty_make(config = config)
By default, there is no caching or checking in hasty mode, so your targets are never up to date.
hasty_make(config = config)
If you have the clustermq
package installed, you can use parallel and distributed computing.
# Use 2 persistent workers. config$jobs <- 2 # See https://github.com/mschubert/clustermq for more options. options(clustermq.scheduler = "multicore") hasty_make(config = config)
You can customize how each target gets built. By default, hasty_build_default()
is used.
hasty_build_default
But there is another built-in function that also stores the targets to drake
's cache.
hasty_build_store
To use it, simply add the build function and a storr
cache to config
and run hasty_make()
.
config$hasty_build <- hasty_build_store config$cache <- storr::storr_rds(tempfile()) hasty_make(config = config)
Now you can read targets from the cache.
readd(z, cache = config$cache)
Similarly, you can write your own custom build functions for config$hasty_build
.
drake::clean(destroy = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.