Skip to content

Commit

Permalink
tar_seed_create()
Browse files Browse the repository at this point in the history
  • Loading branch information
wlandau-lilly committed Oct 12, 2023
2 parents 5a71810 + 4ff3f7c commit 0e3f188
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 14 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.8.9001
Version: 0.7.9.9000
License: MIT + file LICENSE
URL: https://docs.ropensci.org/tarchetypes/, https://github.com/ropensci/tarchetypes
BugReports: https://github.com/ropensci/tarchetypes/issues
Expand All @@ -18,7 +18,7 @@ Authors@R: c(
given = c("William", "Michael"),
family = "Landau",
role = c("aut", "cre"),
email = "[email protected]",
email = "will.landau.oss@gmail.com",
comment = c(ORCID = "0000-0003-1878-3253")
),
person(
Expand Down
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -229,5 +229,4 @@ importFrom(vctrs,vec_c)
importFrom(vctrs,vec_rbind)
importFrom(withr,local_envvar)
importFrom(withr,local_options)
importFrom(withr,local_seed)
importFrom(withr,with_options)
7 changes: 5 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# tarchetypes 0.7.8.9001 (development)
# tarchetypes 0.7.8.9000 (development)

* Use `tar_seed_create()` (https://github.com/ropensci/targets/issues/1139).

# tarchetypes 0.7.9

* Deprecate the `packages` and `library` arguments of `tar_quarto()` and `tar_quarto_raw()` (#155, @svraka).
* Switch to from `furrr` to `parallel` for `rep_workers` in `tar_rep()` etc. (#251, @solmos).
* Use `tar_seed_create()` (https://github.com/ropensci/targets/issues/1139).

# tarchetypes 0.7.8

Expand Down
2 changes: 1 addition & 1 deletion R/tar_package.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#' last_col matches num_range one_of starts_with
#' @importFrom utils download.file globalVariables head
#' @importFrom vctrs vec_c vec_rbind
#' @importFrom withr local_envvar local_options with_options local_seed
#' @importFrom withr local_envvar local_options with_options
NULL

utils::globalVariables(".x")
10 changes: 2 additions & 8 deletions R/tar_rep2_raw.R
Original file line number Diff line number Diff line change
Expand Up @@ -201,14 +201,8 @@ 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]))
out <- if_any(
anyNA(seed),
eval(command, envir = slice, enclos = envir),
withr::with_seed(
seed = seed,
code = eval(command, envir = slice, enclos = envir)
)
)
if_any(anyNA(seed), NULL, targets::tar_seed_set(seed = seed))
out <- eval(command, envir = slice, enclos = envir)
out$tar_batch <- as.integer(batch)
out$tar_rep <- as.integer(rep)
out$tar_seed <- as.integer(seed)
Expand Down

0 comments on commit 0e3f188

Please sign in to comment.