This is an automated email from the ASF dual-hosted git repository.

Lee-W pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new b5ca22af465 Warn when partitioned asset consumers wait too long 
(#76991)
b5ca22af465 is described below

commit b5ca22af4652236397cc38d466ba63cb1ea33987
Author: ataulmujeeb-cyber <[email protected]>
AuthorDate: Mon Nov 30 04:58:08 2026 -0500

    Warn when partitioned asset consumers wait too long (#76991)
    
    * Warn when partitioned asset consumers wait too long
    
    A partition can keep waiting for an asset input without ever creating a
    Dag run. Exposing an opt-in pending-age warning gives operators a way to
    notice that wait before they have a run to inspect.
    
    * Update airflow-core/docs/authoring-and-scheduling/assets.rst
    
    Co-authored-by: Wei Lee <[email protected]>
    
    * Update airflow-core/src/airflow/jobs/asset_partition_warnings.py
    
    Co-authored-by: Wei Lee <[email protected]>
    
    * Update airflow-core/src/airflow/jobs/asset_partition_warnings.py
    
    Co-authored-by: Wei Lee <[email protected]>
    
    * Clarify pending partitioned run monitoring
    
    The documented timeout setting must enable the warning it describes.
    Make the consumer scope and warning location clear so operators can
    configure the check and find pending work before a Dag run exists.
    
    * Update airflow-core/src/airflow/jobs/asset_partition_warnings.py
    
    Co-authored-by: Wei Lee <[email protected]>
    
    * Clarify pending partition warning diagnostics
    
    ---------
    
    Co-authored-by: Wei Lee <[email protected]>
---
 .../docs/authoring-and-scheduling/assets.rst       |  54 ++
 .../core_api/openapi/v2-rest-api-generated.yaml    |   1 +
 .../src/airflow/config_templates/config.yml        |  20 +
 .../src/airflow/jobs/asset_partition_warnings.py   | 196 +++++++
 .../src/airflow/jobs/scheduler_job_runner.py       |   3 +
 airflow-core/src/airflow/models/dagwarning.py      |   1 +
 .../airflow/ui/openapi-gen/requests/schemas.gen.ts |   2 +-
 .../airflow/ui/openapi-gen/requests/types.gen.ts   |   2 +-
 .../ui/public/i18n/locales/en/components.json      |   1 +
 .../ui/src/components/DagStatusChip.test.tsx       |  22 +
 .../core_api/routes/public/test_dag_warning.py     |  24 +-
 .../tests/unit/dag_processing/test_collection.py   |  17 +-
 .../unit/jobs/test_asset_partition_warnings.py     | 568 +++++++++++++++++++++
 airflow-core/tests/unit/jobs/test_scheduler_job.py | 139 +++++
 .../src/airflowctl/api/datamodels/generated.py     |   1 +
 .../src/airflow/sdk/api/datamodels/_generated.py   |   1 +
 16 files changed, 1046 insertions(+), 6 deletions(-)

diff --git a/airflow-core/docs/authoring-and-scheduling/assets.rst 
b/airflow-core/docs/authoring-and-scheduling/assets.rst
index f2a5d147bdf..e28008fa7f0 100644
--- a/airflow-core/docs/authoring-and-scheduling/assets.rst
+++ b/airflow-core/docs/authoring-and-scheduling/assets.rst
@@ -730,6 +730,60 @@ including ``partition_key`` in the request body):
         "partition_key": "us|2026-03-10T09:00:00"
       }'
 
+.. _monitor-pending-asset-partitions:
+
+Monitoring pending partitioned Dag runs
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+When required asset inputs are incomplete, Airflow tracks a pending 
partitioned Dag
+run before creating the Dag run itself. To warn when this wait exceeds your 
expectations,
+set :ref:`[scheduler] pending_partitioned_dag_run_timeout 
<config:scheduler__pending_partitioned_dag_run_timeout>`.
+The value is a JSON object mapping exact consumer Dag IDs to positive, finite 
numbers
+of seconds. Keys identify the consuming Dags, not asset names or URIs. The 
default,
+``{}``, disables monitoring. For example, in ``airflow.cfg``:
+
+.. code-block:: ini
+
+    [scheduler]
+    pending_partitioned_dag_run_timeout = {"clean_and_combine_player_stats": 
7200}
+
+Use the same setting on every scheduler. For each configured, active 
partitioned Dag,
+the scheduler adds a warning when its oldest pending partitioned Dag run is 
strictly
+older than the configured threshold. It reports how many partitioned Dag runs 
are
+pending and when the oldest became pending. Several pending runs can share a 
partition key.
+
+The warning reports the length of the wait, not its cause. Check both the 
Dag's asset
+inputs and the scheduler's pending partition backlog: older pending runs from 
other
+Dags can occupy the scheduler's evaluation window and delay an otherwise ready 
partition.
+
+To view **Pending partitioned Dag runs** in the UI, open **Dags → the affected 
Dag → Overview**
+and click the warning icon before the breadcrumb. This works before any Dag 
run exists;
+the warning is not shown on Dag list rows or cards. It is also available 
through
+``GET /api/v2/dagWarnings`` with ``warning_type=asset partition pending`` in 
the
+:doc:`REST API </stable-rest-api-ref>`.
+
+Age is measured from when the pending partitioned Dag run was first recorded. 
Choose a
+threshold that allows for expected upstream delays and rollup windows. Paused, 
draining,
+and stale Dags are excluded. Time spent paused is still included in the age, 
so a resumed
+Dag can warn on its first check.
+
+Each scheduler checks up to 100 Dag IDs every 60 seconds, rotating through 
configured
+Dags and Dags with an existing warning. Updates are eventually consistent: 
with more
+than 100 Dags, a full pass takes multiple checks. The warning clears on the 
next check
+of that Dag when no pending partitioned Dag runs exceed the threshold, the Dag 
becomes ineligible,
+or its policy is removed.
+
+Invalid configuration errors identify the offending entry. Each scheduler also 
checks
+up to 100 previously unchecked configured Dag IDs per poll and logs IDs that 
do not
+match a registered Dag. Check for typos, or whether the Dag has been parsed 
yet.
+These diagnostics do not stop monitoring valid Dags. An ID is checked again 
after
+it is removed from the policy and re-added, or when the scheduler restarts.
+
+This advisory warning does not send notifications or recover inputs 
automatically.
+It only monitors existing pending partitioned Dag runs. When none exists, it 
cannot
+detect stale assets, missed expected runs, or progress already removed after a 
Dag
+definition change. Use separate freshness or expected-cadence monitoring for 
these cases.
+
 Rollup mappers
 ~~~~~~~~~~~~~~
 
diff --git 
a/airflow-core/src/airflow/api_fastapi/core_api/openapi/v2-rest-api-generated.yaml
 
b/airflow-core/src/airflow/api_fastapi/core_api/openapi/v2-rest-api-generated.yaml
index 80ca332dd46..d4442f9ea9e 100644
--- 
a/airflow-core/src/airflow/api_fastapi/core_api/openapi/v2-rest-api-generated.yaml
+++ 
b/airflow-core/src/airflow/api_fastapi/core_api/openapi/v2-rest-api-generated.yaml
@@ -16729,6 +16729,7 @@ components:
       type: string
       enum:
       - asset conflict
+      - asset partition pending
       - duplicate dag id
       - non-existent pool
       - runtime varying value
