Skip to content

Commit

Permalink
compat
Browse files Browse the repository at this point in the history
  • Loading branch information
wlandau-lilly committed Dec 4, 2023
1 parent 0d55002 commit a1c655c
Show file tree
Hide file tree
Showing 53 changed files with 152 additions and 98 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Description: Function-oriented Make-like declarative pipelines for
reproducible pipelines concisely and compactly.
The methods in this package were influenced by the 'drake' R package
by Will Landau (2018) <doi:10.21105/joss.00550>.
Version: 0.7.9.9000
Version: 0.7.10
License: MIT + file LICENSE
URL: https://docs.ropensci.org/tarchetypes/, https://github.com/ropensci/tarchetypes
BugReports: https://github.com/ropensci/tarchetypes/issues
Expand Down Expand Up @@ -45,7 +45,7 @@ Imports:
fs (>= 1.4.2),
parallel,
rlang (>= 0.4.7),
targets (>= 1.3.2.9001),
targets (>= 1.3.2),
tibble (>= 3.0.1),
tidyselect (>= 1.1.0),
utils,
Expand Down
2 changes: 0 additions & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,6 @@ importFrom(targets,tar_path_target)
importFrom(targets,tar_read)
importFrom(targets,tar_runtime_object)
importFrom(targets,tar_script)
importFrom(targets,tar_seed_create)
importFrom(targets,tar_seed_set)
importFrom(targets,tar_target)
importFrom(targets,tar_target_raw)
importFrom(targets,tar_test)
Expand Down
5 changes: 3 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# tarchetypes 0.7.9.9000 (development)
# tarchetypes 0.7.10

