diff --git a/DESCRIPTION b/DESCRIPTION index 55bd4638c..3cf53a028 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -106,7 +106,7 @@ Depends: Imports: base64url, digest (>= 0.6.21), - igraph, + igraph (>= 2.0.0), methods, parallel, rlang (>= 0.2.0), diff --git a/NAMESPACE b/NAMESPACE index ac48457b8..d98df8fa0 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -429,6 +429,7 @@ importFrom(igraph,make_empty_graph) importFrom(igraph,set_vertex_attr) importFrom(igraph,simplify) importFrom(igraph,topo_sort) +importFrom(igraph,union) importFrom(igraph,vertex_attr) importFrom(methods,new) importFrom(methods,setRefClass) diff --git a/R/create_drake_graph.R b/R/create_drake_graph.R index 2a5821f31..3b0a42e00 100644 --- a/R/create_drake_graph.R +++ b/R/create_drake_graph.R @@ -92,7 +92,7 @@ cdg_transitive_edges <- function(vertex, edges, args) { cdg_finalize_graph <- function(edges, targets, args) { args$logger$disk("finalize graph edges") file_out <- edges$to[edges$from %in% targets & is_encoded_path(edges$to)] - to <- union(targets, file_out) + to <- base::union(targets, file_out) args$logger$disk("create igraph") graph <- igraph::graph_from_data_frame(edges) args$logger$disk("trim neighborhoods") diff --git a/R/drake_plan.R b/R/drake_plan.R index c35cae0d0..22b62211b 100644 --- a/R/drake_plan.R +++ b/R/drake_plan.R @@ -358,7 +358,7 @@ drake_bind_rows <- function(...) { flatten_df_list(args, df_env = df_env) dfs <- df_env$dfs cols <- lapply(dfs, colnames) - cols <- Reduce(f = union, x = cols) + cols <- Reduce(f = base::union, x = cols) dfs <- lapply(dfs, fill_cols, cols = cols) do.call(rbind, dfs) } diff --git a/R/dynamic.R b/R/dynamic.R index 38c3e900d..1430a2573 100644 --- a/R/dynamic.R +++ b/R/dynamic.R @@ -297,7 +297,7 @@ register_in_graph <- function(target, subtargets, config) { name = "imported", value = FALSE ) - config$envir_graph$graph <- igraph::graph.union( + config$envir_graph$graph <- igraph::union( config$envir_graph$graph, subgraph ) diff --git a/R/make.R b/R/make.R index 621f4a4ed..561955475 100644 --- a/R/make.R +++ b/R/make.R @@ -53,7 +53,7 @@ #' For each target that is still problematic (e.g. #' `https://github.com/rstudio/gt/issues/297`) #' you can safely run the command in its own special `callr::r()` process. -#' Example: `https://github.com/rstudio/gt/issues/297#issuecomment-497778735`. # nolin +#' Example: `https://github.com/rstudio/gt/issues/297#issuecomment-497778735`. # nolint #' @section Cache locking: #' When `make()` runs, it locks the cache so other processes cannot modify it. #' Same goes for [outdated()], [vis_drake_graph()], and similar functions @@ -397,7 +397,7 @@ drake_set_session_info <- function( #' }) #' } do_prework <- function(config, verbose_packages) { - for (package in union(c("methods", "drake"), config$packages)) { + for (package in base::union(c("methods", "drake"), config$packages)) { expr <- as.call(c( quote(require), package = package, diff --git a/R/package.R b/R/package.R index d35180005..1a8c7059d 100644 --- a/R/package.R +++ b/R/package.R @@ -48,7 +48,7 @@ #' @importFrom igraph adjacent_vertices as_ids components delete_vertices #' degree gorder graph_from_adjacency_matrix igraph_opt igraph_options #' induced_subgraph is_dag make_empty_graph make_ego_graph set_vertex_attr -#' simplify topo_sort V vertex_attr +#' simplify topo_sort union V vertex_attr #' @importFrom methods new setRefClass #' @importFrom parallel mclapply #' @importFrom rlang dots_list enquo eval_tidy expr quo_squash quos trace_back diff --git a/R/predict_runtime.R b/R/predict_runtime.R index 4ed99eb39..3bc783d11 100644 --- a/R/predict_runtime.R +++ b/R/predict_runtime.R @@ -299,7 +299,7 @@ register_subtargets_graph2 <- function(target, subtargets, config) { name = "imported", value = FALSE ) - config$graph <- igraph::graph.union(config$graph, subgraph) + config$graph <- igraph::union(config$graph, subgraph) config } diff --git a/man/make.Rd b/man/make.Rd index 2a293260f..6b48c8d5e 100644 --- a/man/make.Rd +++ b/man/make.Rd @@ -53,7 +53,7 @@ make( memory_strategy = "speed", layout = NULL, spec = NULL, - lock_envir = TRUE, + lock_envir = NULL, history = TRUE, recover = FALSE, recoverable = TRUE, @@ -606,14 +606,7 @@ during \code{make()} itself. For each target that is still problematic (e.g. \verb{https://github.com/rstudio/gt/issues/297}) you can safely run the command in its own special \code{callr::r()} process. -Example: \verb{https://github.com/rstudio/gt/issues/297#issuecomment-497778735}. # nolint - -If that fails, you can run \code{make(plan, lock_envir = FALSE)} -to suppress environment-locking for all targets. -However, this is not usually recommended. -There are legitimate use cases for \code{lock_envir = FALSE} -(example: \verb{https://books.ropensci.org/drake/hpc.html#parallel-computing-within-targets}) # nolint -but most workflows should stick with the default \code{lock_envir = TRUE}. +Example: \verb{https://github.com/rstudio/gt/issues/297#issuecomment-497778735}. # nolin } \section{Cache locking}{ diff --git a/tests/testthat/test-1-interactive.R b/tests/testthat/test-1-interactive.R index 25eee4026..fcabf08c1 100644 --- a/tests/testthat/test-1-interactive.R +++ b/tests/testthat/test-1-interactive.R @@ -276,22 +276,6 @@ test_with_dir("clustermq error messages get back to main", { }) } -if (FALSE) { -test_with_dir("forks + lock_envir = informative warning msg", { - skip_on_cran() - # Don't run this test for real because (1) we would have to add - # furrr to "Suggests" and (2) at some point, base R may be patched - # so forking in the parallel package does not give this warning anyway. - # Also, it needs to run outside the RStudio IDE so we can fork processes. - regexp <- "workaround" - plan <- drake_plan(x = parallel::mclapply(1:2, identity, mc.cores = 2)) - expect_warning( - make(plan, envir = globalenv(), lock_envir = TRUE), - regexp = regexp - ) -}) -} - if (FALSE) { test_with_dir("clean() in interactive mode", { skip_on_cran() diff --git a/tests/testthat/test-8-cache.R b/tests/testthat/test-8-cache.R index 4e69a2a4e..55f2248e3 100644 --- a/tests/testthat/test-8-cache.R +++ b/tests/testthat/test-8-cache.R @@ -817,7 +817,7 @@ test_with_dir("cache log files, gc, and make()", { test_with_dir("try_build() does not need to access cache", { skip_on_cran() # CRAN gets essential tests only (check time limits). - config <- drake_config(drake_plan(x = 1), lock_envir = FALSE) + config <- drake_config(drake_plan(x = 1)) meta <- drake_meta_(target = "x", config = config) config$cache <- config$settings$cache_log_file <- NULL build <- try_build(target = "x", meta = meta, config = config) diff --git a/tests/testthat/test-9-clustermq.R b/tests/testthat/test-9-clustermq.R index 448c1264e..80f8539c1 100644 --- a/tests/testthat/test-9-clustermq.R +++ b/tests/testthat/test-9-clustermq.R @@ -45,8 +45,7 @@ test_with_dir("clustermq parallelism", { caching = caching, envir = e, verbose = 1L, - garbage_collection = TRUE, - lock_envir = TRUE + garbage_collection = TRUE ) expect_equal(outdated_impl(config), character(0)) make( @@ -55,8 +54,7 @@ test_with_dir("clustermq parallelism", { jobs = jobs, caching = caching, envir = e, - verbose = 1L, - lock_envir = TRUE + verbose = 1L ) expect_equal(justbuilt(config), character(0)) e$my_plan$command[[2]] <- as.call( @@ -68,8 +66,7 @@ test_with_dir("clustermq parallelism", { jobs = jobs, caching = caching, envir = e, - verbose = 1L, - lock_envir = TRUE + verbose = 1L ) expect_equal(justbuilt(config), "small") clean(small, cache = config$cache) @@ -79,8 +76,7 @@ test_with_dir("clustermq parallelism", { jobs = jobs, caching = caching, envir = e, - verbose = 1L, - lock_envir = TRUE + verbose = 1L ) expect_equal(justbuilt(config), "small") } @@ -172,8 +168,7 @@ test_with_dir("Start off with non-HPC targets, then go to HPC targets.", { jobs = jobs, envir = e, verbose = 1L, - garbage_collection = TRUE, - lock_envir = TRUE + garbage_collection = TRUE ) config <- drake_config(e$my_plan, envir = e) expect_equal(sort(justbuilt(config)), sort(e$my_plan$target)) diff --git a/tests/testthat/test-9-future.R b/tests/testthat/test-9-future.R index d2cb59cb1..5e6a6be8d 100644 --- a/tests/testthat/test-9-future.R +++ b/tests/testthat/test-9-future.R @@ -30,8 +30,7 @@ test_with_dir("future package functionality", { caching = caching[i], jobs = 1, verbose = 0L, - session_info = FALSE, - lock_envir = TRUE + session_info = FALSE ) config <- drake_config( e$my_plan, @@ -40,8 +39,7 @@ test_with_dir("future package functionality", { caching = caching[i], jobs = 1, verbose = 0L, - session_info = FALSE, - lock_envir = TRUE + session_info = FALSE ) expect_equal( outdated_impl(config), @@ -57,8 +55,7 @@ test_with_dir("future package functionality", { caching = caching[i], jobs = 1, verbose = 0L, - session_info = FALSE, - lock_envir = TRUE + session_info = FALSE ) expect_equal(justbuilt(config), "small") } @@ -72,8 +69,7 @@ test_with_dir("future package functionality", { caching = caching[i], jobs = 1, verbose = 0L, - session_info = FALSE, - lock_envir = TRUE + session_info = FALSE ) config <- drake_config( e$my_plan, @@ -82,8 +78,7 @@ test_with_dir("future package functionality", { caching = caching[i], jobs = 1, verbose = 0L, - session_info = FALSE, - lock_envir = TRUE + session_info = FALSE ) nobuild(config) }