Skip to content
Merged
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
37 changes: 1 addition & 36 deletions airflow/models/dagrun.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions newsfragments/41778.significant.rst
Original file line number Diff line number Diff line change
@@ -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.