library("allofus")
# create test files in a temporary directory
<- tempdir()
tmp write.csv(data.frame(x = 1), file.path(tmp, "testdata1.csv"))
write.csv(data.frame(y = 2), file.path(tmp, "testdata2.csv"))
# save a file to the bucket
aou_workspace_to_bucket(file.path(tmp, "testdata1.csv"))
# save multiple files at once
aou_workspace_to_bucket(c(file.path(tmp, "testdata1.csv"), file.path(tmp, "testdata2.csv")))
# save an entire directory
aou_workspace_to_bucket(tmp, directory = TRUE)
Save a file from your workspace to your bucket
Description
Moves a file saved in on the persistent disk to the workspace bucket, where it can be stored even if a compute environment is deleted.
Usage
aou_workspace_to_bucket(
file,
directory = FALSE,
bucket = getOption("aou.default.bucket")
)
Arguments
file
|
The name of a file in your bucket, a vector of multiple files, a directory, or a file pattern (e.g. ".csv"). See Details. |
directory
|
Whether file refers to an entire directory you want to move.
|
bucket
|
Bucket to save files to. Defaults to getOption(“aou.default.bucket”) , which is Sys.getenv(‘WORKSPACE_BUCKET’) unless specified otherwise.
|
Details
This function moves a file saved in a workspace to a bucket, where it can be retrieved even if the environment is deleted. To use, first save the desired object as a file to the workspace (e.g., write.csv(object, “filename.csv”)
) and then run this function (e.g., aou_workspace_to_bucket(files = “filename.csv”)
). See https://cloud.google.com/storage/docs/gsutil/commands/cp for details on the underlying function.
Value
Nothing