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)
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.
in addition, print checks and cache info.
in addition, print any potentially missing items.
in addition, print imports. Full verbosity.
number of parallel processes or jobs to run.
See predict_runtime()
to help figure out what the number of jobs should be.
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.
Imports and targets are processed separately, and they usually
have different parallelism needs. To use at most 2 jobs at a time
for imports and at most 4 jobs at a time for targets, call
make(..., jobs = c(imports = 2, targets = 4))
.
If parallelism
is "Makefile"
, Makefile-level parallelism is
only used for targets in your workflow plan data frame, not imports. To
process imported objects and files, drake selects the best parallel backend
for your system and uses the number of jobs you give to the jobs
argument to make()
. To use at most 2 jobs for imports and at
most 4 jobs for targets, run
make(..., parallelism = "Makefile", jobs = c(imports = 2, targets = 4))
or
make(..., parallelism = "Makefile", jobs = 2, args = "--jobs=4")
.
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.
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