diff --git a/airflow-core/src/airflow/config_templates/config.yml 
b/airflow-core/src/airflow/config_templates/config.yml
index 93b09366d11..4a2a2778045 100644
--- a/airflow-core/src/airflow/config_templates/config.yml
+++ b/airflow-core/src/airflow/config_templates/config.yml
@@ -2817,6 +2817,26 @@ scheduler:
       type: integer
       example: ~
       default: "0"
+    pending_partitioned_dag_run_timeout:
+      description: |
+        Maximum pending age in seconds for each monitored partitioned asset 
Dag, as a JSON object
+        mapping exact consumer Dag IDs, not asset names or URIs, to positive 
numbers. Empty by
+        default. When the oldest pending partitioned Dag run exceeds its 
threshold, the scheduler
+        records a warning in the Dag warnings API and the Dag's page in the 
UI. This does not
+        fail a run or change scheduling.
+
+        Every 60 seconds, each scheduler checks up to 100 configured Dags or 
Dags with existing
+        warnings, rotating through the remainder on subsequent checks. Use the 
same configuration
+        on every scheduler. Paused, draining and stale Dags are excluded, but 
paused time counts
+        toward pending age when a Dag resumes. Removing a policy clears its 
warning on a later check.
+
+        The age is measured from the pending row's creation, not from its last 
event. Missing runs
+        with no pending row are not detected. Queries include historical rows 
for the selected Dags;
+        consider database cost when enabling this for large histories.
+      version_added: 3.5.0
+      type: string
+      example: '{"daily_sales": 3600, "hourly_inventory": 900}'
+      default: "{{}}"
     pool_metrics_interval:
       description: |
         How often (in seconds) should pool usage stats be sent to StatsD (if 
statsd_on is enabled)
diff --git a/airflow-core/src/airflow/jobs/asset_partition_warnings.py 
b/airflow-core/src/airflow/jobs/asset_partition_warnings.py
new file mode 100644
index 00000000000..ac06a6af8d5
--- /dev/null
+++ b/airflow-core/src/airflow/jobs/asset_partition_warnings.py
@@ -0,0 +1,196 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from __future__ import annotations
+
+import math
+import sys
+from itertools import islice
+from typing import TYPE_CHECKING
+
+import structlog
+from sqlalchemy import and_, bindparam, delete, func, or_, select
+
+from airflow._shared.timezones import timezone
+from airflow.configuration import conf
+from airflow.models.asset import AssetPartitionDagRun
+from airflow.models.dag import DagModel
+from airflow.models.dagwarning import DagWarning, DagWarningType
+from airflow.utils.session import create_session
+from airflow.utils.sqlalchemy import build_upsert_stmt, get_dialect_name
+
+if TYPE_CHECKING:
+    from typing import TypeAlias
+
+    from sqlalchemy.orm import Session
+
+    PendingRunTimeouts: TypeAlias = dict[str, float]
+
+log = structlog.get_logger(__name__)
+
+
+class AssetPartitionWaitMonitor:
+    """Refresh advisory warnings about pending partition age, independently of 
run creation."""
+
+    _batch_size = 100
+
+    def __init__(self) -> None:
+        self._cursor: str | None = None
+        self._checked_dag_ids: set[str] = set()
+
+    def check(self) -> None:
+        # Validate before reconciling: invalid configuration must not clear 
existing warnings.
+        configured = conf.getjson("scheduler", 
"pending_partitioned_dag_run_timeout", fallback={})
+        if not isinstance(configured, dict):
+            raise ValueError(
+                "pending_partitioned_dag_run_timeout must be a JSON object of 
consumer Dag IDs to seconds"
+            )
+        timeouts: PendingRunTimeouts = {}
+        for dag_id, value in configured.items():
+            if (
+                not isinstance(dag_id, str)
+                or not dag_id.strip()
+                or isinstance(value, bool)
+                or not isinstance(value, (int, float))
+                or value <= 0
+                or value > sys.float_info.max
+                or not math.isfinite(value)
+            ):
+                raise ValueError(
+                    f"Invalid entry for {dag_id!r} in 
pending_partitioned_dag_run_timeout: "
+                    "expected a nonempty consumer Dag ID and finite positive 
seconds"
+                )
+            timeouts[dag_id] = value
+
+        unchecked_dag_ids = list(
+            islice((dag_id for dag_id in timeouts if dag_id not in 
self._checked_dag_ids), self._batch_size)
+        )
+        with create_session(scoped=False) as session:
+            missing_dag_ids = set(unchecked_dag_ids)
+            if unchecked_dag_ids:
+                missing_dag_ids.difference_update(
+                    
session.scalars(select(DagModel.dag_id).where(DagModel.dag_id.in_(unchecked_dag_ids)))
+                )
+            dag_ids = self._get_next_batch(timeouts, after=self._cursor, 
session=session)
+            if not dag_ids and self._cursor is not None:
+                dag_ids = self._get_next_batch(timeouts, after=None, 
session=session)
+            if dag_ids:
+                self._refresh(dag_ids, timeouts, session=session)
+        # Do not advance on rollback: the same batch needs another opportunity 
next time.
+        self._cursor = dag_ids[-1] if len(dag_ids) == self._batch_size else 
None
+        self._checked_dag_ids.intersection_update(timeouts)
+        self._checked_dag_ids.update(unchecked_dag_ids)
+        if missing_dag_ids:
+            log.warning(
+                "No registered Dag matches these 
pending_partitioned_dag_run_timeout entries; "
+                "check for typos or Dags that have not been parsed yet",
+                dag_ids=sorted(missing_dag_ids),
+            )
+
+    def _get_next_batch(
+        self, timeouts: PendingRunTimeouts, *, session: Session, after: str | 
None
+    ) -> list[str]:
+        # Use database ordering for both candidates and cursor comparisons. 
Python ordering
+        # can differ from the database collation. Include existing warnings 
even with no policy.
+        query = (
+            select(DagModel.dag_id)
+            .outerjoin(
+                DagWarning,
+                and_(
+                    DagWarning.dag_id == DagModel.dag_id,
+                    DagWarning.warning_type == 
DagWarningType.ASSET_PARTITION_PENDING,
+                ),
+            )
+            .where(or_(DagModel.dag_id.in_(timeouts), 
DagWarning.dag_id.is_not(None)))
+            .order_by(DagModel.dag_id)
+            .limit(self._batch_size)
+        )
+        if after is not None:
+            query = query.where(DagModel.dag_id > after)
+        return list(session.scalars(query))
+
+    def _refresh(self, dag_ids: list[str], timeouts: PendingRunTimeouts, *, 
session: Session) -> None:
+        existing = {
+            dag_id: message
+            for dag_id, message in session.execute(
+                select(DagWarning.dag_id, DagWarning.message).where(
+                    DagWarning.dag_id.in_(dag_ids),
+                    DagWarning.warning_type == 
DagWarningType.ASSET_PARTITION_PENDING,
+                )
+            )
+        }
+        now = timezone.utcnow()
+        overdue: dict[str, str] = {}
+        if monitored := [dag_id for dag_id in dag_ids if dag_id in timeouts]:
+            pending = session.execute(
+                select(
+                    AssetPartitionDagRun.target_dag_id,
+                    func.count(),
+                    func.min(AssetPartitionDagRun.created_at),
+                )
+                .join(DagModel, DagModel.dag_id == 
AssetPartitionDagRun.target_dag_id)
+                .where(
+                    AssetPartitionDagRun.target_dag_id.in_(monitored),
+                    AssetPartitionDagRun.created_dag_run_id.is_(None),
+                    DagModel.timetable_partitioned.is_(True),
+                    DagModel.is_paused.is_(False),
+                    DagModel.is_draining.is_(False),
+                    DagModel.is_stale.is_(False),
+                )
+                .group_by(AssetPartitionDagRun.target_dag_id)
+            )
+            for dag_id, count, oldest in pending:
+                timeout = timeouts[dag_id]
+                if (now - oldest).total_seconds() > timeout:
+                    overdue[dag_id] = (
+                        f"{count} pending partitioned Dag runs; oldest pending 
since {oldest.isoformat()}. "
+                        f"The configured wait threshold is {timeout:g} 
seconds. "
+                        "Check this Dag's asset inputs and the scheduler's 
pending partition backlog; "
+                        "older pending runs from other Dags can delay 
evaluation."
+                    )
+
+        if cleared := existing.keys() - overdue.keys():
+            session.execute(
+                delete(DagWarning).where(
+                    DagWarning.dag_id.in_(cleared),
+                    DagWarning.warning_type == 
DagWarningType.ASSET_PARTITION_PENDING,
+                )
+            )
+        changed = [
+            {
+                "dag_id": dag_id,
+                "warning_type": DagWarningType.ASSET_PARTITION_PENDING.value,
+                "message": message,
+                "timestamp": now,
+                "pending_message": message,
+            }
+            for dag_id, message in overdue.items()
+            if existing.get(dag_id) != message
+        ]
+        if changed:
+            # Atomic upserts allow multiple schedulers to discover the same 
warning. Preserve
+            # its first-detected timestamp; stable messages avoid writes on 
unchanged polls.
+            session.execute(
+                build_upsert_stmt(
+                    get_dialect_name(session),
+                    DagWarning.__table__,
+                    conflict_cols=["dag_id", "warning_type"],
+                    values={},
+                    update_fields={"message": bindparam("pending_message")},
+                ),
+                changed,
+            )
diff --git a/airflow-core/src/airflow/jobs/scheduler_job_runner.py 
b/airflow-core/src/airflow/jobs/scheduler_job_runner.py
index 822c26e31b7..b1e9d7fce9e 100644
--- a/airflow-core/src/airflow/jobs/scheduler_job_runner.py
+++ b/airflow-core/src/airflow/jobs/scheduler_job_runner.py
@@ -79,6 +79,7 @@ from airflow.exceptions import DagNotFound, 
ParamValidationError, TaskNotFound,
 from airflow.executors import workloads
 from airflow.executors.executor_loader import ExecutorLoader
 from airflow.executors.workloads.types import TaskInstanceUuid
+from airflow.jobs.asset_partition_warnings import AssetPartitionWaitMonitor
 from airflow.jobs.base_job_runner import BaseJobRunner
 from airflow.jobs.job import EXECUTOR_JOB_TYPE, HealthCheckResult, Job, 
JobState, perform_heartbeat
 from airflow.models import Deadline, Log
@@ -613,6 +614,7 @@ class SchedulerJobRunner(BaseJobRunner, LoggingMixin):
         # unreachable APDR is visible in scheduler logs without spamming every
         # tick.
         self._partition_unreachable_seen: set[tuple[str, str, str]] = set()
+        self._asset_partition_wait_monitor = AssetPartitionWaitMonitor()
 
     @provide_session
     def heartbeat_callback(self, *, session: Session = NEW_SESSION) -> None:
@@ -2691,6 +2693,7 @@ class SchedulerJobRunner(BaseJobRunner, LoggingMixin):
 
         timers.call_regular_interval(60.0, 
self._update_dag_run_state_for_paused_dags)
         timers.call_regular_interval(5.0, self._finalize_draining_dags)
+        timers.call_regular_interval(60.0, 
self._asset_partition_wait_monitor.check, non_fatal=True)
         timers.call_regular_interval(60.0, self._report_partition_cap_backlog, 
non_fatal=True)
         timers.call_regular_interval(
             conf.getfloat("scheduler", "parsing_cleanup_interval"), 
cleanup_processor_metadata, non_fatal=True
diff --git a/airflow-core/src/airflow/models/dagwarning.py 
b/airflow-core/src/airflow/models/dagwarning.py
index 25224943925..8535e375868 100644
--- a/airflow-core/src/airflow/models/dagwarning.py
+++ b/airflow-core/src/airflow/models/dagwarning.py
@@ -81,6 +81,7 @@ class DagWarningType(str, Enum):
     """
 
     ASSET_CONFLICT = "asset conflict"
+    ASSET_PARTITION_PENDING = "asset partition pending"
     DUPLICATE_DAG_ID = "duplicate dag id"
     NONEXISTENT_POOL = "non-existent pool"
     RUNTIME_VARYING_VALUE = "runtime varying value"
diff --git a/airflow-core/src/airflow/ui/openapi-gen/requests/schemas.gen.ts 
b/airflow-core/src/airflow/ui/openapi-gen/requests/schemas.gen.ts
index 5ef8e7d6d2b..2468d403575 100644
--- a/airflow-core/src/airflow/ui/openapi-gen/requests/schemas.gen.ts
+++ b/airflow-core/src/airflow/ui/openapi-gen/requests/schemas.gen.ts
@@ -5713,7 +5713,7 @@ export const $DagVersionResponse = {
 
 export const $DagWarningType = {
     type: 'string',
-    enum: ['asset conflict', 'duplicate dag id', 'non-existent pool', 'runtime 
varying value', 'task group cycle'],
+    enum: ['asset conflict', 'asset partition pending', 'duplicate dag id', 
'non-existent pool', 'runtime varying value', 'task group cycle'],
     title: 'DagWarningType',
     description: `Enum for DAG warning types.
 
diff --git a/airflow-core/src/airflow/ui/openapi-gen/requests/types.gen.ts 
b/airflow-core/src/airflow/ui/openapi-gen/requests/types.gen.ts
index b9e6bcfa16a..419b62b9569 100644
--- a/airflow-core/src/airflow/ui/openapi-gen/requests/types.gen.ts
+++ b/airflow-core/src/airflow/ui/openapi-gen/requests/types.gen.ts
@@ -1596,7 +1596,7 @@ export type DagVersionResponse = {
  * This is the set of allowable values for the ``warning_type`` field
  * in the DagWarning model.
  */
-export type DagWarningType = 'asset conflict' | 'duplicate dag id' | 
'non-existent pool' | 'runtime varying value' | 'task group cycle';
+export type DagWarningType = 'asset conflict' | 'asset partition pending' | 
'duplicate dag id' | 'non-existent pool' | 'runtime varying value' | 'task 
group cycle';
 
 /**
  * How much of a component's work has a live instance covering it.
diff --git a/airflow-core/src/airflow/ui/public/i18n/locales/en/components.json 
b/airflow-core/src/airflow/ui/public/i18n/locales/en/components.json
index 04928fb6aa6..3f83649b376 100644
--- a/airflow-core/src/airflow/ui/public/i18n/locales/en/components.json
+++ b/airflow-core/src/airflow/ui/public/i18n/locales/en/components.json
@@ -64,6 +64,7 @@
     "failingWatcher": "Watcher {{watcherName}} on {{assetName}} is failing",
     "types": {
       "asset conflict": "Asset conflict",
+      "asset partition pending": "Pending partitioned Dag runs",
       "duplicate dag id": "Duplicate Dag ID",
       "non-existent pool": "Non-existent pool",
       "runtime varying value": "Runtime-varying value",
diff --git a/airflow-core/src/airflow/ui/src/components/DagStatusChip.test.tsx 
b/airflow-core/src/airflow/ui/src/components/DagStatusChip.test.tsx
index 9065d51aac4..c0cee693bd3 100644
--- a/airflow-core/src/airflow/ui/src/components/DagStatusChip.test.tsx
+++ b/airflow-core/src/airflow/ui/src/components/DagStatusChip.test.tsx
@@ -123,6 +123,28 @@ describe("DagStatusChip", () => {
     expect(screen.getByRole("button", { name: warningName(1) 
})).toBeInTheDocument();
   });
 
+  it("opens pending partition warnings before a Dag run exists", async () => {
+    const message =
+      "2 pending partitioned Dag runs; oldest pending since 
2026-11-12T12:00:00+00:00. " +
+      "The configured wait threshold is 60 seconds. Inspect the pending asset 
inputs for this Dag.";
+
+    mockUseDagServiceGetDag.mockReturnValue(liveDagQuery);
+    mockUseDagWarningServiceListDagWarnings.mockReturnValue({
+      data: {
+        dag_warnings: [{ message, warning_type: "asset partition pending" }],
+        total_entries: 1,
+      },
+      isLoading: false,
+    });
+
+    renderChip();
+
+    fireEvent.click(screen.getByRole("button", { name: warningName(1) }));
+
+    await waitFor(() => expect(screen.getByText("Pending partitioned Dag 
runs")).toBeInTheDocument());
+    expect(screen.getByText(message)).toBeInTheDocument();
+  });
+
   it("lets the parse error outrank the warnings for name and severity", async 
() => {
     mockUseImportErrorServiceGetImportErrors.mockReturnValue(importErrorQuery);
     mockUseDagWarningServiceListDagWarnings.mockReturnValue(warningsQuery);
diff --git 
a/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dag_warning.py
 
b/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dag_warning.py
index e96311a666c..80ccc976880 100644
--- 
a/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dag_warning.py
+++ 
b/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dag_warning.py
@@ -116,7 +116,7 @@ class TestGetDagWarnings:
         response_json = response.json()
         assert response.status_code == 422
         assert response_json["detail"][0]["msg"] == (
-            "Input should be 'asset conflict', 'duplicate dag id', 
'non-existent pool', "
+            "Input should be 'asset conflict', 'asset partition pending', 
'duplicate dag id', 'non-existent pool', "
             "'runtime varying value' or 'task group cycle'"
         )
 
@@ -138,3 +138,25 @@ class TestGetDagWarnings:
         assert response_json["total_entries"] == 1
         assert response_json["dag_warnings"][0]["warning_type"] == 
"yaml:schema_violation"
         assert response_json["dag_warnings"][0]["message"] == "importer 
message"
+
+    def test_get_pending_partition_warnings_for_one_dag(self, test_client, 
session):
+        session.add_all(
+            [
+                DagWarning(DAG1_ID, "asset partition pending", "First Dag is 
waiting for asset inputs"),
+                DagWarning(DAG2_ID, "asset partition pending", "Second Dag is 
waiting for asset inputs"),
+            ]
+        )
+        session.commit()
+
+        response = test_client.get(
+            "/dagWarnings", params={"dag_id": DAG1_ID, "warning_type": "asset 
partition pending"}
+        )
+
+        assert response.status_code == 200
+        body = response.json()
+        assert body["total_entries"] == 1
+        [warning] = body["dag_warnings"]
+        assert warning["dag_id"] == DAG1_ID
+        assert warning["dag_display_name"] == DAG1_DISPLAY_NAME
+        assert warning["warning_type"] == "asset partition pending"
+        assert warning["message"] == "First Dag is waiting for asset inputs"
diff --git a/airflow-core/tests/unit/dag_processing/test_collection.py 
b/airflow-core/tests/unit/dag_processing/test_collection.py
index 443d6a4aeb5..5b8fde9b0b1 100644
--- a/airflow-core/tests/unit/dag_processing/test_collection.py
+++ b/airflow-core/tests/unit/dag_processing/test_collection.py
@@ -1063,14 +1063,17 @@ class TestUpdateDagParsingResults:
         assert warning is None
 
     @pytest.mark.usefixtures("clean_db")
-    def test_stale_importer_warnings_are_replaced(self, testing_dag_bundle, 
session):
+    @pytest.mark.parametrize(
+        "retained_warning_type", [DagWarningType.ASSET_CONFLICT, 
DagWarningType.ASSET_PARTITION_PENDING]
+    )
+    def test_stale_importer_warnings_are_replaced(self, testing_dag_bundle, 
session, retained_warning_type):
         session.add(DagModel(dag_id="imported_dag", bundle_name="testing", 
fileloc="/dags/imported.py"))
         session.flush()
         session.add_all(
             [
                 DagWarning(dag_id="imported_dag", warning_type="test:stale", 
message="Stale"),
                 DagWarning(
-                    dag_id="imported_dag", 
warning_type=DagWarningType.ASSET_CONFLICT, message="Conflict"
+                    dag_id="imported_dag", warning_type=retained_warning_type, 
message="Scheduler warning"
                 ),
             ]
         )
@@ -1089,7 +1092,15 @@ class TestUpdateDagParsingResults:
         warning_types = session.scalars(
             select(DagWarning.warning_type).where(DagWarning.dag_id == 
"imported_dag")
         ).all()
-        assert sorted(warning_types) == [DagWarningType.ASSET_CONFLICT.value, 
"test:current"]
+        assert sorted(warning_types) == [retained_warning_type.value, 
"test:current"]
+        assert (
+            session.scalar(
+                select(DagWarning.message).where(
+                    DagWarning.dag_id == "imported_dag", 
DagWarning.warning_type == retained_warning_type
+                )
+            )
+            == "Scheduler warning"
+        )
 
     @pytest.mark.usefixtures("clean_db")
     def test_dag_source_codes_are_written_to_dag_code(self, 
testing_dag_bundle, session):
diff --git a/airflow-core/tests/unit/jobs/test_asset_partition_warnings.py 
b/airflow-core/tests/unit/jobs/test_asset_partition_warnings.py
new file mode 100644
index 00000000000..d9bd84a20d6
--- /dev/null
+++ b/airflow-core/tests/unit/jobs/test_asset_partition_warnings.py
@@ -0,0 +1,568 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from __future__ import annotations
+
+import json
+import re
+from concurrent.futures import ThreadPoolExecutor
+from contextlib import contextmanager
+from datetime import timedelta
+from threading import Barrier
+from typing import TYPE_CHECKING
+
+import pytest
+import time_machine
+from sqlalchemy import delete, event, func, select
+
+from airflow import settings
+from airflow._shared.timezones import timezone
+from airflow.jobs.asset_partition_warnings import AssetPartitionWaitMonitor
+from airflow.models.asset import AssetPartitionDagRun
+from airflow.models.dag import DagModel
+from airflow.models.dagrun import DagRun
+from airflow.models.dagwarning import DagWarning, DagWarningType
+from airflow.utils.session import create_session
+from airflow.utils.state import DagRunState
+from airflow.utils.types import DagRunType
+
+from tests_common.test_utils.asserts import count_queries
+from tests_common.test_utils.config import conf_vars
+from tests_common.test_utils.db import clear_db_dags
+
+if TYPE_CHECKING:
+    from collections.abc import Iterator
+    from datetime import datetime
+
+    from sqlalchemy.orm import Session
+
+pytestmark = pytest.mark.db_test
+
+NOW = timezone.datetime(2026, 11, 12, 12)
+TIMEOUT_OPTION = ("scheduler", "pending_partitioned_dag_run_timeout")
+WARNING_TYPE = DagWarningType.ASSET_PARTITION_PENDING
+
+
[email protected](autouse=True)
+def clean_monitor_data(testing_dag_bundle):
+    def clean():
+        with create_session(scoped=False) as session:
+            session.execute(delete(AssetPartitionDagRun))
+        clear_db_dags()
+
+    clean()
+    yield
+    clean()
+
+
+def _add_dag(session: Session, dag_id: str = "monitored", **overrides) -> 
DagModel:
+    values = {
+        "dag_id": dag_id,
+        "bundle_name": "testing",
+        "is_paused": False,
+        "is_draining": False,
+        "is_stale": False,
+        "timetable_partitioned": True,
+        "asset_expression": {"asset": {"name": "input", "uri": "input"}},
+    }
+    dag = DagModel(**(values | overrides))
+    session.add(dag)
+    session.flush()
+    return dag
+
+
+def _add_pending(
+    session: Session,
+    dag_id: str = "monitored",
+    *,
+    age: timedelta = timedelta(hours=2),
+    partition_key: str = "partition",
+) -> AssetPartitionDagRun:
+    row = AssetPartitionDagRun(
+        target_dag_id=dag_id,
+        partition_key=partition_key,
+        created_at=NOW - age,
+        updated_at=NOW,
+        rollup_fingerprint=None,
+    )
+    session.add(row)
+    return row
+
+
+def _get_warnings() -> dict[tuple[str, str], tuple[str, datetime]]:
+    with create_session(scoped=False) as session:
+        return {
+            (dag_id, warning_type): (message, timestamp)
+            for dag_id, warning_type, message, timestamp in session.execute(
+                select(DagWarning.dag_id, DagWarning.warning_type, 
DagWarning.message, DagWarning.timestamp)
+            )
+        }
+
+
+@contextmanager
+def _capture_statements() -> Iterator[list[str]]:
+    statements: list[str] = []
+
+    def capture(_connection, _cursor, statement, _parameters, _context, 
_executemany):
+        statements.append(statement)
+
+    event.listen(settings.engine, "before_cursor_execute", capture)
+    try:
+        yield statements
+    finally:
+        event.remove(settings.engine, "before_cursor_execute", capture)
+
+
+@time_machine.travel(NOW, tick=False)
+@conf_vars({TIMEOUT_OPTION: '{"monitored": 3600}'})
[email protected](
+    ("age", "warned"),
+    [
+        pytest.param(timedelta(seconds=-1), False, id="future-created-at"),
+        pytest.param(timedelta(seconds=3599), False, id="below-threshold"),
+        pytest.param(timedelta(seconds=3600), False, id="exact-threshold"),
+        pytest.param(timedelta(seconds=3601), True, id="above-threshold"),
+    ],
+)
+def test_warns_only_after_pending_wait_exceeds_threshold(age, warned):
+    with create_session(scoped=False) as session:
+        _add_dag(session)
+        _add_pending(session, age=age)
+
+    AssetPartitionWaitMonitor().check()
+
+    warnings = _get_warnings()
+    assert (("monitored", WARNING_TYPE) in warnings) is warned
+    with create_session(scoped=False) as session:
+        assert session.scalar(select(func.count()).select_from(DagRun)) == 0
+        assert session.scalar(select(AssetPartitionDagRun.created_dag_run_id)) 
is None
+
+
+@time_machine.travel(NOW, tick=False)
+@conf_vars({TIMEOUT_OPTION: '{"monitored": 3600}'})
+def 
test_reports_pending_rows_and_oldest_creation_without_distinct_key_deduplication():
+    oldest = NOW - timedelta(hours=2)
+    with create_session(scoped=False) as session:
+        _add_dag(session)
+        _add_pending(session)
+        _add_pending(session, age=timedelta(minutes=30))
+        _add_pending(session, age=timedelta(minutes=5))
+
+    AssetPartitionWaitMonitor().check()
+
+    message, _ = _get_warnings()["monitored", WARNING_TYPE]
+    assert re.search(r"\b3\b", message)
+    assert oldest.isoformat() in message
+    assert "3600" in message
+    assert "asset inputs" in message
+    assert "pending partition backlog" in message
+    assert "other Dags can delay evaluation" in message
+
+
+@time_machine.travel(NOW, tick=False)
+@conf_vars({TIMEOUT_OPTION: '{"monitored": 3600, "missing": 3600}'})
+def test_does_not_infer_a_missing_partition_or_monitor_unconfigured_dags():
+    with create_session(scoped=False) as session:
+        _add_dag(session)
+        _add_dag(session, "unconfigured")
+        _add_pending(session, "unconfigured", age=timedelta(days=30))
+
+    AssetPartitionWaitMonitor().check()
+
+    assert _get_warnings() == {}
+
+
+@time_machine.travel(NOW, tick=False)
+@conf_vars({TIMEOUT_OPTION: '{"monitored": 3600}'})
[email protected](
+    "reason",
+    ["completed", "deleted", "paused", "draining", "stale", "nonpartitioned"],
+)
+def test_clears_warning_when_pending_wait_no_longer_needs_monitoring(reason):
+    with create_session(scoped=False) as session:
+        _add_dag(session)
+        _add_pending(session)
+        session.add(DagWarning("monitored", DagWarningType.NONEXISTENT_POOL, 
"Unrelated warning"))
+    monitor = AssetPartitionWaitMonitor()
+    monitor.check()
+    assert ("monitored", WARNING_TYPE) in _get_warnings()
+
+    with create_session(scoped=False) as session:
+        if reason == "completed":
+            run = DagRun(
+                dag_id="monitored",
+                run_id="asset_triggered__test",
+                run_type=DagRunType.ASSET_TRIGGERED,
+                state=DagRunState.QUEUED,
+                run_after=NOW,
+            )
+            session.add(run)
+            session.flush()
+            session.scalar(select(AssetPartitionDagRun)).created_dag_run_id = 
run.id
+        elif reason == "deleted":
+            session.execute(delete(AssetPartitionDagRun))
+        else:
+            field, value = {
+                "paused": ("is_paused", True),
+                "draining": ("is_draining", True),
+                "stale": ("is_stale", True),
+                "nonpartitioned": ("timetable_partitioned", False),
+            }[reason]
+            setattr(session.get(DagModel, "monitored"), field, value)
+
+    monitor.check()
+
+    warnings = _get_warnings()
+    assert set(warnings) == {("monitored", DagWarningType.NONEXISTENT_POOL)}
+    assert warnings["monitored", DagWarningType.NONEXISTENT_POOL][0] == 
"Unrelated warning"
+
+
+@time_machine.travel(NOW, tick=False)
+@conf_vars({TIMEOUT_OPTION: '{"monitored": 3600}'})
[email protected]("field", ["is_paused", "is_draining", "is_stale"])
+def test_warns_after_reactivation_using_original_pending_creation_time(field):
+    with create_session(scoped=False) as session:
+        _add_dag(session, **{field: True})
+        _add_pending(session)
+    monitor = AssetPartitionWaitMonitor()
+    monitor.check()
+    assert _get_warnings() == {}
+
+    with create_session(scoped=False) as session:
+        setattr(session.get(DagModel, "monitored"), field, False)
+    monitor.check()
+
+    assert ("monitored", WARNING_TYPE) in _get_warnings()
+
+
+@time_machine.travel(NOW, tick=False)
+def test_clears_removed_policy_after_monitor_restart():
+    with create_session(scoped=False) as session:
+        _add_dag(session)
+        _add_pending(session)
+    with conf_vars({TIMEOUT_OPTION: '{"monitored": 3600}'}):
+        AssetPartitionWaitMonitor().check()
+    assert ("monitored", WARNING_TYPE) in _get_warnings()
+
+    with conf_vars({TIMEOUT_OPTION: "{}"}):
+        AssetPartitionWaitMonitor().check()
+
+    assert _get_warnings() == {}
+
+
+@time_machine.travel(NOW, tick=False)
+def 
test_updated_threshold_reconciles_existing_warning_without_restarting_monitor():
+    with create_session(scoped=False) as session:
+        _add_dag(session)
+        _add_pending(session)
+    monitor = AssetPartitionWaitMonitor()
+    with conf_vars({TIMEOUT_OPTION: '{"monitored": 3600}'}):
+        monitor.check()
+    assert ("monitored", WARNING_TYPE) in _get_warnings()
+
+    with conf_vars({TIMEOUT_OPTION: '{"monitored": 14400}'}):
+        monitor.check()
+    assert _get_warnings() == {}
+
+    with conf_vars({TIMEOUT_OPTION: '{"monitored": 0.5}'}):
+        monitor.check()
+    assert ("monitored", WARNING_TYPE) in _get_warnings()
+
+
+@time_machine.travel(NOW, tick=False)
+@conf_vars({TIMEOUT_OPTION: '{"monitored": 3600}'})
+def test_counts_all_pending_rows_beyond_scheduler_evaluation_window():
+    with create_session(scoped=False) as session:
+        _add_dag(session, "earlier-unconfigured")
+        _add_dag(session)
+        for _ in range(500):
+            _add_pending(session, "earlier-unconfigured", 
age=timedelta(days=30))
+        for _ in range(501):
+            _add_pending(session)
+
+    AssetPartitionWaitMonitor().check()
+
+    warnings = _get_warnings()
+    assert set(warnings) == {("monitored", WARNING_TYPE)}
+    assert re.search(r"\b501\b", warnings["monitored", WARNING_TYPE][0])
+
+
+@time_machine.travel(NOW, tick=False)
+@conf_vars({TIMEOUT_OPTION: '{"monitored": 3600}'})
+def 
test_unchanged_warning_keeps_timestamp_and_does_not_write_or_log_again(caplog):
+    with create_session(scoped=False) as session:
+        _add_dag(session)
+        _add_pending(session)
+    monitor = AssetPartitionWaitMonitor()
+    monitor.check()
+    first = _get_warnings()
+    caplog.clear()
+
+    with time_machine.travel(NOW + timedelta(minutes=1), tick=False), 
_capture_statements() as statements:
+        monitor.check()
+
+    assert _get_warnings() == first
+    assert not any(
+        statement.lstrip().split()[0].upper() in {"INSERT", "UPDATE", 
"DELETE"} for statement in statements
+    )
+    assert not list(caplog)
+
+
+@time_machine.travel(NOW, tick=False)
+@conf_vars({TIMEOUT_OPTION: '{"monitored": 3600}'})
+def test_refreshes_existing_warning_when_pending_rows_change():
+    with create_session(scoped=False) as session:
+        _add_dag(session)
+        _add_pending(session)
+        session.add(DagWarning("monitored", WARNING_TYPE, "Previous 
observation", timestamp=NOW))
+    monitor = AssetPartitionWaitMonitor()
+    monitor.check()
+    before, _ = _get_warnings()["monitored", WARNING_TYPE]
+    assert before != "Previous observation"
+
+    with create_session(scoped=False) as session:
+        _add_pending(session)
+    monitor.check()
+
+    warnings = _get_warnings()
+    assert len(warnings) == 1
+    assert re.search(r"\b2\b", warnings["monitored", WARNING_TYPE][0])
+    assert warnings["monitored", WARNING_TYPE][0] != before
+
+
+@time_machine.travel(NOW, tick=False)
+@conf_vars({TIMEOUT_OPTION: '{"first": 3600, "second": 1800}'})
+def test_refreshes_multiple_existing_warnings_with_each_dags_own_observation():
+    with create_session(scoped=False) as session:
+        for dag_id, count in (("first", 1), ("second", 3)):
+            _add_dag(session, dag_id)
+            for _ in range(count):
+                _add_pending(session, dag_id)
+            session.add(DagWarning(dag_id, WARNING_TYPE, "Previous 
observation"))
+
+    AssetPartitionWaitMonitor().check()
+
+    warnings = _get_warnings()
+    assert set(warnings) == {("first", WARNING_TYPE), ("second", WARNING_TYPE)}
+    first_message = warnings["first", WARNING_TYPE][0]
+    second_message = warnings["second", WARNING_TYPE][0]
+    assert re.search(r"\b1\b", first_message)
+    assert "3600" in first_message
+    assert re.search(r"\b3\b", second_message)
+    assert "1800" in second_message
+
+
+@time_machine.travel(NOW, tick=False)
[email protected]("fail_first_batch", [False, True])
+def test_rotates_over_configured_dags_in_bounded_batches(fail_first_batch):
+    dag_ids = [f"monitored-{index:03d}" for index in range(105)]
+    with create_session(scoped=False) as session:
+        for dag_id in dag_ids:
+            _add_dag(session, dag_id)
+            _add_pending(session, dag_id)
+    monitor = AssetPartitionWaitMonitor()
+
+    with conf_vars({TIMEOUT_OPTION: json.dumps(dict.fromkeys(dag_ids, 3600))}):
+        if fail_first_batch:
+
+            def fail_write(_connection, _cursor, statement, _parameters, 
_context, _executemany):
+                if statement.lstrip().upper().startswith("INSERT INTO 
DAG_WARNING"):
+                    raise RuntimeError("warning write failed")
+
+            event.listen(settings.engine, "before_cursor_execute", fail_write)
+            try:
+                with pytest.raises(RuntimeError, match="warning write failed"):
+                    monitor.check()
+            finally:
+                event.remove(settings.engine, "before_cursor_execute", 
fail_write)
+            assert _get_warnings() == {}
+
+        monitor.check()
+        assert {dag_id for dag_id, _ in _get_warnings()} == set(dag_ids[:100])
+        monitor.check()
+        assert {dag_id for dag_id, _ in _get_warnings()} == set(dag_ids)
+
+        with create_session(scoped=False) as session:
+            session.execute(
+                
delete(AssetPartitionDagRun).where(AssetPartitionDagRun.target_dag_id == 
dag_ids[0])
+            )
+        monitor.check()
+
+    assert {dag_id for dag_id, _ in _get_warnings()} == set(dag_ids[1:])
+
+
+@time_machine.travel(NOW, tick=False)
[email protected]("policy", ["{}", ""])
+def test_disabled_policy_clears_existing_warnings_in_bounded_batches(policy, 
monkeypatch):
+    
monkeypatch.setenv("AIRFLOW__SCHEDULER__PENDING_PARTITIONED_DAG_RUN_TIMEOUT", 
policy)
+    dag_ids = [f"removed-{index:03d}" for index in range(105)]
+    with create_session(scoped=False) as session:
+        for dag_id in dag_ids:
+            _add_dag(session, dag_id)
+            session.add(DagWarning(dag_id, WARNING_TYPE, "Previous 
observation"))
+    monitor = AssetPartitionWaitMonitor()
+
+    monitor.check()
+    assert {dag_id for dag_id, _ in _get_warnings()} == set(dag_ids[100:])
+    monitor.check()
+
+    assert _get_warnings() == {}
+
+
+@time_machine.travel(NOW, tick=False)
+def test_pending_stats_queries_do_not_scale_with_number_of_configured_dags():
+    with create_session(scoped=False) as session:
+        for index in range(50):
+            dag_id = f"monitored-{index:03d}"
+            _add_dag(session, dag_id)
+            _add_pending(session, dag_id, age=timedelta(minutes=1))
+    query_counts = []
+
+    for count in (1, 50):
+        policy = {f"monitored-{index:03d}": 3600 for index in range(count)}
+        monitor = AssetPartitionWaitMonitor()
+        with conf_vars({TIMEOUT_OPTION: json.dumps(policy)}):
+            for _ in range(2):
+                with count_queries() as queries:
+                    monitor.check()
+                query_counts.append(sum(queries.values()))
+
+    assert query_counts == [4, 3, 4, 3]
+    assert _get_warnings() == {}
+
+
+@time_machine.travel(NOW, tick=False)
[email protected](
+    ("policy", "invalid_key"),
+    [
+        pytest.param("[]", None, id="list"),
+        pytest.param("null", None, id="null"),
+        pytest.param('{"monitored": true}', "monitored", id="boolean"),
+        pytest.param('{"monitored": "3600"}', "monitored", 
id="numeric-string"),
+        pytest.param('{"monitored": 0}', "monitored", id="zero"),
+        pytest.param('{"monitored": -1}', "monitored", id="negative"),
+        pytest.param('{"monitored": NaN}', "monitored", id="nan"),
+        pytest.param('{"monitored": Infinity}', "monitored", id="infinity"),
+        pytest.param(json.dumps({"monitored": 10**400}), "monitored", 
id="huge-integer"),
+        pytest.param('{"": 3600}', "", id="empty-dag-id"),
+        pytest.param('{" ": 3600}', " ", id="blank-dag-id"),
+        pytest.param('{"monitored": 3600, "other": 0}', "other", 
id="invalid-second-entry"),
+    ],
+)
+def test_invalid_policy_preserves_existing_warning(policy, invalid_key):
+    with create_session(scoped=False) as session:
+        _add_dag(session)
+        session.add(DagWarning("monitored", WARNING_TYPE, "Previous 
observation", timestamp=NOW))
+    before = _get_warnings()
+
+    with (
+        conf_vars({TIMEOUT_OPTION: policy}),
+        pytest.raises(ValueError, match="pending_partitioned_dag_run_timeout") 
as error,
+    ):
+        AssetPartitionWaitMonitor().check()
+
+    if invalid_key is not None:
+        assert f"Invalid entry for {invalid_key!r}" in str(error.value)
+    assert _get_warnings() == before
+
+
+@time_machine.travel(NOW, tick=False)
+@conf_vars({TIMEOUT_OPTION: '{"monitored": 3600, "missing": 3600}'})
[email protected]("fail_first_check", [False, True])
+def test_unknown_dag_diagnostic_does_not_interrupt_monitoring(caplog, mocker, 
fail_first_check):
+    with create_session(scoped=False) as session:
+        _add_dag(session)
+        _add_pending(session)
+    monitor = AssetPartitionWaitMonitor()
+    if fail_first_check:
+        refresh = mocker.patch.object(
+            monitor, "_refresh", autospec=True, 
side_effect=RuntimeError("write failed")
+        )
+        with pytest.raises(RuntimeError, match="write failed"):
+            monitor.check()
+        mocker.stop(refresh)
+        assert not [entry for entry in caplog if "dag_ids" in entry]
+
+    monitor.check()
+
+    assert set(_get_warnings()) == {("monitored", WARNING_TYPE)}
+    [diagnostic] = [entry for entry in caplog if "dag_ids" in entry]
+    assert diagnostic["dag_ids"] == ["missing"]
+    assert diagnostic["log_level"] == "warning"
+    assert "pending_partitioned_dag_run_timeout" in diagnostic["event"]
+    assert "not been parsed yet" in diagnostic["event"]
+
+    caplog.clear()
+    monitor.check()
+    assert not list(caplog)
+
+    with create_session(scoped=False) as session:
+        _add_dag(session, "missing")
+        _add_pending(session, "missing")
+    monitor.check()
+    assert set(_get_warnings()) == {("monitored", WARNING_TYPE), ("missing", 
WARNING_TYPE)}
+
+
+def test_unknown_dag_diagnostics_are_bounded_and_recheck_readded_ids(caplog):
+    dag_ids = [f"missing-{index:03d}" for index in range(105)]
+    policy = json.dumps(dict.fromkeys(dag_ids, 3600))
+    monitor = AssetPartitionWaitMonitor()
+
+    with conf_vars({TIMEOUT_OPTION: policy}):
+        monitor.check()
+        [diagnostic] = [entry for entry in caplog if "dag_ids" in entry]
+        assert diagnostic["dag_ids"] == dag_ids[:100]
+        caplog.clear()
+        monitor.check()
+        [diagnostic] = [entry for entry in caplog if "dag_ids" in entry]
+        assert diagnostic["dag_ids"] == dag_ids[100:]
+        caplog.clear()
+        monitor.check()
+        assert not list(caplog)
+
+    with conf_vars({TIMEOUT_OPTION: "{}"}):
+        monitor.check()
+    with conf_vars({TIMEOUT_OPTION: policy}):
+        monitor.check()
+    [diagnostic] = [entry for entry in caplog if "dag_ids" in entry]
+    assert diagnostic["dag_ids"] == dag_ids[:100]
+    assert _get_warnings() == {}
+
+
+@time_machine.travel(NOW, tick=False)
+@conf_vars({TIMEOUT_OPTION: '{"monitored": 3600}'})
+def test_concurrent_monitors_create_one_warning():
+    if settings.engine.dialect.name == "sqlite":
+        pytest.skip("SQLite does not support concurrent read-then-write 
transactions")
+    with create_session(scoped=False) as session:
+        _add_dag(session)
+        _add_pending(session)
+    barrier = Barrier(2)
+
+    def synchronize_warning_insert(_connection, _cursor, statement, 
_parameters, _context, _executemany):
+        if statement.lstrip().upper().startswith("INSERT INTO DAG_WARNING"):
+            barrier.wait(timeout=10)
+
+    event.listen(settings.engine, "before_cursor_execute", 
synchronize_warning_insert)
+    try:
+        with ThreadPoolExecutor(max_workers=2) as executor:
+            futures = [executor.submit(AssetPartitionWaitMonitor().check) for 
_ in range(2)]
+            for future in futures:
+                future.result(timeout=20)
+    finally:
+        event.remove(settings.engine, "before_cursor_execute", 
synchronize_warning_insert)
+
+    assert set(_get_warnings()) == {("monitored", WARNING_TYPE)}
diff --git a/airflow-core/tests/unit/jobs/test_scheduler_job.py 
b/airflow-core/tests/unit/jobs/test_scheduler_job.py
index 869c585e125..7f0f1f09143 100644
--- a/airflow-core/tests/unit/jobs/test_scheduler_job.py
+++ b/airflow-core/tests/unit/jobs/test_scheduler_job.py
@@ -5709,6 +5709,22 @@ class TestSchedulerJob:
 
         call_regular_interval.assert_any_call(mock.ANY, 123.0, 
cleanup_processor_metadata, non_fatal=True)
 
+    @mock.patch.object(EventScheduler, "call_regular_interval", autospec=True)
+    def 
test_partition_wait_warnings_run_every_minute_without_stopping_scheduling(
+        self, call_regular_interval
+    ):
+        scheduler_job = Job()
+        scheduler_job.heartbeat = mock.create_autospec(scheduler_job.heartbeat)
+        self.job_runner = SchedulerJobRunner(
+            job=scheduler_job, num_runs=1, 
executors=[MockExecutor(do_update=False)]
+        )
+
+        self.job_runner._run_scheduler_loop()
+
+        call_regular_interval.assert_any_call(
+            mock.ANY, 60.0, 
self.job_runner._asset_partition_wait_monitor.check, non_fatal=True
+        )
+
     @mock.patch.object(EventScheduler, "call_regular_interval", autospec=True)
     def test_partition_cap_callback_registered_non_fatal(self, 
call_regular_interval):
         scheduler_job = Job()
@@ -16985,6 +17001,129 @@ def test_consumer_dag_listen_to_two_partitioned_asset(
         assert asset_event.source_run_id == "test"
 
 
[email protected]_serialized_dag
[email protected]("clear_asset_partition_rows")
+@time_machine.travel("2026-11-12T12:00:00+00:00", tick=False)
+@conf_vars(
+    {
+        ("scheduler", "batch_asset_events"): "True",
+        ("scheduler", "pending_partitioned_dag_run_timeout"): 
'{"dependency-edit-consumer": 60}',
+    }
+)
+def 
test_partition_wait_warning_after_dependency_edit_clears_when_real_run_is_created(
+    dag_maker: DagMaker, session: Session
+):
+    asset_a = Asset(name="dependency-edit-a")
+    asset_b = Asset(name="dependency-edit-b")
+    dag_id = "dependency-edit-consumer"
+    with dag_maker(dag_id=dag_id, 
schedule=PartitionedAssetTimetable(assets=asset_a), session=session):
+        EmptyOperator(task_id="consumer")
+    session.commit()
+
+    # B already has an event, but this Dag did not depend on B when it arrived.
+    with dag_maker(
+        dag_id="dependency-edit-producer-b-early", 
schedule=PartitionedAtRuntime(), session=session
+    ) as producer_dag:
+        EmptyOperator(task_id="hi", outlets=[asset_b])
+    producer_run = dag_maker.create_dagrun(partition_key="waiting-partition", 
session=session)
+    [producer_ti] = producer_run.get_task_instances(session=session)
+    session.commit()
+    TaskInstance.register_asset_changes_in_db(
+        ti=producer_ti,
+        task_outlets=[outlet.asprofile() for outlet in 
producer_dag.get_task("hi").outlets],
+        outlet_events=[],
+        session=session,
+    )
+    session.commit()
+    historical_b_event = session.scalar(
+        select(AssetEvent).where(
+            AssetEvent.source_dag_id == producer_dag.dag_id,
+            AssetEvent.source_run_id == producer_run.run_id,
+        )
+    )
+    assert historical_b_event is not None
+    assert historical_b_event.partition_key == "waiting-partition"
+    assert (
+        
session.scalar(select(AssetPartitionDagRun).where(AssetPartitionDagRun.target_dag_id
 == dag_id))
+        is None
+    )
+    assert (
+        session.scalar(
+            select(PartitionedAssetKeyLog).where(
+                PartitionedAssetKeyLog.asset_event_id == historical_b_event.id
+            )
+        )
+        is None
+    )
+
+    with dag_maker(
+        dag_id=dag_id, schedule=PartitionedAssetTimetable(assets=asset_a & 
asset_b), session=session
+    ):
+        EmptyOperator(task_id="consumer")
+    session.commit()
+
+    apdr = _produce_and_register_asset_event(
+        dag_id="dependency-edit-producer-a",
+        asset=asset_a,
+        partition_key="waiting-partition",
+        session=session,
+        dag_maker=dag_maker,
+    )
+    assert (
+        session.scalar(
+            select(PartitionedAssetKeyLog).where(
+                PartitionedAssetKeyLog.asset_partition_dag_run_id == apdr.id,
+                PartitionedAssetKeyLog.asset_id == historical_b_event.asset_id,
+            )
+        )
+        is None
+    )
+    session.add(DagWarning(dag_id, "non-existent pool", "Unrelated warning"))
+    session.commit()
+    runner = SchedulerJobRunner(
+        job=Job(job_type=SchedulerJobRunner.job_type), 
executors=[MockExecutor(do_update=False)]
+    )
+    assert runner._create_dagruns_for_partitioned_asset_dags(session=session) 
== set()
+    session.commit()
+
+    with time_machine.travel("2026-11-12T12:01:01+00:00", tick=False):
+        runner._asset_partition_wait_monitor.check()
+        warning_query = select(DagWarning).where(
+            DagWarning.dag_id == dag_id, DagWarning.warning_type == "asset 
partition pending"
+        )
+        assert session.scalar(warning_query) is not None
+        assert 
session.scalar(select(func.count()).select_from(DagRun).where(DagRun.dag_id == 
dag_id)) == 0
+
+        resumed_apdr = _produce_and_register_asset_event(
+            dag_id="dependency-edit-producer-b",
+            asset=asset_b,
+            partition_key="waiting-partition",
+            session=session,
+            dag_maker=dag_maker,
+        )
+        assert resumed_apdr.id == apdr.id
+        assert 
runner._create_dagruns_for_partitioned_asset_dags(session=session) == {dag_id}
+        session.commit()
+
+        runner._asset_partition_wait_monitor.check()
+
+    assert session.scalar(warning_query) is None
+    dag_run = session.scalar(select(DagRun).where(DagRun.dag_id == dag_id))
+    assert dag_run is not None
+    assert dag_run.state == DagRunState.QUEUED
+    assert dag_run.partition_key == "waiting-partition"
+    assert len(dag_run.consumed_asset_events) == 2
+    assert historical_b_event.id not in {event.id for event in 
dag_run.consumed_asset_events}
+    assert (
+        session.scalar(
+            select(DagWarning.message).where(
+                DagWarning.dag_id == dag_id, DagWarning.warning_type == 
"non-existent pool"
+            )
+        )
+        == "Unrelated warning"
+    )
+
+
 @pytest.mark.need_serialized_dag
 @pytest.mark.usefixtures("clear_asset_partition_rows")
 @conf_vars({("scheduler", "batch_asset_events"): "True"})
diff --git a/airflow-ctl/src/airflowctl/api/datamodels/generated.py 
b/airflow-ctl/src/airflowctl/api/datamodels/generated.py
index d74a877d211..fad846a7303 100644
--- a/airflow-ctl/src/airflowctl/api/datamodels/generated.py
+++ b/airflow-ctl/src/airflowctl/api/datamodels/generated.py
@@ -933,6 +933,7 @@ class DagWarningType(str, Enum):
     """
 
     ASSET_CONFLICT = "asset conflict"
+    ASSET_PARTITION_PENDING = "asset partition pending"
     DUPLICATE_DAG_ID = "duplicate dag id"
     NON_EXISTENT_POOL = "non-existent pool"
     RUNTIME_VARYING_VALUE = "runtime varying value"
diff --git a/task-sdk/src/airflow/sdk/api/datamodels/_generated.py 
b/task-sdk/src/airflow/sdk/api/datamodels/_generated.py
index 8ec9ba2f4b2..3c11cd5fb1b 100644
--- a/task-sdk/src/airflow/sdk/api/datamodels/_generated.py
+++ b/task-sdk/src/airflow/sdk/api/datamodels/_generated.py
@@ -321,6 +321,7 @@ class DagWarningType(str, Enum):
     """
 
     ASSET_CONFLICT = "asset conflict"
+    ASSET_PARTITION_PENDING = "asset partition pending"
     DUPLICATE_DAG_ID = "duplicate dag id"
     NON_EXISTENT_POOL = "non-existent pool"
     RUNTIME_VARYING_VALUE = "runtime varying value"

Reply via email to