diff --git a/airflow/models/dagrun.py b/airflow/models/dagrun.py index 1ff2f6316a5a7..eefcd380af3ca 100644 --- a/airflow/models/dagrun.py +++ b/airflow/models/dagrun.py @@ -19,7 +19,6 @@ import itertools import os -import warnings from collections import defaultdict from typing import TYPE_CHECKING, Any, Callable, Iterable, Iterator, NamedTuple, Sequence, TypeVar, overload @@ -51,7 +50,7 @@ from airflow.api_internal.internal_api_call import internal_api_call from airflow.callbacks.callback_requests import DagCallbackRequest from airflow.configuration import conf as airflow_conf -from airflow.exceptions import AirflowException, RemovedInAirflow3Warning, TaskNotFound +from airflow.exceptions import AirflowException, TaskNotFound from airflow.listeners.listener import get_listener_manager from airflow.models import Log from airflow.models.abstractoperator import NotMapped @@ -1500,31 +1499,6 @@ def _revise_map_indexes_if_mapped(self, task: Operator, *, session: Session) -> session.flush() yield ti - @staticmethod - def get_run(session: Session, dag_id: str, execution_date: datetime) -> DagRun | None: - """ - Get a single DAG Run. - - :meta private: - :param session: Sqlalchemy ORM Session - :param dag_id: DAG ID - :param execution_date: execution date - :return: DagRun corresponding to the given dag_id and execution date - if one exists. None otherwise. - """ - warnings.warn( - "This method is deprecated. Please use SQLAlchemy directly", - RemovedInAirflow3Warning, - stacklevel=2, - ) - return session.scalar( - select(DagRun).where( - DagRun.dag_id == dag_id, - DagRun.external_trigger == False, # noqa: E712 - DagRun.execution_date == execution_date, - ) - ) - @property def is_backfill(self) -> bool: return self.run_type == DagRunType.BACKFILL_JOB @@ -1668,15 +1642,6 @@ def _get_log_template( ) return template - @provide_session - def get_log_filename_template(self, *, session: Session = NEW_SESSION) -> str: - warnings.warn( - "This method is deprecated. Please use get_log_template instead.", - RemovedInAirflow3Warning, - stacklevel=2, - ) - return self.get_log_template(session=session).filename - @staticmethod def _get_partial_task_ids(dag: DAG | None) -> list[str] | None: return dag.task_ids if dag and dag.partial else None diff --git a/newsfragments/41778.significant.rst b/newsfragments/41778.significant.rst new file mode 100644 index 0000000000000..a26f1af939878 --- /dev/null +++ b/newsfragments/41778.significant.rst @@ -0,0 +1,4 @@ +Removed a set of deprecations in from ``airflow.models.dagrun``. + +- Removed deprecated method ``DagRun.get_run()``. Instead you should use standard Sqlalchemy DagRun model retrieval. +- Removed deprecated method ``DagRun.get_log_filename_template()``. Please use ``get_log_template()`` instead.