Skip to content

Commit

Permalink
Fix #1425
Browse files Browse the repository at this point in the history
  • Loading branch information
wlandau committed Feb 6, 2025
1 parent ed2bb3a commit 4e70579
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 6 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -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, <doi:10.21105/joss.00550>).
Version: 1.10.1.9002
Version: 1.10.1.9003
License: MIT + file LICENSE
URL: https://docs.ropensci.org/targets/, https://github.com/ropensci/targets
BugReports: https://github.com/ropensci/targets/issues
Expand Down
3 changes: 2 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# targets 1.10.1.9002 (development)
# targets 1.10.1.9003 (development)

* Upload workspaces to the cloud if `tar_option_get("repository_meta")` is `"aws"` or `"gcp"`. Download them with `tar_workspace_download()` and delete them with `tar_destroy(destroy = "all")` or `tar_destroy(destroy = "cloud")`.
* Deep-copy settings when resolving `format = "auto"` (#1425, @paulseamer).

# targets 1.10.1

Expand Down
2 changes: 1 addition & 1 deletion R/class_auto.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ store_path_from_name.tar_auto <- function(
}

store_reformat_auto <- function(target) {
if (!identical(target$settings$format, "auto")) {
if (target$settings$format != "auto") {
return()
}
object <- target$value$object
Expand Down
20 changes: 20 additions & 0 deletions R/class_settings.R
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,26 @@ settings_new <- function(
out
}

settings_clone <- function(settings) {
settings_new(
name = .subset2(settings, "name"),
description = .subset2(settings, "description"),
format = .subset2(settings, "format"),
repository = .subset2(settings, "repository"),
pattern = .subset2(settings, "pattern"),
dimensions = .subset2(settings, "dimensions"),
iteration = .subset2(settings, "iteration"),
error = .subset2(settings, "error"),
memory = .subset2(settings, "memory"),
garbage_collection = .subset2(settings, "garbage_collection"),
deployment = .subset2(settings, "deployment"),
priority = .subset2(settings, "priority"),
resources = .subset2(settings, "resources"),
storage = .subset2(settings, "storage"),
retrieval = .subset2(settings, "retrieval")
)
}

settings_produce_pattern <- function(pattern) {
pattern <- as.expression(pattern)
if_any(is.null(pattern[[1]]), NULL, pattern)
Expand Down
5 changes: 2 additions & 3 deletions R/class_target.R
Original file line number Diff line number Diff line change
Expand Up @@ -525,10 +525,9 @@ target_allow_meta <- function(target) {
}

target_reformat <- function(target, format) {
file <- target$file
target$settings <- settings_clone(.subset2(target, "settings"))
target$settings$format <- format
target$store <- settings_produce_store(target$settings)
target$file <- file
target$store <- settings_produce_store(.subset2(target, "settings"))
}

target_validate <- function(target) {
Expand Down
3 changes: 3 additions & 0 deletions R/tar_target.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@
#' existing files (and/or directories), then the format becomes
#' `"file"` before [tar_make()] saves the target. Otherwise,
#' the format becomes `"qs"`.
#'
#' NOTE: `format = "auto"` slows down pipelines with 10000+ targets
#' because it creates deep copies of 20000+ internal data objects.
#' * `"qs"`: Uses `qs2::qs_save()` and `qs2::qs_read()`. Should work for
#' most objects, much faster than `"rds"`. Optionally configure settings
#' through `tar_resources()` and `tar_resources_qs()`.
Expand Down
3 changes: 3 additions & 0 deletions man/tar_option_set.Rd

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

3 changes: 3 additions & 0 deletions man/tar_target.Rd

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

0 comments on commit 4e70579

Please sign in to comment.