Skip to content

Commit

Permalink
Support environment: from an interactive session.
Browse files Browse the repository at this point in the history
The code path for interactive sessions, through orderly_copy_files, was
not propagating the environment from the caller to `orderly_search`. The
broke support for `environment:`-style queries, but only when running
interactively.

In orderly_copy_files (and orderly_dependency), the `envir` parameter
actually has two purposes: it provides values for `environment:` and it
provides values that are substituted in the file paths to be copied.
This dual usage causes a bit of confusion and may be what led to this
issue. We may want to tidy up some of this in the future, possibly with
the help of rlang's quosures and quasiquotation support.
  • Loading branch information
plietar committed Nov 15, 2024
1 parent 9eebaad commit 8f69baa
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: orderly2
Title: Orderly Next Generation
Version: 1.99.55
Version: 1.99.56
Authors@R: c(person("Rich", "FitzJohn", role = c("aut", "cre"),
email = "[email protected]"),
person("Robert", "Ashton", role = "aut"),
Expand Down
1 change: 1 addition & 0 deletions R/outpack_helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ orderly_copy_files <- function(expr, files, dest, overwrite = TRUE,
location = options$location,
allow_remote = options$allow_remote,
fetch_metadata = options$fetch_metadata,
envir = envir,
root = root)
if (length(id) > 1) {
cli::cli_abort(
Expand Down
4 changes: 3 additions & 1 deletion tests/testthat/examples/depends-query/depends-query.R
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
orderly2::orderly_parameters(a = NULL, b = NULL, c = NULL)

value <- c
orderly2::orderly_dependency(
"parameters",
paste("latest(parameter:a == this:a &&",
"parameter:b == this:b &&",
"parameter:c == this:c)"),
"parameter:c == environment:value)"),
c(input.rds = "data.rds"))
orderly2::orderly_artefact("result.rds", description = "Processed data")
d <- readRDS("input.rds")
Expand Down

0 comments on commit 8f69baa

Please sign in to comment.