Skip to content

Commit

Permalink
Merge pull request #151 from wlandau/master
Browse files Browse the repository at this point in the history
Deprecate plot_graph and render_graph(), use different names
  • Loading branch information
wlandau-lilly committed Nov 13, 2017
2 parents 06895ce + 03338c1 commit 20a4b61
Show file tree
Hide file tree
Showing 55 changed files with 875 additions and 428 deletions.
6 changes: 5 additions & 1 deletion NAMESPACE
Expand Up @@ -3,9 +3,11 @@
export(Makefile_recipe)
export(analyses)
export(analysis_wildcard)
export(as_drake_filename)
export(as_file)
export(available_hash_algos)
export(backend)
export(build_drake_graph)
export(build_graph)
export(build_times)
export(built)
Expand Down Expand Up @@ -78,14 +80,15 @@ export(plot_graph)
export(possible_targets)
export(predict_runtime)
export(progress)
export(prune_graph)
export(prune_drake_graph)
export(r_recipe_wildcard)
export(rate_limiting_times)
export(read_config)
export(read_graph)
export(read_plan)
export(readd)
export(recover_cache)
export(render_drake_graph)
export(render_graph)
export(rescue_cache)
export(session)
Expand All @@ -97,6 +100,7 @@ export(this_cache)
export(tracked)
export(triggers)
export(type_of_cache)
export(vis_drake_graph)
export(workflow)
export(workplan)
importFrom(R.utils,isPackageLoaded)
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Expand Up @@ -13,11 +13,15 @@
- Delete long-deprecated functions `prune()` and `status()`.
- Deprecate and rename functions:
- `analyses()` => `plan_analyses()`
- `as_file()` => `as_drake_filename()`
- `backend()` => `future::plan()`
- `build_graph()` => `build_drake_graph()`
- `check()` => `check_plan()`
- `evaluate()` => `evaluate_plan()`
- `expand()` => `expand_plan()`
- `gather()` => `gather_plan()`
- `plot_graph()` => `vis_drake_graph()`
- `render_graph()` => `render_drake_graph()`
- `session()` => `drake_session()`
- `summaries()` => `plan_summaries()`
- Disallow `output` and `code` as names in the workflow plan data frame. Use `target` and `command` instead. This naming switch has been formally deprecated for several months prior.
Expand Down
6 changes: 4 additions & 2 deletions R/Makefile.R
Expand Up @@ -69,15 +69,17 @@ build_recipe <- function(target, recipe_command,
cache_path <- cache_value_macro
}
if (is_file(target)){
target <- paste0("drake::as_file(\"", eply::unquote(target), "\")")
target <- paste0("drake::as_drake_filename(\"",
eply::unquote(target), "\")")
} else{
target <- eply::quotes(
eply::unquote(target), single = FALSE)
}
r_recipe <- paste0("drake::mk(target = ", target,
", cache_path = \"", cache_path, "\")")
if (!safe_grepl(r_recipe_wildcard(), recipe_command)){
recipe_command <- paste0(recipe_command, " '", r_recipe_wildcard(), "'")
recipe_command <- paste0(recipe_command, " '",
r_recipe_wildcard(), "'")
}
gsub(r_recipe_wildcard(), r_recipe, recipe_command)
}
Expand Down
2 changes: 1 addition & 1 deletion R/basic_example.R
Expand Up @@ -27,7 +27,7 @@
#' deps(my_plan$command[1])
#' deps(my_plan$command[4])
#' # Plot the interactive network visualization of the workflow.
#' plot_graph(my_plan)
#' vis_drake_graph(my_plan)
#' # Run the workflow to build all the targets in the plan.
#' make(my_plan)
#' # Remove the whole cache.
Expand Down
8 changes: 4 additions & 4 deletions R/color.R
@@ -1,6 +1,6 @@
# Below, the colors from "target" through
# "fail" are for the console. The rest
# are for plot_graph().
# are for vis_drake_graph().
colors <- c(
target = "green3",
import = "dodgerblue3",
Expand All @@ -25,12 +25,12 @@ colors <- c(
#' @title Function palette
#' @export
#' @description show color palette for drake.
#' Used in both the console and \code{\link{plot_graph}()}
#' Used in both the console and \code{\link{vis_drake_graph}()}
#' Your console must have the crayon package enabled.
#' @details This palette applies to console output
#' (internal functions \code{console()} and
#' \code{console_many_targets()}) and the node colors
#' in \code{\link{plot_graph}()}.
#' in \code{\link{vis_drake_graph}()}.
#' So if you want to contribute improvements to the palette,
#' please both \code{drake_palette()} and
#' \code{visNetwork::visNetwork(nodes = \link{legend_nodes}())}
Expand All @@ -40,7 +40,7 @@ colors <- c(
#' # Show drake's color palette as text.
#' drake_palette()
#' # Show part of the palette as an interactive visNetwork graph.
#' # These are the nodes in the legend of plot_graph().
#' # These are the nodes in the legend of vis_drake_graph().
#' visNetwork::visNetwork(nodes = legend_nodes())
drake_palette <- function(){
out <- lapply(
Expand Down
11 changes: 6 additions & 5 deletions R/config.R
Expand Up @@ -2,7 +2,7 @@
#' @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}()}
#' or \code{\link{plot_graph}()}. Drake needs to import and cache files
#' or \code{\link{vis_drake_graph}()}. Drake needs to import and cache files
#' and objects to compute the configuration list, which in turn
#' supports user-side functions to help with visualization and parallelism.
#' The result differs from
Expand All @@ -11,7 +11,8 @@
#' not just the imports.
#' @export
#' @return The master internal configuration list of a project.
#' @seealso \code{\link{workplan}}, \code{\link{make}}, \code{\link{plot_graph}}
#' @seealso \code{\link{workplan}}, \code{\link{make}},
#' \code{\link{vis_drake_graph}}
#' @param plan same as for \code{\link{make}}
#' @param targets same as for \code{\link{make}}
#' @param envir same as for \code{\link{make}}
Expand Down Expand Up @@ -52,7 +53,7 @@
#' # In make(..., jobs = n), it would be silly to set `n` higher than this:
#' max_useful_jobs(config = con)
#' # Show a visNetwork graph
#' plot_graph(config = con)
#' vis_drake_graph(config = con)
#' # Get the underlying node/edge data frames of the graph.
#' dataframes_graph(config = con)
#' }
Expand Down Expand Up @@ -110,11 +111,11 @@ config <- function(
)
trigger <- match.arg(arg = trigger, choices = triggers())
if (is.null(graph)){
graph <- build_graph(plan = plan, targets = targets,
graph <- build_drake_graph(plan = plan, targets = targets,
envir = envir, verbose = verbose, jobs = jobs,
skip_imports = skip_imports)
} else {
graph <- prune_graph(graph = graph, to = targets, jobs = jobs)
graph <- prune_drake_graph(graph = graph, to = targets, jobs = jobs)
}
config <- list(
plan = plan, targets = targets, envir = envir, cache = cache,
Expand Down
4 changes: 2 additions & 2 deletions R/dataframes_graph.R
Expand Up @@ -6,7 +6,7 @@
#' one for edges, and one for
#' the legend nodes. The list also contains the
#' default title of the graph.
#' @seealso \code{\link{plot_graph}}, \code{\link{build_graph}}
#' @seealso \code{\link{vis_drake_graph}}, \code{\link{build_drake_graph}}
#' @param plan workflow plan data frame, same as for function
#' \code{\link{make}()}.
#'
Expand Down Expand Up @@ -117,7 +117,7 @@
#' \dontrun{
#' load_basic_example() # Load drake's canonical example.
#' # Get a list of data frames representing the nodes, edges,
#' # and legend nodes of the visNetwork graph from plot_graph().
#' # and legend nodes of the visNetwork graph from vis_drake_graph().
#' raw_graph <- dataframes_graph(my_plan)
#' # Choose a subset of the graph.
#' smaller_raw_graph <- dataframes_graph(
Expand Down
14 changes: 7 additions & 7 deletions R/dataframes_graph_utils.R
Expand Up @@ -70,13 +70,13 @@ configure_nodes <- function(config){

#' @title Function default_graph_title
#' @description Default title of the graph for
#' \code{\link{plot_graph}()}.
#' \code{\link{vis_drake_graph}()}.
#' @export
#' @seealso \code{\link{dataframes_graph}}, \code{\link{plot_graph}}
#' @seealso \code{\link{dataframes_graph}}, \code{\link{vis_drake_graph}}
#' @param parallelism Mode of parallelism intended for the workplan.
#' See \code{\link{parallelism_choices}()}.
#' @param split_columns logical, whether the columns were split
#' in \code{\link{dataframes_graph}()} or \code{\link{plot_graph}()}
#' in \code{\link{dataframes_graph}()} or \code{\link{vis_drake_graph}()}
#' with the \code{split_columns} argument.
#' @examples
#' default_graph_title()
Expand Down Expand Up @@ -261,17 +261,17 @@ subset_nodes_edges <- function(config, keep, choices = V(config$graph)$name){
#' @title Function legend_nodes
#' @export
#' @seealso \code{\link{drake_palette}()},
#' \code{\link{plot_graph}()},
#' \code{\link{vis_drake_graph}()},
#' \code{\link{dataframes_graph}()}
#' @description Output a \code{visNetwork}-friendly
#' data frame of nodes. It tells you what
#' the colors and shapes mean
#' in \code{\link{plot_graph}()}.
#' in \code{\link{vis_drake_graph}()}.
#' @param font_size font size of the node label text
#' @return A data frame of legend nodes for \code{\link{plot_graph}()}.
#' @return A data frame of legend nodes for \code{\link{vis_drake_graph}()}.
#' @examples
#' \dontrun{
#' # Show the legend nodes used in plot_graph().
#' # Show the legend nodes used in vis_drake_graph().
#' # For example, you may want to inspect the color palette more closely.
#' visNetwork::visNetwork(nodes = legend_nodes())
#' }
Expand Down
2 changes: 1 addition & 1 deletion R/dependencies.R
Expand Up @@ -151,7 +151,7 @@ tracked <- function(
skip_imports = FALSE
){
force(envir)
graph <- build_graph(
graph <- build_drake_graph(
plan = plan, targets = targets, envir = envir,
jobs = jobs, verbose = verbose, skip_imports = skip_imports
)
Expand Down

0 comments on commit 20a4b61

Please sign in to comment.