* Use `tar_seed_create()` (https://github.com/ropensci/targets/issues/1139).
* Prepare to use `tar_seed_create()` (https://github.com/ropensci/targets/issues/1139).
* Migrate tests to `targets` >= 1.3.2.9004 progress statuses ("completed" instead of "built", "dispatched" instead of "started").

# tarchetypes 0.7.9

Expand Down
2 changes: 1 addition & 1 deletion R/tar_map2_raw.R
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ tar_map2_run_rep <- function(
)
}
)
if_any(anyNA(seed), NULL, targets::tar_seed_set(seed = seed))
if_any(anyNA(seed), NULL, tar_seed_set(seed = seed))
out <- eval(command, envir = envir)
out <- tar_append_static_values(out, values[, columns])
out[["tar_batch"]] <- as.integer(batch)
Expand Down
2 changes: 1 addition & 1 deletion R/tar_package.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#' tar_cue tar_definition tar_deparse_language tar_deparse_safe
#' tar_dir tar_envir tar_exist_meta tar_group tar_load tar_meta
#' tar_option_get tar_option_set tar_path_target tar_read
#' tar_runtime_object tar_script tar_seed_create tar_seed_set
#' tar_runtime_object tar_script
#' tar_target tar_target_raw tar_test tar_tidy_eval
#' tar_throw_validate tar_warn_deprecate tar_warn_validate
#' @importFrom tibble as_tibble
Expand Down
2 changes: 1 addition & 1 deletion R/tar_quarto_rep_raw.R
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ tar_quarto_rep_rep <- function(
args$execute_params[["output_file"]] <- NULL
args$execute_params[["tar_group"]] <- NULL
seed <- as.integer(if_any(anyNA(seeds), NA_integer_, seeds[rep]))
if_any(anyNA(seed), NULL, targets::tar_seed_set(seed = seed))
if_any(anyNA(seed), NULL, tar_seed_set(seed = seed))
result <- do.call(quarto::quarto_render, args)
file.rename(temporary_file, destination_file)
sort(as.character(fs::path_rel(unlist(destination_file))))
Expand Down
2 changes: 1 addition & 1 deletion R/tar_render_rep_raw.R
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ tar_render_rep_rep <- function(rep, params, args, path, seeds) {
args$params[["tar_group"]] <- NULL
args$intermediates_dir <- fs::dir_create(tempfile())
seed <- as.integer(if_any(anyNA(seeds), NA_integer_, seeds[rep]))
if_any(anyNA(seed), NULL, targets::tar_seed_set(seed = seed))
if_any(anyNA(seed), NULL, tar_seed_set(seed = seed))
output <- do.call(rmarkdown::render, args)
tar_render_paths(output, path)
}
Expand Down
2 changes: 1 addition & 1 deletion R/tar_rep2_raw.R
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ tar_rep2_run <- function(command, batches, iteration, rep_workers) {
#' # See the examples of tar_rep2().
tar_rep2_run_rep <- function(rep, slice, command, batch, seeds, envir) {
seed <- as.integer(if_any(anyNA(seeds), NA_integer_, seeds[rep]))
if_any(anyNA(seed), NULL, targets::tar_seed_set(seed = seed))
if_any(anyNA(seed), NULL, tar_seed_set(seed = seed))
out <- eval(command, envir = slice, enclos = envir)
out$tar_batch <- as.integer(batch)
out$tar_rep <- as.integer(rep)
Expand Down
5 changes: 3 additions & 2 deletions R/tar_rep_raw.R
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ tar_rep_run_map <- function(expr, batch, reps, rep_workers) {
#' # See the examples of tar_rep().
tar_rep_run_map_rep <- function(rep, expr, batch, seeds, envir) {
seed <- as.integer(if_any(anyNA(seeds), NA_integer_, seeds[rep]))
if_any(anyNA(seed), NULL, targets::tar_seed_set(seed = seed))
if_any(anyNA(seed), NULL, tar_seed_set(seed = seed))
out <- eval(expr, envir = envir)
if (is.list(out)) {
out[["tar_batch"]] <- as.integer(batch)
Expand All @@ -326,7 +326,8 @@ tar_rep_run_map_rep <- function(rep, expr, batch, seeds, envir) {

produce_batch_seeds <- function(name, batch, reps) {
strings <- paste(name, as.character(seq_len(reps) + reps * (batch - 1)))
unname(map_int(x = strings, f = targets::tar_seed_create))
# TODO: use targets::tar_seed_create() when CRAN targets has it.
unname(map_int(x = strings, f = tar_seed_create))
}

tar_assert_rep_workers <- function(rep_workers) {
Expand Down
31 changes: 31 additions & 0 deletions R/utils_seed.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# TODO: use targets::tar_seed_create() when CRAN targets has it.
tar_seed_create <- function (name, global_seed = NULL) {

Check warning on line 2 in R/utils_seed.R

View workflow job for this annotation

GitHub Actions / lint

file=R/utils_seed.R,line=2,col=28,[function_left_parentheses_linter] Remove spaces before the left parenthesis in a function definition.
if (is.null(global_seed)) {
global_seed <- targets::tar_option_get("seed")
}
if (is.null(global_seed) || anyNA(global_seed)) {
return(NA_integer_)
}
name <- as.character(name)
hash <- digest::digest(
object = name,
algo = "sha512",
serialize = FALSE,

Check warning on line 13 in R/utils_seed.R

View workflow job for this annotation

GitHub Actions / lint

file=R/utils_seed.R,line=13,col=23,[trailing_whitespace_linter] Trailing whitespace is superfluous.
file = FALSE,
seed = 0L
)
digest::digest2int(x = hash, seed = global_seed)
}

# TODO: same
tar_seed_set <- function (seed) {

Check warning on line 21 in R/utils_seed.R

View workflow job for this annotation

GitHub Actions / lint

file=R/utils_seed.R,line=21,col=25,[function_left_parentheses_linter] Remove spaces before the left parenthesis in a function definition.
if (!is.null(seed) && !anyNA(seed)) {
set.seed(
seed = seed,
kind = "default",
normal.kind = "default",

Check warning on line 26 in R/utils_seed.R

View workflow job for this annotation

GitHub Actions / lint

file=R/utils_seed.R,line=26,col=31,[trailing_whitespace_linter] Trailing whitespace is superfluous.
sample.kind = "default"
)
}
invisible()
}
4 changes: 2 additions & 2 deletions man/tar_change.Rd

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

12 changes: 6 additions & 6 deletions man/tar_download.Rd

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

8 changes: 4 additions & 4 deletions man/tar_download_run.Rd

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

4 changes: 2 additions & 2 deletions man/tar_file_read.Rd

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

4 changes: 2 additions & 2 deletions man/tar_files.Rd

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

4 changes: 2 additions & 2 deletions man/tar_files_input.Rd

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

4 changes: 2 additions & 2 deletions man/tar_files_input_raw.Rd

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

4 changes: 2 additions & 2 deletions man/tar_files_raw.Rd

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

4 changes: 2 additions & 2 deletions man/tar_force.Rd

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

4 changes: 2 additions & 2 deletions man/tar_formats.Rd

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

4 changes: 2 additions & 2 deletions man/tar_group_by.Rd

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

4 changes: 2 additions & 2 deletions man/tar_group_count.Rd

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

4 changes: 2 additions & 2 deletions man/tar_group_select.Rd

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

4 changes: 2 additions & 2 deletions man/tar_group_size.Rd

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

4 changes: 2 additions & 2 deletions man/tar_knit.Rd

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

4 changes: 2 additions & 2 deletions man/tar_map2_count.Rd

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

4 changes: 2 additions & 2 deletions man/tar_map2_count_raw.Rd

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

4 changes: 2 additions & 2 deletions man/tar_map2_size.Rd

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

4 changes: 2 additions & 2 deletions man/tar_map2_size_raw.Rd

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

4 changes: 2 additions & 2 deletions man/tar_map_rep.Rd

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

4 changes: 2 additions & 2 deletions man/tar_map_rep_raw.Rd

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

Loading

0 comments on commit a1c655c

Please sign in to comment.