igraph
dependency network of your project.This function returns an igraph object representing how
the targets in your workflow plan data frame
depend on each other.
(help(package = "igraph")
). To plot this graph, call
to plot.igraph()
on your graph. See the online manual
for enhanced graph visualization functionality.
build_drake_graph(plan = read_drake_plan(), targets = plan$target,
envir = parent.frame(), verbose = drake::default_verbose(),
jobs = 1, sanitize_plan = FALSE, console_log_file = NULL,
trigger = drake::trigger(), cache = NULL)
workflow plan data frame.
A workflow plan data frame is a data frame
with a target
column and a command
column.
(See the details in the drake_plan()
help file
for descriptions of the optional columns.)
Targets are the objects and files that drake generates,
and commands are the pieces of R code that produce them.
Use the function drake_plan()
to generate workflow plan
data frames easily, and see functions plan_analyses()
,
plan_summaries()
, evaluate_plan()
,
expand_plan()
, and gather_plan()
for
easy ways to generate large workflow plan data frames.
character vector, names of targets to build.
Dependencies are built too. Together, the plan
and
targets
comprise the workflow network
(i.e. the graph
argument).
Changing either will change the network.
environment to use. Defaults to the current
workspace, so you should not need to worry about this
most of the time. A deep copy of envir
is made,
so you don't need to worry about your workspace being modified
by make
. The deep copy inherits from the global environment.
Wherever necessary, objects and functions are imported
from envir
and the global environment and
then reproducibly tracked as dependencies.
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)
.
FALSE
:print nothing.
TRUE
:print only targets to build.
+ checks and cache info.
+ any potentially missing items.
+ imports and writes to the cache.
maximum number of parallel workers for processing the targets.
If you wish to parallelize the imports and preprocessing as well, you can
use a named numeric vector of length 2, e.g.
make(jobs = c(imports = 4, targets = 8))
.
make(jobs = 4)
is equivalent to make(jobs = c(imports = 1, targets = 4))
.
Windows users should not set jobs > 1
if
parallelism
is "mclapply"
because
mclapply()
is based on forking. Windows users
who use parallelism = "Makefile"
will need to
download and install Rtools.
You can experiment with predict_runtime()
to help decide on an appropriate number of jobs.
For details, visit
https://ropenscilabs.github.io/drake-manual/time.html.
logical, deprecated. If you must,
call drake:::sanitize_plan()
to sanitize the plan
and/or drake:::sanitize_targets()
to sanitize the targets
(or just get plan
and targets
and graph
from
drake_config()
).
character scalar or NULL
.
If NULL
, console output will be printed
to the R console using message()
.
Otherwise, console_log_file
should be the name of a flat file.
Console output will be appended to that file.
optional, a global trigger for building targets
(see trigger()
).
an optional storr
cache for memoization
An igraph object representing the workflow plan dependency network.
# NOT RUN {
test_with_dir("Quarantine side effects.", {
load_mtcars_example() # Get the code with drake_example("mtcars").
# Make the igraph network connecting all the targets and imports.
g <- build_drake_graph(my_plan)
class(g) # "igraph"
})
# }
Run the code above in your browser using DataLab