View source: R/tar_workspace_download.R
tar_workspace_download | R Documentation |
Download a workspace file from the cloud
so it can be loaded with tar_workspace()
.
tar_workspace_download(
name,
script = targets::tar_config_get("script"),
store = targets::tar_config_get("store"),
verbose = TRUE
)
name |
Symbol, name of the target whose workspace to download. |
script |
Character string, file path to the |
store |
Character of length 1, path to the
|
verbose |
|
If tar_option_get("repository_meta")
is "aws"
or "gcp"
, then
tar_make()
uploads workspaces to the bucket and prefix provided.
Download one of these workspaces with tar_workspace_download()
.
Downloaded workspaces can be loaded the usual way with
tar_workspace()
, and you should see them in
character vector returned by tar_workspaces()
.
NULL
(invisibly). Returns an error if the workspace
cannot be downloaded.
Other debug:
tar_load_globals()
,
tar_traceback()
,
tar_workspace()
,
tar_workspaces()
if (identical(Sys.getenv("TAR_EXAMPLES"), "true")) { # for CRAN
tar_dir({ # tar_dir() runs code from a temp dir for CRAN.
tmp <- sample(1)
tar_script({
library(targets)
library(tarchetypes)
tar_option_set(
resources = tar_resources(
tar_resources_aws(
bucket = "YOUR_AWS_BUCKET",
prefix = "_targets"
)
),
repository = "aws",
repository_meta = "aws"
)
list(
tar_target(x, stop("this is an error and thus triggers a workspace"))
)
}, ask = FALSE)
# The following code throws an error for demonstration purposes.
try(tar_make())
# Say the workspace file for target x does not exist.
unlink("_targets/workspaces/x")
file.exists("_targets/workspaces/x")
# We can download it with tar_workspace_download()
tar_workspace_download(x)
file.exists("_targets/workspaces/x")
tar_workspace(x)
})
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.