Skip to content

Commit

Permalink
Fix #878
Browse files Browse the repository at this point in the history
  • Loading branch information
wlandau-lilly committed May 22, 2019
1 parent 93dd90a commit 3a696ea
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Version 7.3.0.9000

## Bug fixes

- Do not rehash large imported files every `make()` [#878](https://github.com/ropensci/drake/issues/878).

## New features

- Add `drake_slice()` to help split data across multiple targets. Related: [#77](https://github.com/ropensci/drake/issues/77), [#685](https://github.com/ropensci/drake/issues/685), [#833](https://github.com/ropensci/drake/issues/833).
Expand Down
8 changes: 0 additions & 8 deletions R/exec-meta.R
Original file line number Diff line number Diff line change
Expand Up @@ -169,14 +169,6 @@ rehash_dir <- function(dir, config) {
)
}

safe_rehash_storage <- function(target, config) {
if (file.exists(decode_path(target, config))) {
rehash_storage(target = target, config = config)
} else {
NA_character_
}
}

should_rehash_storage <- function(filename, new_mtime, old_mtime,
size_cutoff) {
do_rehash <- storage_size(filename) < size_cutoff | new_mtime > old_mtime
Expand Down
7 changes: 6 additions & 1 deletion R/exec-store.R
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,14 @@ store_object <- function(target, value, meta, config) {
}

store_file <- function(target, meta, config) {
if (meta$imported) {
value <- storage_hash(target = target, config = config)
} else {
value <- rehash_storage(target = target, config = config)
}
store_object(
target = target,
value = safe_rehash_storage(target = target, config = config),
value = value,
meta = meta,
config = config
)
Expand Down
3 changes: 2 additions & 1 deletion tests/testthat/test-utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,8 @@ test_with_dir("drake_slice on arrays", {
}
)
lst$along <- margin
out <- do.call(abind::abind, lst)
# unfixable partial arg match warnings:
out <- suppressWarnings(do.call(abind::abind, lst))
expect_equivalent(x, out)
}
}
Expand Down

0 comments on commit 3a696ea

Please sign in to comment.