Published December 1, 2026 | Version v0.5.0

github.com/broadinstitute/anvil_release_qc/TdrQC

Authors/Creators

Description

anvil-release-qc

Automated quality control for AnVIL data releases. For each TDR snapshot in a release, it exports the snapshot into a new Terra workspace and checks that workspace against the snapshot: the same tables, row counts and columns, and the same authorization domain.

This page covers only how to run a release's QC. Background, what is checked, and the security model are in docs/overview.md; all other docs are listed at the end.

A release's QC takes three steps, all against the Terra workspace anvil-developer-work/anvil_release_qc:

  1. Load the release's data table from the release-tracking sheet (local).
  2. Upload your Azul token (local).
  3. Run the QC workflows in Terra on that table.

Before you start: access

You need, on your Broad account:

  • Writer (or Owner) on the Terra workspace anvil-developer-work/anvil_release_qc, with permission to run workflows. Each QC run creates its own workspace under the anvil-developer-work billing project, so you need to be a user of that billing project too, and the runs' BigQuery jobs are billed to Google project terra-ec38e08d, so you need BigQuery job access there.
  • Secret Manager Secret Accessor on the secret sheets_sa in Google project ops-team-metrics. The release sheet is read as the ops Sheets service account, whose key is in that secret. Basic Viewer/Editor/Owner roles are not enough: they can't read a secret's value. An ops-team-metrics admin grants it:
    gcloud secrets add-iam-policy-binding sheets_sa --project ops-team-metrics --member="user:<their-email>@broadinstitute.org" --role="roles/secretmanager.secretAccessor"
    
    (or in the Cloud Console: Security → Secret Manager → sheets_sa → Permissions → Grant access).
  • Write access to the Azul token bucket gs://fc-secure-886bea29-8c4e-4568-920a-a8cfee18e659.
  • For controlled-access datasets, the NIH/dbGaP access to that data. The tool keeps no list of allowed users: what you can read is decided by your own Terra, TDR and Azul permissions.

More on credentials and access: docs/operator_onboarding.md.

Local setup

Python 3.13 via pyenv + pyenv-virtualenv (brew upgrade pyenv if pyenv install doesn't know 3.13.14):

git clone https://github.com/broadinstitute/anvil_release_qc.git
cd anvil_release_qc
pyenv install 3.13.14
pyenv virtualenv 3.13.14 validate-anvil-release
pyenv activate validate-anvil-release
pip install -r requirements.txt && pip install --no-deps -e .
gcloud auth application-default login            # your Broad account; no extra scopes needed

Use pyenv activate, not pyenv local (which would rewrite the committed .python-version). After a git pull, rerun the two pip install commands.

1. Load the release's data table

load-release-table reads the release-tracking Google Sheet (tab AnVIL Prod) and writes every snapshot marked 1 in the release's anvil<N> column into table anvil<N>_qc of anvil-developer-work/anvil_release_qc. It also writes table anvil<N>_qc_set, which groups those snapshots into sets of at most 150 (--set-batch-size <n> to change), so you can launch the QC one set at a time.

anvil-release-qc load-release-table --release 16 --dry-run   # read the sheet and log the counts; upload nothing
anvil-release-qc load-release-table --release 16             # write anvil16_qc and anvil16_qc_set

It only adds and updates rows, never deletes them, and fails without uploading anything if the sheet has a problem (no anvil<N> column, a selected row without a Snapshot UUID, a duplicate UUID). It runs only locally: Terra's network perimeter blocks the Sheets API from workflow VMs. Details: docs/release_table.md.

2. Upload your Azul token

The ADE workflow (ade-qc) calls Azul, which needs its own token (it rejects your normal Google credentials). Do this right before you launch ade-qc runs; tdr-qc doesn't need it.

anvil-release-qc azul-login --tier prod

It opens the Azul Swagger UI (https://service.explore.anvilproject.org/swagger/index.html) and prompts you through it:

  1. Click Authorize and sign in with your Broad account.
  2. Expand the first GET method, click Try it out, then Execute.
  3. In the Curl box, copy the value after Authorization: Bearer (or the whole curl line) and paste it at the prompt.

The command then checks the token with Google (it must be issued to Azul's sign-in client and not be expired), warns if it belongs to a different account from your Terra user, and uploads it to gs://fc-secure-886bea29-8c4e-4568-920a-a8cfee18e659/azul_token/<username>.txt, where <username> is your Terra email before the @. Every ade-qc workflow you submit reads your token from there; you never paste it into Terra.

The token lasts about 1 hour. Each run uses it only in its first few minutes and refuses to start with less than 10 minutes left, so launch your ade-qc runs soon after uploading it. Without a token, ade-qc runs only on open-access datasets; with an expired one it stops with exit code 2. Rerun azul-login to refresh it.

3. Run the QC workflows in Terra

In the Terra workspace anvil-developer-work/anvil_release_qc, on the Workflows tab:

| Workflow | Use it for | |---|---| | AnVILDataExplorerQC (ade-qc) | every snapshot: exports through the AnVIL Data Explorer, the route researchers use | | TdrQC (tdr-qc) | datasets too large for the ADE export to succeed: exports straight from TDR; no Azul token |

To launch one:

  1. Open the workflow and choose Run workflow(s) with inputs defined by data table, root entity type anvil<N>_qc.
  2. Click Select Data and pick the snapshot rows to run, or one of the anvil<N>_qc_set sets to run all of its snapshots.
  3. Check that the inputs and outputs match the production configs in wdl/ (anvil_data_explorer_qc.inputs.json / .outputs.json, tdr_qc.inputs.json / .outputs.json). They read snapshot_id and catalog from each row and write the results back to it.
  4. Launch. Each snapshot runs as its own workflow.

If a workflow isn't in the workspace yet, import it from Dockstore (AnVILDataExplorerQC or TdrQC, from this repo), then upload the matching *.inputs.json and *.outputs.json from wdl/ in the workflow's inputs and outputs tabs.

Check the results

Each run writes its results to its row in anvil<N>_qc, in columns prefixed ade_ or tdr_:

  • ade_qc_passed / tdr_qc_passed: sort or filter on this to find failures.
  • …_qc_exit_code: 0 pass, 1 QC failure, 2 stopped before the QC (a controlled snapshot without the opt-in, an Azul reindex in progress, an expired Azul token, or a setup problem; usually fine to rerun once fixed).
  • …_qc_report: the readable report (how to read it).
  • …_detailed_log: the full request/response log.
  • …_workspace_namespace / …_workspace_name: the workspace the run created. It is deleted when the QC passes and kept on a failure for investigation; delete kept workspaces once you're done (they all start with ops-validation-).

The checks are count-level: they don't compare row identities or cell values. What that means for review: docs/comparison.md.

More documentation

Files

github.com-broadinstitute-anvil_release_qc-TdrQC_v0.5.0.zip

Files (3.0 kB)

Name Size
md5:b3f023cebdf8db20c05738484d4d4309
3.0 kB Preview Download

Additional details