Skip to content

Commit

Permalink
tar_completed()
Browse files Browse the repository at this point in the history
  • Loading branch information
wlandau-lilly committed Dec 4, 2023
1 parent 5dc08ab commit cf2a6d8
Show file tree
Hide file tree
Showing 18 changed files with 130 additions and 40 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@ export(tar_callr_args_default)
export(tar_callr_inner_try)
export(tar_cancel)
export(tar_canceled)
export(tar_completed)
export(tar_config_get)
export(tar_config_projects)
export(tar_config_set)
Expand Down
19 changes: 12 additions & 7 deletions R/tar_built.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#' @title List built targets.
#' @title Deprecated: list built targets.
#' @export
#' @family progress
#' @description List targets whose progress is `"built"`.
#' @return A character vector of built targets.
#' @keywords internal
#' @description Deprecated in favor of [tar_completed()] on 2023-12-04
#' (version 1.3.2.9004).
#' @return A character vector of completed targets.
#' @inheritParams tar_progress
#' @param names Optional, names of the targets. If supplied, the
#' function restricts its output to these targets.
Expand All @@ -18,14 +19,18 @@
#' )
#' }, ask = FALSE)
#' tar_make()
#' tar_built()
#' tar_built(starts_with("y_")) # see also any_of()
#' tar_completed()
#' tar_completed(starts_with("y_")) # see also any_of()
#' })
#' }
tar_built <- function(
names = NULL,
store = targets::tar_config_get("store")
) {
tar_warn_deprecate(
"tar_built() is deprecated in targets version >= 1.3.2.9004 ",
"(2021-12-04). Use tar_completed() instead."
)
tar_assert_allow_meta("tar_built", store)
progress <- progress_init(path_store = store)
progress <- tibble::as_tibble(progress$database$read_condensed_data())
Expand All @@ -34,5 +39,5 @@ tar_built <- function(
if (!is.null(names)) {
progress <- progress[match(names, progress$name), , drop = FALSE] # nolint
}
progress$name[progress$progress == "built"]
progress$name[progress$progress == "completed"]
}
38 changes: 38 additions & 0 deletions R/tar_completed.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#' @title List completed targets.
#' @export
#' @family progress
#' @description List targets whose progress is `"completed"`.
#' @return A character vector of completed targets.
#' @inheritParams tar_progress
#' @param names Optional, names of the targets. If supplied, the
#' function restricts its output to these targets.
#' You can supply symbols
#' or `tidyselect` helpers like [any_of()] and [starts_with()].
#' @examples
#' if (identical(Sys.getenv("TAR_EXAMPLES"), "true")) { # for CRAN
#' tar_dir({ # tar_dir() runs code from a temp dir for CRAN.
#' tar_script({
#' list(
#' tar_target(x, seq_len(2)),
#' tar_target(y, 2 * x, pattern = map(x))
#' )
#' }, ask = FALSE)
#' tar_make()
#' tar_completed()
#' tar_completed(starts_with("y_")) # see also any_of()
#' })
#' }
tar_completed <- function(
names = NULL,
store = targets::tar_config_get("store")
) {
tar_assert_allow_meta("tar_completed", store)
progress <- progress_init(path_store = store)
progress <- tibble::as_tibble(progress$database$read_condensed_data())
names_quosure <- rlang::enquo(names)
names <- tar_tidyselect_eval(names_quosure, progress$name)
if (!is.null(names)) {
progress <- progress[match(names, progress$name), , drop = FALSE] # nolint
}
progress$name[progress$progress == "completed"]
}
2 changes: 1 addition & 1 deletion R/tar_started.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#' @keywords internal
#' @description Deprecated in favor of [tar_dispatched()] on 2023-12-04
#' (version 1.3.2.9004).
#' @return A character vector of started targets.
#' @return A character vector of dispatched targets.
#' @inheritParams tar_progress
#' @param names Optional, names of the targets. If supplied, the
#' function restricts its output to these targets.
Expand Down
27 changes: 7 additions & 20 deletions man/tar_built.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/tar_canceled.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 59 additions & 0 deletions man/tar_completed.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/tar_dispatched.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/tar_errored.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/tar_poll.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/tar_progress.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/tar_progress_branches.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/tar_progress_summary.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/tar_skipped.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/tar_started.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/tar_watch.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/tar_watch_server.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/tar_watch_ui.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit cf2a6d8

Please sign in to comment.