Skip to content

Commit

Permalink
Omit whole pattern targets from branch subpipelines when possible
Browse files Browse the repository at this point in the history
  • Loading branch information
wlandau committed Nov 10, 2024
1 parent b978993 commit 9159ab7
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* Reduce memory consumption by storing buds and branches as lightweight references when `memory` is `"transient"` (#1364).
* Replace the `memory` class with the new `lookup` class.
* Implement `memory = "auto"` to select transient memory for dynamic branches and persistent memory for other targets (#1371).
* Omit whole pattern targets from branch subpipelines when possible. Should reduce memory consumption in some cases.

# targets 1.8.0

Expand Down
11 changes: 7 additions & 4 deletions R/class_target.R
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,13 @@ target_deps_deep <- function(target, pipeline) {
target_get_children(pipeline_get_target(pipeline, dep))
})
)
parents <- map_chr(deps, function(dep) {
target_get_parent(pipeline_get_target(pipeline, dep))
})
unique(c(deps, children, parents))
patterns <- unlist(
map(deps, function(dep) {
target <- pipeline_get_target(pipeline, dep)
if_any(inherits(target, "tar_bud"), target_get_parent(target), NULL)
})
)
unique(c(deps, children, patterns))
}

target_downstream_branching <- function(target, pipeline, scheduler) {
Expand Down
4 changes: 3 additions & 1 deletion man/tar_option_set.Rd

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

4 changes: 3 additions & 1 deletion 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 9159ab7

Please sign in to comment.