Skip to content

Fixes 27148: Avoid per-DAG Airflow pause state queries - #31990

Merged
IceS2 merged 6 commits into
mainfrom
assess-airflow-bugs
Sep 8, 2026
Merged

IceS2 merged 6 commits into
mainfrom
assess-airflow-bugs

Conversation

@IceS2

@IceS2 IceS2 commented Aug 24, 2026 •

Copy link
Copy Markdown
Collaborator

Describe your changes:

Fixes #27148

Fetches the Airflow DAG pause state as part of the existing paginated serialized DAG query instead of issuing one additional database query per DAG. Airflow 2 preserves serialized DAGs without a DagModel row through a left outer join when undeployed pipelines are included.

Type of change:

  • Bug fix

High-level design:

N/A — small targeted bug fix.

Tests:

Use cases covered

  • Active and paused DAGs retain their corresponding OpenMetadata pipeline state without per-DAG pause-state queries.
  • Airflow 2 keeps serialized DAGs that do not have a matching DagModel row when undeployed pipelines are included.

Unit tests

  • I added unit tests for the changed logic.
  • Files updated: ingestion/tests/unit/topology/pipeline/test_airflow.py
  • Result: 36 passed.

Backend integration tests

  • Not applicable (no backend API changes).

Ingestion integration tests

  • Validated against a full isolated OpenMetadata and Airflow stack.

Playwright (UI) tests

  • Not applicable (no UI changes).

Manual testing performed

  1. Started an isolated OpenMetadata, Airflow 3, MySQL, and Elasticsearch stack from this branch.
  2. Ran the bundled Airflow Backend metadata ingestion workflow successfully with zero workflow errors.
  3. Captured MySQL general-log queries for the ingestion window: zero standalone pause-state queries and the pause-state column present in the paginated serialized DAG query.

UI screen recording / screenshots:

Not applicable.

Checklist:

  • I have added a test that covers the exact scenario we are fixing.

Greptile Summary

The PR folds Airflow pause-state retrieval into the existing serialized-DAG query, eliminating per-DAG database lookups.

  • Projects DagModel.is_paused alongside each serialized DAG.
  • Uses an outer join for Airflow 2 when undeployed pipelines must be preserved.
  • Adds a database-backed regression test covering active, paused, and serialized-only DAGs.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains; the previously reported test weakness is addressed by executing the production query against a database and asserting active, paused, and serialized-only DAG results.

Important Files Changed

Filename Overview
ingestion/src/metadata/ingestion/source/pipeline/airflow/metadata.py Retrieves pause state in the paginated DAG query and preserves serialized-only Airflow 2 DAGs through an outer join.
ingestion/tests/unit/topology/pipeline/test_airflow.py Replaces mock-wiring assertions with a SQLite-backed test that executes the production query and validates its observable row set.

Reviews (3): Last reviewed commit: "Merge branch 'main' into assess-airflow-..." | Re-trigger Greptile

@IceS2
IceS2 requested a review from a team as a code owner August 24, 2026 20:00
Copilot AI lite review requested due to automatic review settings August 24, 2026 20:00

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

github-actions Bot commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR checks passed

The linked issue has a description and all required Shipping project fields set. Thanks!

Copilot AI review requested due to automatic review settings August 24, 2026 20:49

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

github-actions Bot commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

✅ Playwright Results — workflow succeeded

Validated commit 365fc04bee209f34871dd8e2718e17c545cbb382 in Playwright run 34096112368, attempt 1.

✅ 109 passed · ❌ 0 failed · 🟡 0 flaky · ⏭️ 0 skipped · 🧰 0 lifecycle flaky

Performance

Blocking targets: ✅ met · Optimization targets: 🟡 in progress

Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting.

🕒 Full workflow signal wall (to summary) 49m 14s

⏱️ Max setup 5m 12s · max shard execution 12m 1s · max shard-job elapsed before upload 18m 8s · reporting 4s

🌐 233.66 requests/attempt · 1.77 app boots/UI scenario · 0.00% common-shard skew

Optimization targets still in progress:

  • Browser traffic was 233.66 requests per attempt (convergence target: fewer than 200).
  • Application boot ratio was 1.77 per UI scenario (213 boots / 120 scenarios; convergence target: at most 1).
Shard Passed Failed Flaky Skipped Lifecycle failed Lifecycle flaky
✅ Shard chromium-01 46 0 0 0 0 0
✅ Shard ingestion-01 24 0 0 0 0 0
✅ Shard ingestion-02 39 0 0 0 0 0

📦 Download artifacts

How to debug locally
# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip    # view trace

Copilot AI review requested due to automatic review settings August 28, 2026 20:45

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

ulixius9
ulixius9 previously approved these changes Sep 2, 2026
@IceS2
IceS2 added this pull request to the merge queue Sep 2, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Sep 2, 2026
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — merge_conflict (2026-09-02T11:08:03Z)

The entry left the queue before it was built, so no checks ran against it.

