From de44794c16509a39c38f1a40dc7b610960fb4f61 Mon Sep 17 00:00:00 2001 From: wlandau-lilly Date: Tue, 9 Oct 2018 12:31:51 -0400 Subject: [PATCH] Stop earlier if all targets are up to date. Ref: https://github.com/ropensci/drake/issues/455#issuecomment-428036646 --- R/make.R | 8 ++++++-- man/deps_code.Rd | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/R/make.R b/R/make.R index 0b24f6ab4..18d55c48e 100644 --- a/R/make.R +++ b/R/make.R @@ -339,8 +339,12 @@ make_imports <- function(config = drake::read_drake_config()){ #' }) #' } make_targets <- function(config = drake::read_drake_config()){ - up_to_date <- outdated(config, do_prework = FALSE, make_imports = FALSE) %>% - setdiff(x = config$all_targets) + outdated <- outdated(config, do_prework = FALSE, make_imports = FALSE) + if (!length(outdated)){ + console_up_to_date(config = config) + return(config) + } + up_to_date <- setdiff(config$all_targets, outdated) config$schedule <- targets_graph(config = config) %>% igraph::delete_vertices(v = up_to_date) config$jobs <- targets_setting(config$jobs) diff --git a/man/deps_code.Rd b/man/deps_code.Rd index 08c63f11f..c545430b3 100644 --- a/man/deps_code.Rd +++ b/man/deps_code.Rd @@ -44,7 +44,7 @@ enclosing them in literal double quotes. (For example, \code{file_store("report.Rmd")} is just \code{"\"report.Rmd\""}.) \code{Drake} takes special precautions so that a target/import -does not depend on itself. For example, \code{deps_code(f)`` might return }"f"\code{if}f()` is a recursive function, but \code{\link[=make]{make()}} just ignores +does not depend on itself. For example, \code{deps_code(f)`` might return}"f"\code{if}f()` is a recursive function, but \code{\link[=make]{make()}} just ignores this conflict and runs as expected. In other words, \code{\link[=make]{make()}} automatically removes all self-referential loops in the dependency network.