Skip to contents

Polls the dataset processing status until it reaches "succeeded", then returns the dataset ID invisibly. Errors if processing fails, expires unexpectedly, or the timeout is reached.

Usage

await_dataset_processing(
  dataset,
  poll_interval = 0.5,
  timeout = 60,
  quiet = FALSE,
  auth_token = Sys.getenv("SCPCA_AUTH_TOKEN")
)

Arguments

dataset

the dataset UUID string, or a list with an $id element, such as the return value of create_dataset().

poll_interval

Number of minutes to wait between status checks when await_processing = TRUE. Default is 0.5 (30 seconds).

timeout

Maximum number of minutes to wait for processing to complete when await_processing = TRUE. Use Inf to wait indefinitely. Default is 60 (1 hour).

quiet

Whether to suppress download progress messages. Default is FALSE.

auth_token

an authorization token from get_auth(). Defaults to the SCPCA_AUTH_TOKEN environment variable, which get_auth() sets automatically.

Value

the dataset ID string (invisibly)

Details

This function only waits — it does not start processing or download data. To start processing, use start_dataset_processing() first, or call download_dataset() with await_processing = TRUE to start, wait, and download in one step.

Examples

if (FALSE) { # \dontrun{
ds <- create_dataset(samples = c("SCPCS000001", "SCPCS000002"))
start_dataset_processing(ds, email = "user@example.com")
await_dataset_processing(ds)
download_dataset(ds)
} # }