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:
- Load the release's data table from the release-tracking sheet (local).
- Upload your Azul token (local).
- 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 theanvil-developer-workbilling project, so you need to be a user of that billing project too, and the runs' BigQuery jobs are billed to Google projectterra-ec38e08d, so you need BigQuery job access there. - Secret Manager Secret Accessor on the secret
sheets_sain Google projectops-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. Anops-team-metricsadmin grants it:
(or in the Cloud Console: Security → Secret Manager →gcloud secrets add-iam-policy-binding sheets_sa --project ops-team-metrics --member="user:<their-email>@broadinstitute.org" --role="roles/secretmanager.secretAccessor"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:
- Click Authorize and sign in with your Broad account.
- Expand the first
GETmethod, click Try it out, then Execute. - 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:
- Open the workflow and choose Run workflow(s) with inputs defined by data table, root entity type
anvil<N>_qc. - Click Select Data and pick the snapshot rows to run, or one of the
anvil<N>_qc_setsets to run all of its snapshots. - 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 readsnapshot_idandcatalogfrom each row and write the results back to it. - 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:0pass,1QC failure,2stopped 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 withops-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
- docs/overview.md: the AnVIL pipeline, what each command checks, reading the report, the security model.
- docs/operator_onboarding.md: credentials, access, and troubleshooting errors.
- docs/release_table.md:
load-release-tablein detail, including theanvil<N>_qc_setbatches. - docs/running_locally.md: running
ade-qc/tdr-qcfrom your machine instead of Terra, and--verify-auth. - wdl/README.md: the WDLs, their inputs and outputs, and publishing the Docker image.
- docs/comparison.md: what the comparison checks, and its limits.
- docs/development.md: repo layout, tests, releasing (maintainers).
- docs/export_import_flow.md and docs/tdr_export_flow.md: the two export flows, API call by API call.
- docs/services.md: service registry (repos, OpenAPI specs, per-tier URLs).
- docs/risk_register.md: tracked project risks.
- docs/capturing_http_traffic.md: capturing and scrubbing HTTP traffic when an API changes.
- docs/qc_batch_runner.md:
qc-batch-runner, a CLI that launches many QC workflows with a concurrency cap (not part of the standard process). CLAUDE.md: architecture, design decisions, conventions.
Files
github.com-broadinstitute-anvil_release_qc-TdrQC_v0.5.0.zip
Additional details
Related works
- Is identical to
- https://dockstore.org/aliases/workflow-versions/10.5281-zenodo.24728712 (URL)
- https://dockstore.org/workflows/github.com/broadinstitute/anvil_release_qc/TdrQC:v0.5.0 (URL)
- https://dockstore.org/api/ga4gh/trs/v2/tools/%23workflow%2Fgithub.com%2Fbroadinstitute%2Fanvil_release_qc%2FTdrQC/versions/v0.5.0/PLAIN-WDL/descriptor/tdr_qc.wdl (URL)