Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,7 @@ repos:
^airflow-ctl.*\.py$|
^airflow-core/src/airflow/models/.*\.py$|
^airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_assets.py$|
^providers/cncf/kubernetes/.*\.py$|
^dev/airflow_perf/scheduler_dag_execution_timing.py$|
^providers/openlineage/.*\.py$|
^task_sdk.*\.py$
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
from kubernetes.client.rest import ApiException as SyncApiException
from kubernetes_asyncio.client.exceptions import ApiException as AsyncApiException
from slugify import slugify
from sqlalchemy import select
from urllib3.exceptions import HTTPError

from airflow.configuration import conf
Expand Down Expand Up @@ -175,15 +176,14 @@ def annotations_to_key(annotations: dict[str, str]) -> TaskInstanceKey:
raise RuntimeError("Session not configured. Call configure_orm() first.")
session = Session()

task_instance_run_id = (
session.query(TaskInstance.run_id)
task_instance_run_id = session.scalar(
select(TaskInstance.run_id)
.join(TaskInstance.dag_run)
.filter(
.where(
TaskInstance.dag_id == dag_id,
TaskInstance.task_id == task_id,
getattr(DagRun, logical_date_key) == logical_date,
)
.scalar()
)
else:
task_instance_run_id = annotation_run_id
Expand Down