tarchives version of targets::tar_destroy(). Removes the cached targets
store of an archived pipeline from the R user cache directory
(tools::R_user_dir("tarchives", "cache")).
Usage
tar_destroy_archive(
package,
pipeline,
destroy = "all",
batch_size = 1000L,
verbose = TRUE,
ask = NULL,
store = targets::tar_config_get("store")
)Arguments
- package
A scalar character of the package name.
- pipeline
A scalar character of the pipeline name.
- destroy
Character of length 1, what to destroy. Choices:
"all": entire data store (default:_targets/) including cloud data, as well as download/upload scratch files."cloud": cloud data, including metadata, target definition object data from targets withtar_target(..., repository = "aws"), and workspace files saved on the cloud. Also deletes temporary staging files infile.path(tempdir(), "targets")that may have been accidentally left over from incomplete uploads or downloads."local": all the local files in the data store but nothing on the cloud."meta": metadata file atmeta/metain the data store, which invalidates all the targets but keeps the data."process": progress data file atmeta/processin the data store, which resets the metadata of the main process."progress": progress data file atmeta/progressin the data store, which resets the progress tracking info."objects": all the target return values inobjects/in the data store but keep progress and metadata. Dynamic files are not deleted this way."scratch": temporary files in saved duringtar_make()that should automatically get deleted except if R crashed."workspaces": compressed lightweight files locally saved to theworkspaces/folder in the data store with the saved workspaces of targets. Does not delete workspace files on the cloud. For that, considerdestroy = "all"ordestroy = "cloud". Seetar_workspace()for details."user": custom user-supplied files in theuser/folder in the data store.
- batch_size
Positive integer between 1 and 1000, number of target definition objects to delete from the cloud with each HTTP API request. Currently only supported for AWS. Cannot be more than 1000.
- verbose
Logical of length 1, whether to print console messages to show progress when deleting each batch of targets from each cloud bucket. Batched deletion with verbosity is currently only supported for AWS.
- ask
Logical of length 1, whether to pause with a menu prompt before deleting files. To disable this menu, set the
TAR_ASKenvironment variable to"false".usethis::edit_r_environ()can help set environment variables.- store
Character of length 1, path to the
targetsdata store. Defaults totar_config_get("store"), which in turn defaults to_targets/. When you set this argument, the value oftar_config_get("store")is temporarily changed for the current function call. Seetar_config_get()andtar_config_set()for details about how to set the data store path persistently for a project.
Examples
# \donttest{
withr::with_envvar(
c(R_USER_CACHE_DIR = tempfile()),
{
tar_make_archive(package = "tarchives", pipeline = "example-model")
tar_destroy_archive(package = "tarchives", pipeline = "example-model", ask = FALSE)
}
)
# }