diff --git a/R/run.R b/R/run.R index 3bf15c40..fdd87c86 100644 --- a/R/run.R +++ b/R/run.R @@ -58,8 +58,7 @@ ##' @section Equivalence to the old `use_draft` option: ##' ##' The above location handling generalises orderly (v1)'s old -##' `use_draft` option, in terms of the `location` argument to -##' orderly2::orderly_search_options`: +##' `use_draft` option, in terms of the new `location` argument: ##' ##' * `use_draft = TRUE` is `location = "local"` ##' * `use_draft = FALSE` is `location = c(...)` where you should provide @@ -72,7 +71,7 @@ ##' as they currently exist on production right now with the options: ##' ##' ``` -##' location = "production", pull_metadata = TRUE, require_unpacked = FALSE +##' location = "production", pull_metadata = TRUE ##' ``` ##' ##' which updates your current metadata from production, then runs @@ -127,9 +126,7 @@ ##' @param echo Optional logical to control printing output from ##' `source()` to the console. ##' -##' @param search_options Optional control over locations, when used -##' with [orderly2::orderly_dependency]; converted into a -##' [orderly2::orderly_search_options] object, see Details. +##' @inheritParams orderly_search ##' ##' @param root The path to the root directory, or `NULL` (the ##' default) to search for one from the current working @@ -153,7 +150,8 @@ ##' # and we can query the metadata: ##' orderly2::orderly_metadata_extract(name = "data", root = path) orderly_run <- function(name, parameters = NULL, envir = NULL, echo = TRUE, - search_options = NULL, root = NULL) { + location = NULL, allow_remote = NULL, + pull_metadata = FALSE, root = NULL) { env_root_src <- Sys.getenv("ORDERLY_SRC_ROOT", NA_character_) root <- root_open(root, require_orderly = is.na(env_root_src), call = environment()) @@ -175,6 +173,10 @@ orderly_run <- function(name, parameters = NULL, envir = NULL, echo = TRUE, parameters <- check_parameters(parameters, dat$parameters, environment()) orderly_validate(dat, src) + search_options <- orderly_search_options(location = location, + allow_remote = allow_remote, + pull_metadata = pull_metadata) + id <- outpack_id() path <- file.path(root_src, "draft", name, id) fs::dir_create(path) diff --git a/man/orderly_run.Rd b/man/orderly_run.Rd index deec4b08..ad381a45 100644 --- a/man/orderly_run.Rd +++ b/man/orderly_run.Rd @@ -9,7 +9,9 @@ orderly_run( parameters = NULL, envir = NULL, echo = TRUE, - search_options = NULL, + location = NULL, + allow_remote = NULL, + pull_metadata = FALSE, root = NULL ) } @@ -29,9 +31,26 @@ may not always be what is wanted.} \item{echo}{Optional logical to control printing output from \code{source()} to the console.} -\item{search_options}{Optional control over locations, when used -with \link{orderly_dependency}; converted into a -\link{orderly_search_options} object, see Details.} +\item{location}{Optional vector of locations to pull from. We +might in future expand this to allow wildcards or exceptions.} + +\item{allow_remote}{Logical, indicating if we should allow packets +to be found that are not currently unpacked (i.e., are known +only to a location that we have metadata from). If this is +\code{TRUE}, then in conjunction with \link{orderly_dependency} +you might pull a large quantity of data. The default \code{NULL} is +\code{TRUE} if remote locations are listed explicitly as a character +vector in the \code{location} argument, or if you have specified +\code{pull_metadata = TRUE}, otherwise \code{FALSE}.} + +\item{pull_metadata}{Logical, indicating if we should pull +metadata immediately before the search. If \code{location} is given, +then we will pass this through to +\link{orderly_location_pull_metadata} to filter locations +to update. If pulling many packets in sequence, you \emph{will} want +to update this option to \code{FALSE} after the first pull, otherwise +it will update the metadata between every packet, which will be +needlessly slow.} \item{root}{The path to the root directory, or \code{NULL} (the default) to search for one from the current working @@ -107,8 +126,7 @@ locations are pulled from. The above location handling generalises orderly (v1)'s old -\code{use_draft} option, in terms of the \code{location} argument to -orderly2::orderly_search_options`: +\code{use_draft} option, in terms of the new \code{location} argument: \itemize{ \item \code{use_draft = TRUE} is \code{location = "local"} \item \code{use_draft = FALSE} is \code{location = c(...)} where you should provide @@ -121,7 +139,7 @@ all locations \emph{except} local default behaviour). In addition, you could resolve dependencies as they currently exist on production right now with the options: -\if{html}{\out{
}}\preformatted{location = "production", pull_metadata = TRUE, require_unpacked = FALSE +\if{html}{\out{
}}\preformatted{location = "production", pull_metadata = TRUE }\if{html}{\out{
}} which updates your current metadata from production, then runs diff --git a/tests/testthat/test-run.R b/tests/testthat/test-run.R index a3875945..fcd3169d 100644 --- a/tests/testthat/test-run.R +++ b/tests/testthat/test-run.R @@ -781,7 +781,7 @@ test_that("Can select location when querying dependencies for a report", { ## Filter to only allow prod: id2 <- orderly_run_quietly("depends", - search_options = list(location = "prod"), + location = "prod", root = path[["us"]], envir = new.env()) expect_equal(orderly_metadata(id2, path[["us"]])$depends$packet, @@ -789,7 +789,7 @@ test_that("Can select location when querying dependencies for a report", { ## Allow any location: id3 <- orderly_run_quietly("depends", - search_options = list(location = c("prod", "dev")), + location = c("prod", "dev"), root = path[["us"]], envir = new.env()) expect_equal(orderly_metadata(id3, path[["us"]])$depends$packet,