Skip to content

Airflow implementation of import automation workflow - #2220

Open
vish-cs wants to merge 1 commit into
datacommonsorg:masterfrom
vish-cs:dag
Open

vish-cs wants to merge 1 commit into
datacommonsorg:masterfrom
vish-cs:dag

Conversation

@vish-cs

@vish-cs vish-cs commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Implements the Apache Airflow (Cloud Composer) orchestration pipeline for Data Commons data imports, replacing the legacy Cloud Workflows implementation.

Key Changes

  • Dynamic DAG Factory (import_dags_factory.py & build_manifest_catalog.py): Scans repository manifest.json files at build time and dynamically registers an independent Airflow DAG for each import specification (plus a generic import_automation_workflow fallback DAG). All DAGs are created in a disabled (is_paused_upon_creation=True) state with skipProdIngestion=True by default.
  • 4-Stage Pipeline (import_automation_workflow.py):
    1. Import Execution (run_import_job): Triggers the dc-import-executor Cloud Batch job (with inline validation and differ disabled).
    2. Standalone Validation & Differ (run_validation_job): Invokes the Cloud Run v2 Job (import-validator-job) with a 2-hour timeout to run BigQuery differ and validation checks.
    3. Staging Ingestion & Golden Verification Gate (golden_verification.py): Triggers Spanner staging ingestion, runs automated golden diff verification via Cloud Build (ingestion-golden-verification.cloudbuild.yaml), and pauses for human approval (HumanApprovalSensor) if diffs are detected.
    4. Production Ingestion (ingest_prod): Promotes validated imports to production Spanner when enabled.
  • CI/CD & E2E Testing (cloudbuild.workflow.yaml & e2e_dag_test.py): Automates catalog compilation, GCS DAG synchronization to Cloud Composer, and live End-to-End DAG execution verification via the Airflow REST API.

TAG=agy
CONV=fd554db8-40c1-4b71-b86a-83b4aa199d65

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces an automated workflow for Data Commons imports using Apache Airflow and Cloud Composer. It includes a catalog builder script, a dynamic DAG factory, and a core automation DAG that orchestrates Cloud Batch jobs and Spanner ingestion. The review identifies several critical anti-patterns, including unsafe path manipulation, global environment variable modification, synchronous operator execution within tasks, and blocking sleep loops. Actionable feedback was provided to improve path handling, enforce strict duplicate ID management, and implement robust retry mechanisms for network requests.

Comment thread import-automation/workflow/build_manifest_catalog.py Outdated
Comment thread import-automation/workflow/build_manifest_catalog.py Outdated
Comment thread import-automation/workflow/build_manifest_catalog.py Outdated
Comment thread import-automation/workflow/import_dags_factory.py Outdated
Comment thread import-automation/workflow/import_automation_workflow.py Outdated
Comment thread import-automation/workflow/import_automation_workflow.py Outdated
Comment thread import-automation/workflow/import_automation_workflow.py
@vish-cs
vish-cs force-pushed the dag branch 5 times, most recently from 9fbf948 to 287db28 Compare September 17, 2026 14:16
Comment thread import-automation/workflow/e2e_dag_test.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants