Skip to content

Rename dagrun update state - #71347

Closed
fat-catTW wants to merge 1 commit into
apache:mainfrom
fat-catTW:rename-dagrun-update-state
Closed

Rename dagrun update state#71347
fat-catTW wants to merge 1 commit into
apache:mainfrom
fat-catTW:rename-dagrun-update-state

Conversation

@fat-catTW

@fat-catTW fat-catTW commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Rename the internal DagRun scheduling decision method from update_state() to schedule_dag_run().

This PR only changes the Python method name used when the scheduler advances a DagRun through one scheduling decision pass. The method still performs the same work as before: evaluating task instances, returning schedulable TIs, updating the DagRun state when appropriate, and preparing callbacks.

Tests were updated to use the new name, and the compatibility alias is covered to ensure calls without an explicit session still receive one via @provide_session.

Scope:

  • Rename DagRun.update_state() implementation to DagRun.schedule_dag_run().
  • Keep DagRun.update_state() as a compatibility alias.
  • Update scheduler, dag.test(), and DagRun-related tests to call schedule_dag_run().
  • Leave unrelated update_state APIs untouched, including TaskInstance Execution API state updates and connection test state updates.
  • No database schema, ORM model, migration, or serialized data changes.

Tests run:

  • uv run ruff format airflow-core/src/airflow/models/dagrun.py airflow-core/tests/unit/models/test_dagrun.py
  • uv run ruff check --fix airflow-core/src/airflow/models/dagrun.py airflow-core/tests/unit/models/test_dagrun.py
  • uv run --project airflow-core pytest airflow-core/tests/unit/models/test_dagrun.py::TestDagRun::test_update_state_delegates_to_schedule_dag_run -xvs
  • uv run --project airflow-core pytest airflow-core/tests/unit/models/test_dagrun.py::TestDagRun::test_schedule_dag_run_one_unfinished airflow-core/tests/unit/models/test_dag.py::TestDag::test_dag_paused_after_limit_orders_by_run_after -xvs
  • uv run --project airflow-core pytest airflow-core/tests/unit/jobs/test_scheduler_job.py::TestSchedulerJob::test_update_dagrun_state_for_paused_dag airflow-core/tests/unit/jobs/test_scheduler_job.py::TestSchedulerJob::test_update_dagrun_state_for_paused_dag_not_for_backfill -xvs
Was generative AI tooling used to co-author this PR?
  • [X] Yes (please specify the tool below)

Generated-by: [Codex] following the guidelines


  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.

@boring-cyborg boring-cyborg Bot added area:db-migrations PRs with DB migration area:deadline-alerts AIP-86 (former AIP-57) area:Scheduler including HA (high availability) scheduler area:task-sdk kind:documentation labels Aug 9, 2026
@uranusjr

uranusjr commented Aug 9, 2026

Copy link
Copy Markdown
Member

The PR title and description should be updated to reflect the scope this PR touches. I would not expect the rename to trigger database migrations.

@fat-catTW
fat-catTW force-pushed the rename-dagrun-update-state branch from 9878dc2 to c30e674 Compare August 10, 2026 06:04
@fat-catTW

Copy link
Copy Markdown
Contributor Author

Thanks for the review.
I found that my PR branch was accidentally based on another local branch, so the diff included unrelated ExecutorCallback/DagRun reference changes.

I rebased rename-dagrun-update-state onto upstream/main and force-pushed with lease. The PR diff should now only include the internal DagRun.update_state()DagRun.schedule_dag_run() rename and related call-site/test updates. There are no database schema, ORM field, migration, or serialized data changes in this PR now.

I also updated the description.

@kaxil

kaxil commented Aug 10, 2026

Copy link
Copy Markdown
Member

It does way more than just scheduling, I don't see a motivation for the rename

@kaxil kaxil closed this Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:db-migrations PRs with DB migration area:deadline-alerts AIP-86 (former AIP-57) area:Scheduler including HA (high availability) scheduler area:task-sdk kind:documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants