Skip to content

Commit

Permalink
Merge pull request #152 from wlandau/master
Browse files Browse the repository at this point in the history
Final wave of function renaming.
  • Loading branch information
wlandau-lilly authored Nov 13, 2017
2 parents 20a4b61 + d030cba commit 13ead19
Show file tree
Hide file tree
Showing 57 changed files with 702 additions and 253 deletions.
5 changes: 5 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ export(deps)
export(diagnose)
export(do_prework)
export(drake_build)
export(drake_config)
export(drake_example)
export(drake_examples)
export(drake_palette)
export(drake_session)
export(drake_tip)
Expand Down Expand Up @@ -84,6 +87,8 @@ export(prune_drake_graph)
export(r_recipe_wildcard)
export(rate_limiting_times)
export(read_config)
export(read_drake_config)
export(read_drake_graph)
export(read_graph)
export(read_plan)
export(readd)
Expand Down
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,15 @@
- `backend()` => `future::plan()`
- `build_graph()` => `build_drake_graph()`
- `check()` => `check_plan()`
- `config()` => `drake_config()`
- `evaluate()` => `evaluate_plan()`
- `example_drake()` => `drake_example()`
- `examples_drake()` => `drake_examples()`
- `expand()` => `expand_plan()`
- `gather()` => `gather_plan()`
- `plot_graph()` => `vis_drake_graph()`
- `read_config()` => `read_drake_config()`
- `read_graph()` => `read_drake_graph()`
- `render_graph()` => `render_drake_graph()`
- `session()` => `drake_session()`
- `summaries()` => `plan_summaries()`
Expand Down
4 changes: 2 additions & 2 deletions R/Makefile.R
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ build_recipe <- function(target, recipe_command,
#' # These examples peer into the internals of drake,
#' # but are not really of practical use for most users.
#' load_basic_example() # Load drake's canonical example.
#' con <- config(my_plan) # Construct the internal configuration list.
#' con <- drake_config(my_plan) # Construct the internal configuration list.
#' # Prepare to use a distributed computing parallel backend
#' # such as "Makefile" or "future_lapply".
#' drake:::prepare_distributed(config = con)
Expand All @@ -114,7 +114,7 @@ mk <- function(
cache_path = drake::default_cache_path()
){
build_distributed(target = target, cache_path = cache_path)
config <- recover_config(cache_path)
config <- recover_drake_config(cache_path)
new_hash <- self_hash(target = target, config = config)
if (!identical(config$old_hash, new_hash)){
file <- time_stamp_file(target = target, config = config)
Expand Down
2 changes: 1 addition & 1 deletion R/basic_example.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#' Also writes/overwrites the file \code{report.Rmd}.
#' For a thorough walkthrough of how to set up this example, see the
#' quickstart vignette: \code{vignette('quickstart')}. Alternatively,
#' call \code{\link{example_drake}('basic')} to generate an R script
#' call \code{\link{drake_example}('basic')} to generate an R script
#' that builds up this example step by step.
#' @export
#' @return The workflow plan data frame of the basic example.
Expand Down
2 changes: 1 addition & 1 deletion R/build.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#' # Populate your workspace and write 'report.Rmd'.
#' load_basic_example()
#' # Create the master internal configuration list.
#' config <- config(my_plan)
#' config <- drake_config(my_plan)
#' # Compute metadata on 'small', including a hash/fingerprint
#' # of the dependencies.
#' meta_list <- list(
Expand Down
6 changes: 3 additions & 3 deletions R/check.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,19 @@ check_plan <- function(
verbose = TRUE
){
force(envir)
config <- config(
config <- drake_config(
plan = plan,
targets = targets,
envir = envir,
verbose = verbose,
cache = cache
)
check_config(config)
check_drake_config(config)
check_strings(config$plan)
invisible(plan)
}

check_config <- function(config) {
check_drake_config <- function(config) {
stopifnot(is.data.frame(config$plan))
if (!all(c("target", "command") %in% colnames(config$plan)))
stop("The columns of your workflow plan data frame ",
Expand Down
13 changes: 7 additions & 6 deletions R/config.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' @title Function config
#' @title Function drake_config
#' @description Compute the internal runtime parameter list of
#' \code{\link{make}()}. This could save time if you are planning
#' multiple function calls of functions like \code{\link{outdated}()}
Expand Down Expand Up @@ -45,7 +45,8 @@
#' @examples
#' \dontrun{
#' load_basic_example() # Load drake's canonical example.
#' con <- config(my_plan) # Construct the master internal configuration list.
#' # Construct the master internal configuration list.
#' con <- drake_config(my_plan)
#' # These functions are faster than otherwise
#' # because they use the configuration list.
#' outdated(config = con) # Which targets are out of date?
Expand All @@ -57,7 +58,7 @@
#' # Get the underlying node/edge data frames of the graph.
#' dataframes_graph(config = con)
#' }
config <- function(
drake_config <- function(
plan = workplan(),
targets = drake::possible_targets(plan),
envir = parent.frame(),
Expand Down Expand Up @@ -128,7 +129,7 @@ config <- function(
timeout = timeout, cpu = cpu, elapsed = elapsed, retries = retries
) %>%
quick_inventory
check_config(config = config)
check_drake_config(config = config)
config
}

Expand All @@ -154,7 +155,7 @@ add_packages_to_prework <- function(packages, prework) {
#' \dontrun{
#' load_basic_example() # Load drake's canonical example.
#' # Create a master internal configuration list with prework.
#' con <- config(my_plan, prework = c("library(knitr)", "x <- 1"))
#' con <- drake_config(my_plan, prework = c("library(knitr)", "x <- 1"))
#' # Do the prework. Usually done at the beginning of `make()`,
#' # and for distributed computing backends like "future_lapply",
#' # right before each target is built.
Expand Down Expand Up @@ -211,7 +212,7 @@ possible_targets <- function(plan = workplan()) {
c(as.character(plan$output), as.character(plan$target))
}

store_config <- function(config) {
store_drake_config <- function(config) {
save_these <- setdiff(names(config), "envir") # envir could get massive.
lightly_parallelize(
save_these,
Expand Down
2 changes: 1 addition & 1 deletion R/dataframes_graph.R
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ dataframes_graph <- function(
) {
force(envir)
if (is.null(config)){
config <- config(plan = plan, targets = targets,
config <- drake_config(plan = plan, targets = targets,
envir = envir, verbose = verbose,
hook = hook, cache = cache,
parallelism = parallelism, jobs = jobs,
Expand Down
2 changes: 1 addition & 1 deletion R/debug.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ dbug <- function() {
envir <- dbug_envir(envir)
dbug_files()
plan <- dbug_plan()
config(plan = plan, targets = plan$target,
drake_config(plan = plan, targets = plan$target,
envir = envir, parallelism = scenario$parallelism,
jobs = scenario$jobs, verbose = FALSE
)
Expand Down
Loading

0 comments on commit 13ead19

Please sign in to comment.