You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "kaxil (via GitHub)" <gi...@apache.org> on 2026/03/20 00:23:43 UTC

[PR] Add INFO-level logging to asset scheduling path [airflow]

kaxil opened a new pull request, #63958:
URL: https://github.com/apache/airflow/pull/63958

   The scheduler's asset (dataset) condition evaluation path had zero INFO-level logging, making it impossible to debug why asset-triggered DagRuns were created or skipped. This was a significant gap discovered during a debugging session where the root cause took hours to trace because the scheduler was a complete black box for asset scheduling.
   
   Add log lines for:
   - ADRQ records loaded per DAG (count and DAG IDs)
   - Asset condition evaluation result (met/not met per DAG)
   - DAGs deferred due to max_active_runs
   - Asset-triggered DagRun creation (DAG ID, triggered_date, queued count)
   - Consumed asset events count per DagRun
   - ADRQ rows deleted after DagRun creation
   
    <!-- SPDX-License-Identifier: Apache-2.0
         https://www.apache.org/licenses/LICENSE-2.0 -->
   
   <!--
   Thank you for contributing!
   
   Please provide above a brief description of the changes made in this pull request.
   Write a good git commit message following this guide: http://chris.beams.io/posts/git-commit/
   
   Please make sure that your code changes are covered with tests.
   And in case of new features or big changes remember to adjust the documentation.
   
   Feel free to ping (in general) for the review if you do not see reaction for a few days
   (72 Hours is the minimum reaction time you can expect from volunteers) - we sometimes miss notifications.
   
   In case of an existing issue, reference it using one of the following:
   
   * closes: #ISSUE
   * related: #ISSUE
   -->
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   <!--
   If generative AI tooling has been used in the process of authoring this PR, please
   change below checkbox to `[X]` followed by the name of the tool, uncomment the "Generated-by".
   -->
   
   - [ ] Yes (please specify the tool below)
   
   <!--
   Generated-by: [Tool Name] following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   -->
   
   ---
   
   * Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)** for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
   * For fundamental code changes, an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals)) is needed.
   * When adding dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
   * For significant user-facing changes create newsfragment: `{pr_number}.significant.rst`, in [airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments). You can add this file in a follow-up commit after the PR is created so you know the PR number.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add INFO-level logging to asset scheduling path [airflow]

Posted by "kaxil (via GitHub)" <gi...@apache.org>.
kaxil merged PR #63958:
URL: https://github.com/apache/airflow/pull/63958


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add INFO-level logging to asset scheduling path [airflow]

Posted by "Lee-W (via GitHub)" <gi...@apache.org>.
Lee-W commented on code in PR #63958:
URL: https://github.com/apache/airflow/pull/63958#discussion_r2964233859


##########
airflow-core/src/airflow/jobs/scheduler_job_runner.py:
##########
@@ -2090,15 +2096,26 @@ def _create_dag_runs_asset_triggered(
             )
             Stats.incr("asset.triggered_dagruns")
             dag_run.consumed_asset_events.extend(asset_events)
+            self.log.info(
+                "Created asset-triggered DagRun for '%s': run_id=%s, consumed %d asset events",
+                dag.dag_id,
+                dag_run.run_id,
+                len(asset_events),
+            )
 
             # Delete only consumed ADRQ rows to avoid dropping newly queued events
             # (e.g. DagRun triggered by asset A while a new event for asset B arrives).
             adrq_pks = [(record.asset_id, record.target_dag_id) for record in queued_adrqs]
-            session.execute(
+            result = session.execute(
                 delete(AssetDagRunQueue).where(
                     tuple_(AssetDagRunQueue.asset_id, AssetDagRunQueue.target_dag_id).in_(adrq_pks)
                 )
             )
+            self.log.info(
+                "Deleted %d ADRQ rows for '%s'",
+                result.rowcount,

Review Comment:
   ```suggestion
                   result.rowcount if result else 0,
   ```



##########
airflow-core/src/airflow/models/dag.py:
##########
@@ -698,6 +706,10 @@ def dag_ready(dag_id: str, cond: SerializedAssetBase, statuses: dict[UKey, bool]
                 )
             )
             if exclusion_list:
+                log.info(
+                    "Asset-triggered DAGs at max_active_runs, deferring: %s",

Review Comment:
   ```suggestion
                       "Asset-triggered Dags at max_active_runs, deferring: %s",
   ```



##########
airflow-core/src/airflow/models/dag.py:
##########
@@ -665,6 +665,12 @@ def dag_ready(dag_id: str, cond: SerializedAssetBase, statuses: dict[UKey, bool]
             else:
                 adrq_by_dag[adrq.target_dag_id].append(adrq)
 
+        if adrq_by_dag:
+            log.info(
+                "Asset-triggered DAGs with queued events: %s",

Review Comment:
   ```suggestion
                   "Asset-triggered Dags with queued events: %s",
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org