# Conflicts:
#	ingestion/src/metadata/ingestion/source/pipeline/airflow/metadata.py
@IceS2
IceS2 added this pull request to the merge queue Sep 3, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Sep 3, 2026
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — failed_checks (2026-09-03T19:15:42Z)

Blocked the queue: py-tests-status

  • py-tests-postgres — py-tests-status, python / Verify Expected Jobs, python / Integration Tests (shard-3)

@IceS2
IceS2 added this pull request to the merge queue Sep 4, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Sep 4, 2026
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — merge_conflict (2026-09-04T22:18:22Z)

The entry left the queue before it was built, so no checks ran against it.

# Conflicts:
#	ingestion/.ruff-g004-baseline.json
Copilot AI review requested due to automatic review settings September 7, 2026 07:34

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@gitar-bot

gitar-bot Bot commented Sep 7, 2026

Copy link
Copy Markdown
Code Review 👍 Approved with suggestions 0 resolved / 1 findings

Eliminates per-DAG Airflow pause-state queries by folding DagModel.is_paused into the existing paginated serialized-DAG query, with outer join support for Airflow 2 undeployed pipelines. Database-backed regression tests validate active, paused, and serialized-only DAG handling.

Consider adding test coverage for the observability refactor to exercise yield_pipeline_lineage_details + get_table_pipeline_observability end-to-end, asserting that the latest-run record is emitted per table and context is reset between sibling DAGs.

💡 Quality: Observability refactor lacks test coverage

📄 ingestion/src/metadata/ingestion/source/pipeline/airflow/metadata.py:894 📄 ingestion/src/metadata/ingestion/source/pipeline/airflow/metadata.py:997-1011 📄 ingestion/tests/unit/topology/pipeline/test_airflow.py:260-274

This commit removes the entire observability_cache mechanism and changes get_table_pipeline_observability from emitting one PipelineObservability per dag run (plus historical cached DAGs) to a single record per table built from the newest run. The correctness rests on the assumption that the server upserts observability keyed by pipeline FQN so only the newest run survives; if that assumption is wrong, historical observability is silently dropped. The added tests only cover AirflowTask xlet parsing, not this behavior. Given the project's testing philosophy, add a test exercising yield_pipeline_lineage_details + get_table_pipeline_observability that asserts the correct latest-run record is emitted per table and that the context is reset between sibling DAGs (the early-return path in yield_pipeline_lineage_details).

🤖 Prompt for agents
Code Review: Eliminates per-DAG Airflow pause-state queries by folding `DagModel.is_paused` into the existing paginated serialized-DAG query, with outer join support for Airflow 2 undeployed pipelines. Database-backed regression tests validate active, paused, and serialized-only DAG handling.
  
  Consider adding test coverage for the observability refactor to exercise `yield_pipeline_lineage_details` + `get_table_pipeline_observability` end-to-end, asserting that the latest-run record is emitted per table and context is reset between sibling DAGs.

1. 💡 Quality: Observability refactor lacks test coverage
   Files: ingestion/src/metadata/ingestion/source/pipeline/airflow/metadata.py:894, ingestion/src/metadata/ingestion/source/pipeline/airflow/metadata.py:997-1011, ingestion/tests/unit/topology/pipeline/test_airflow.py:260-274

   This commit removes the entire observability_cache mechanism and changes get_table_pipeline_observability from emitting one PipelineObservability per dag run (plus historical cached DAGs) to a single record per table built from the newest run. The correctness rests on the assumption that the server upserts observability keyed by pipeline FQN so only the newest run survives; if that assumption is wrong, historical observability is silently dropped. The added tests only cover AirflowTask xlet parsing, not this behavior. Given the project's testing philosophy, add a test exercising yield_pipeline_lineage_details + get_table_pipeline_observability that asserts the correct latest-run record is emitted per table and that the context is reset between sibling DAGs (the early-return path in yield_pipeline_lineage_details).

Options

Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@sonarqubecloud

sonarqubecloud Bot commented Sep 7, 2026

Copy link
Copy Markdown

@IceS2
IceS2 enabled auto-merge September 7, 2026 09:33
@IceS2
IceS2 added this pull request to the merge queue Sep 7, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Sep 7, 2026
@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — failed_checks (2026-09-07T17:49:32Z)

Blocked the queue: py-tests-status

  • py-tests-postgres — py-tests-status, python / Verify Expected Jobs, python / Integration Tests (shard-3)

@IceS2
IceS2 added this pull request to the merge queue Sep 8, 2026
Merged via the queue into main with commit b50e927 Sep 8, 2026
108 checks passed
@IceS2
IceS2 deleted the assess-airflow-bugs branch September 8, 2026 15:17
IceS2 added a commit that referenced this pull request Sep 9, 2026
IceS2 added a commit that referenced this pull request Sep 9, 2026

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ingestion safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Airflow ingestion fires N extra DB queries (one per DAG) to fetch is_paused inside get_pipelines_list

5 participants