Create a Cloud Storage bucket for the workspace

Description

Verily Workbench workspaces (workbench 2.0) don’t automatically provision a workspace bucket the way older ("workbench 1.0") All of Us workspaces did. This creates one via the wb CLI (or resolves it if a bucket with the same name already exists) and sets WORKSPACE_BUCKET (or WORKSPACE_TEMP_BUCKET if temporary = TRUE) for the current R session, so functions like aou_ls_bucket() work without further setup.

Usage

aou_create_bucket(
  temporary = FALSE,
  name = if (temporary) "temporary-workspace-bucket" else "workspace-bucket",
  auto_delete = 14
)

Arguments

temporary If TRUE, creates a temporary bucket whose contents are automatically deleted after auto_delete days, instead of the persistent workspace bucket. Useful for intermediate files you don’t need to keep.
name Resource name for the bucket within the workspace. Defaults to “workspace-bucket”, or “temporary-workspace-bucket” if temporary = TRUE.
auto_delete Number of days after which objects in a temporary bucket are automatically deleted. Only used if temporary = TRUE.

Details

The resolved bucket URL is cached to ~/.aou-env (alongside WORKSPACE_CDR and GOOGLE_PROJECT, which are cached there the same way when the package loads). This means you only need to run aou_create_bucket() once per workspace, not once per session: on subsequent loads, library(allofus) reads the cached values from ~/.aou-env directly instead of recreating anything or re-querying the wb CLI.

To see what’s currently cached (e.g., to check which buckets you’ve already created in this workspace), read the file directly: cat(readLines(“~/.aou-env”)). Each line is a plain export VARIABLE=“value” entry. If a cached value ever goes stale (for example, a bucket was deleted outside of R), delete the corresponding line, or delete the file entirely to force everything to be re-resolved on the next library(allofus) call.

Value

The bucket’s gs:// URL (invisibly).

Examples

library("allofus")


aou_create_bucket()
aou_create_bucket(temporary = TRUE)