Elements runtime reference / Tenant GCS files

downloadGcsFile

Read a tenant-scoped GCS file through data-worker-agent.

Signatuur

downloadGcsFile(path, bucket=None, prefix=None, encoding='utf-8', asBytes=False, maxBytes=None, withMetadata=False)

Doel

Read a tenant-scoped GCS file through data-worker-agent.

Aliases and imports

  • download_gcs_file
  • gcs.download
  • gcs.download_file

Payloadformaat

Use these fields as the Python call arguments or keyword payload for this helper.

{
  "path": "exports/report.json",
  "withMetadata": true
}
FieldDescription
pathRelative path, filestore/{tenantId}-prefixed object path, or gs:// URI inside the current tenant filestore folder.
bucketOptional bucket override; must match the configured file artifact/output bucket.
prefixOptional extra prefix under filestore/{tenantId}/ when path is relative.
encodingText encoding used when asBytes is false.
asBytesWhen true, return metadata with base64 data instead of decoded text.
maxBytesOptional read cap bounded by DATA_WORKER_FILE_ARTIFACT_MAX_BYTES.
withMetadataWhen true, return the metadata envelope even for text reads.

Return payload

{
  "gcsUri": "gs://dashview-cache/filestore/tenant/exports/report.json",
  "contentType": "application/json",
  "encoding": "utf-8",
  "text": "{\"status\":\"ready\"}",
  "size": 18
}

Voorbeeld

def run():
    report = gcs.download("exports/report.json", withMetadata=True)
    return {"report": report["text"]}

Scope-notities