This is an automated email from the ASF dual-hosted git repository.
dstandish 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 36c3ee55f4 Remove DagRun.is_backfill attribute (#42548)
36c3ee55f4 is described below
commit 36c3ee55f4287990f92827b55c79ab87263159dd
Author: Daniel Standish <[email protected]>
AuthorDate: Fri Sep 27 13:25:19 2024 -0700
Remove DagRun.is_backfill attribute (#42548)
This attribute is only used in one place and is not very useful.
---
airflow/models/dagrun.py | 6 +-----
newsfragments/42548.significant.rst | 1 +
tests/jobs/test_scheduler_job.py | 5 ++---
3 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/airflow/models/dagrun.py b/airflow/models/dagrun.py
index 3ef1c18f15..5d53e51763 100644
--- a/airflow/models/dagrun.py
+++ b/airflow/models/dagrun.py
@@ -1267,7 +1267,7 @@ class DagRun(Base, LoggingMixin):
def task_filter(task: Operator) -> bool:
return task.task_id not in task_ids and (
- self.is_backfill
+ self.run_type == DagRunType.BACKFILL_JOB
or (task.start_date is None or task.start_date <=
self.execution_date)
and (task.end_date is None or self.execution_date <=
task.end_date)
)
@@ -1538,10 +1538,6 @@ class DagRun(Base, LoggingMixin):
session.flush()
yield ti
- @property
- def is_backfill(self) -> bool:
- return self.run_type == DagRunType.BACKFILL_JOB
-
@classmethod
@provide_session
def get_latest_runs(cls, session: Session = NEW_SESSION) -> list[DagRun]:
diff --git a/newsfragments/42548.significant.rst
b/newsfragments/42548.significant.rst
new file mode 100644
index 0000000000..28d6795eeb
--- /dev/null
+++ b/newsfragments/42548.significant.rst
@@ -0,0 +1 @@
+Remove is_backfill attribute from DagRun object
diff --git a/tests/jobs/test_scheduler_job.py b/tests/jobs/test_scheduler_job.py
index 52e9dbdeb1..78a911153d 100644
--- a/tests/jobs/test_scheduler_job.py
+++ b/tests/jobs/test_scheduler_job.py
@@ -601,8 +601,7 @@ class TestSchedulerJob:
ti1.state = State.SCHEDULED
session.merge(ti1)
session.flush()
-
- assert dr1.is_backfill
+ assert dr1.run_type == DagRunType.BACKFILL_JOB
self.job_runner._critical_section_enqueue_task_instances(session)
session.flush()
@@ -3851,7 +3850,7 @@ class TestSchedulerJob:
session.merge(dr1)
session.flush()
- assert dr1.is_backfill
+ assert dr1.run_type == DagRunType.BACKFILL_JOB
assert 0 ==
self.job_runner.adopt_or_reset_orphaned_tasks(session=session)
session.rollback()