You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "GertL (via GitHub)" <gi...@apache.org> on 2026/10/12 04:46:56 UTC
[PR] Resolve import error Dag teams once per page [airflow]
GertL opened a new pull request, #74570:
URL: https://github.com/apache/airflow/pull/74570
`GET /api/v2/importErrors` called `DagModel.get_dag_id_to_team_name_mapping` once for every import error on the page that has registered Dags, so a page of N errors made N extra queries.
The endpoint now collects the Dag ids of the whole page and resolves their teams in a single call. Authorization is unchanged: each file is still checked with `batch_is_authorized_dag` against its own Dags and their teams, and the stacktrace is redacted exactly as before. This matches how the same endpoint already resolves bundle teams for unregistered-file errors (`DagBundleModel.get_team_names`).
### Tests
- New `test_team_names_are_resolved_once_per_page`: three import errors in three files give one mapping call covering all three Dag ids, while each file is still authorized with its own Dag and team. It fails on the previous implementation.
- `tests/unit/api_fastapi/core_api/routes/public/test_import_error.py` passes (50 tests).
---
##### Was generative AI tooling used to co-author this PR?
- [X] Yes (please specify the tool below)
**Enola**: these insights were provided by enola https://github.com/enola-labs/enola
Generated-by: Claude Code following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
--
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] Resolve import error Dag teams once per page [airflow]
Posted by "vincbeck (via GitHub)" <gi...@apache.org>.
vincbeck commented on code in PR #74570:
URL: https://github.com/apache/airflow/pull/74570#discussion_r4246925901
##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/import_error.py:
##########
@@ -297,18 +297,24 @@ def get_import_errors(
import_errors_result: Iterable[tuple[ParseImportError, Iterable]] = groupby(
session.execute(import_errors_select), itemgetter(0)
)
+ errors_with_dag_ids = [
+ (import_error, [dag_id for _, dag_id in file_dag_ids_iter if dag_id is not None])
+ for import_error, file_dag_ids_iter in import_errors_result
+ ]
+ # One team lookup for the whole page rather than one per import error.
Review Comment:
I find these comments useless, typical AI. It comments something it changed/removed. Very confusing
--
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