diff --git a/DESCRIPTION b/DESCRIPTION index 7efd1989..4d8416ba 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -12,7 +12,7 @@ Description: Pipeline tools coordinate the pieces of computationally The methodology in this package borrows from GNU 'Make' (2015, ISBN:978-9881443519) and 'drake' (2018, ). -Version: 1.7.1.9005 +Version: 1.7.1.9006 License: MIT + file LICENSE URL: https://docs.ropensci.org/targets/, https://github.com/ropensci/targets BugReports: https://github.com/ropensci/targets/issues diff --git a/NEWS.md b/NEWS.md index 47d06fc9..8d891ff9 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# targets 1.7.1.9005 (development) +# targets 1.7.1.9006 (development) * Wrap `tar_watch()` UI module in `bslib::page()` (#1302, @kwbyron-lilly). * Remove `callr_function` in `tar_make_as_job()` argument list. @@ -13,6 +13,7 @@ * Implement `tar_repository_cas()`, `tar_repository_cas_local()`, and `tar_repository_cas_local_gc()` for content-addressable storage (#1232, #1314, @noamross). * Add `tar_format_get()` to make implementing CAS systems easier. * Implement `error = "trim"` in `tar_target()` and `tar_option_set()` (#1310, #1311, @hadley). +* Print storage size of each target in verbose reporters (#1337, @psychelzh). # targets 1.7.1 diff --git a/R/class_verbose.R b/R/class_verbose.R index 3158d475..2725c838 100644 --- a/R/class_verbose.R +++ b/R/class_verbose.R @@ -35,6 +35,7 @@ verbose_class <- R6::R6Class( name = target_get_name(target), prefix = target_get_type_cli(target), seconds_elapsed = target$metrics$seconds, + bytes_storage = target$store$file$bytes, print = FALSE ) ) diff --git a/R/utils_cli.R b/R/utils_cli.R index 63022b85..c22ea7f0 100644 --- a/R/utils_cli.R +++ b/R/utils_cli.R @@ -16,15 +16,22 @@ cli_completed <- function( prefix = NULL, time_stamp = FALSE, seconds_elapsed = NULL, + bytes_storage = NULL, print = TRUE ) { time <- if_any(time_stamp, time_stamp_cli(), NULL) - msg <- paste(c(time, "completed", prefix, name), collapse = " ") - if (!is.null(seconds_elapsed)) { - msg_time <- paste0(" [", units_seconds(seconds_elapsed), "]") - msg <- paste0(msg, msg_time) + message <- paste(c(time, "completed", prefix, name), collapse = " ") + metrics <- character(0L) + if (!is.null(seconds_elapsed) && !anyNA(seconds_elapsed)) { + metrics <- c(metrics, units_seconds(seconds_elapsed)) + } + if (!is.null(bytes_storage) && !anyNA(bytes_storage)) { + metrics <- c(metrics, units_bytes(bytes_storage)) + } + if (length(metrics)) { + metrics <- paste0("[", paste(metrics, collapse = ", "), "]") } - cli_green_record(msg, print = print) + cli_green_record(paste(message, metrics), print = print) } cli_skip <- function(name, prefix = NULL, time_stamp = FALSE, print = TRUE) {