Skip to content

Commit

Permalink
Fix #548
Browse files Browse the repository at this point in the history
  • Loading branch information
wlandau-lilly committed Oct 13, 2018
1 parent cdca7b2 commit db2dc45
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 3 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

## Bug fixes

- Make commands in the plan are re-analyzed for dependencies when new imports are added (https://github.com/ropensci/drake/issues/548). Was a bug in version 6.0.0 only.
- Call `path.expand()` on the `file` argument to `render_drake_graph()` and `render_sankey_drake_graph()`. That way, tildes in file paths no longer interfere with the rendering of static image files. Compensates for https://github.com/wch/webshot.
- Skip tests and examples if the required "Suggests" packages are not installed.
- Stop checking for non-standard columns. Previously, warnings about non-standard columns were incorrectly triggered by `evaluate_plan(trace = TRUE)` followed by `expand_plan()`, `gather_plan()`, `reduce_plan()`, `gather_by()`, or `reduce_by()`. The more relaxed behavior also gives users more options about how to construct and maintain their workflow plan data frames.
Expand Down
11 changes: 8 additions & 3 deletions R/build_drake_graph.R
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ build_drake_graph <- function(
command_deps <- memo_expr(
bdg_analyze_commands(config),
config$cache,
config$plan[, c("target", "command")]
config$plan[, c("target", "command")],
import_deps
)
trigger_cols <- intersect(colnames(config$plan), c("target", "trigger"))
trigger_plan <- config$plan[, trigger_cols]
Expand All @@ -79,14 +80,18 @@ build_drake_graph <- function(
config$cache,
trigger_plan,
config$trigger,
triggers
triggers,
import_deps,
command_deps
)
change_deps <- memo_expr(
bdg_get_change_deps(config, triggers),
config$cache,
trigger_plan,
config$trigger,
triggers
triggers,
import_deps,
command_deps
)
edges <- memo_expr(
bdg_create_edges(
Expand Down
12 changes: 12 additions & 0 deletions tests/testthat/test-command-changes.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,15 @@ test_with_dir("changes to commands are handled well", {
sort(c("drake_target_1", "final"))
)
})

test_with_dir("add a new target", {
plan <- drake_plan(a = as.integer(sqrt(4)))
cache <- storr::storr_environment()
config <- make(plan, cache = cache, session_info = FALSE)
expect_equal(justbuilt(config), "a")
expect_equal(readd(a, cache = cache), 2L)
plan <- rbind(plan, drake_plan(b = as.integer(sqrt(16))))
config <- make(plan, cache = cache, session_info = FALSE)
expect_equal(justbuilt(config), "b")
expect_equal(readd(b, cache = cache), 4L)
})
14 changes: 14 additions & 0 deletions tests/testthat/test-import-object.R
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,17 @@ test_with_dir("responses to imported objects and functions", {
expect_equal(justbuilt(config), builds)
expect_false(identical(final0, readd(final, search = FALSE)))
})

test_with_dir("add a new import", {
plan <- drake_plan(a = as.integer(sqrt(4)))
cache <- storr::storr_environment()
config <- make(plan, cache = cache, session_info = FALSE)
expect_equal(justbuilt(config), "a")
expect_equal(readd(a, cache = cache), 2L)
sqrt <- function(x){
x + 1L
}
config <- make(plan, cache = cache, session_info = FALSE)
expect_equal(justbuilt(config), "a")
expect_equal(readd(a, cache = cache), 5L)
})

0 comments on commit db2dc45

Please sign in to comment.