Skip to content

Commit

Permalink
Use tibbles for build times...
Browse files Browse the repository at this point in the history
...now that pillar 1.2.1 is out. Rleated: #247.
  • Loading branch information
wlandau-lilly committed Mar 2, 2018
1 parent 27d2da4 commit 92b2baa
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
5 changes: 4 additions & 1 deletion R/build_times.R
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@ build_times <- function(
if (targets_only){
out <- out[out$type == "target", ]
}
out
tryCatch(
as_tibble(out),
error = error_tibble_times
)
}

fetch_runtime <- function(key, cache, type){
Expand Down
8 changes: 8 additions & 0 deletions R/handlers.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,11 @@ error_na <- function(e){
error_null <- function(e){
NULL
}

error_tibble_times <- function(e){
stop(
"Failed converting a data frame of times to a tibble. ",
"Please install version 1.2.1 or greater of the pillar package.",
call. = FALSE
)
}
9 changes: 7 additions & 2 deletions R/predict_runtime.R
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ rate_limiting_times <- function(
digits = Inf,
targets_only = FALSE,
verbose = TRUE
)
) %>%
as.data.frame
keys <- V(config$graph)$name
import_keys <- setdiff(keys, config$plan$target)
items <- intersect(keys, times$item)
Expand Down Expand Up @@ -213,7 +214,11 @@ rate_limiting_times <- function(
) %>%
round_times(digits = digits) %>%
unname_rows
out[!is.na(out$item), ]
out <- out[!is.na(out$item), ]
tryCatch(
as_tibble(out),
error = error_tibble_times
)
}

append_stages_to_times <- function(x, config){
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-edge-cases.R
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ test_with_dir("error handlers", {
expect_false(error_false(1))
expect_equal(error_character0(1), character(0))
expect_null(error_null(1))
expect_error(error_tibble_times(123))
})

test_with_dir("error when file target names do not match actual filenames", {
Expand Down

0 comments on commit 92b2baa

Please sign in to comment.