This is an automated email from the ASF dual-hosted git repository.
potiuk 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 748a48ae62 Remove deprecations in airflow.models.dagrun (#41778)
748a48ae62 is described below
commit 748a48ae62bc173a5f0f90eb96a609c530effdbc
Author: Jens Scheffler <[email protected]>
AuthorDate: Tue Aug 27 16:15:05 2024 +0200
Remove deprecations in airflow.models.dagrun (#41778)
* Remove deprecations in airflow.models.dagrun
* Update newsfragments/41778.significant.rst
Co-authored-by: Jarek Potiuk <[email protected]>
---------
Co-authored-by: Jarek Potiuk <[email protected]>
---
airflow/models/dagrun.py | 37 +------------------------------------
newsfragments/41778.significant.rst | 4 ++++
2 files changed, 5 insertions(+), 36 deletions(-)
diff --git a/airflow/models/dagrun.py b/airflow/models/dagrun.py
index 1ff2f6316a..eefcd380af 100644
--- a/airflow/models/dagrun.py
+++ b/airflow/models/dagrun.py
@@ -19,7 +19,6 @@ from __future__ import annotations
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 import settings
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 @@ class DagRun(Base, LoggingMixin):
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 @@ class DagRun(Base, LoggingMixin):
)
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 0000000000..a26f1af939
--- /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.