New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix max_active_runs not allowing moving of queued dagruns to running #17945
Conversation
eb6de0e
to
cd4c66a
Compare
What happens is that the method |
When you say wont schedule -- do you mean that the dagruns will take a long time to get out of queued state, but once a dag run is in running state tasks should be scheduled fine -- cos the code you have changed only affects DagRuns going from queued -> running state -- nothing there will affect task scheduling. |
You are right. Not scheduling but moving from queued to running, I will update it rightly now |
fb84e28
to
4a3503e
Compare
Currently, if you set max_active_runs for a dag and that dag has many queued dagruns with execution dates older than another dag's queued dagruns, airflow will not move the newer queued dagruns to running with effect that only one dagruns would be in running at any time This PR fixes this by updating the DagRun.last_scheduling_decision whenever a decision of scheduling was made Update airflow/jobs/scheduler_job.py Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com> Correctly set dagrun state to running
4a3503e
to
d0f0f6d
Compare
The PR most likely needs to run full matrix of tests because it modifies parts of the core of Airflow. However, committers might decide to merge it quickly and take the risk. If they don't merge it quickly - please rebase it to the latest main at your convenience, or amend the last commit of the PR, and push it with --force-with-lease. |
We made a fix that resolved max_active_runs not allowing other dagruns to move to running state, see apache#17945 and introduced a bug that dagruns were not following the execution_date order when moving to running state. This PR fixes it by adding a 'max_active_runs` column in dagmodel. Also an extra test not connected with this change was added because I was able to trigger the bug while working on this fixup! Fix DagRun execution order not being properly followed fixup! fixup! Fix DagRun execution order not being properly followed fixup! Fix DagRun execution order not being properly followed fixup! fixup! Fix DagRun execution order not being properly followed fixup! Fix DagRun execution order not being properly followed Use subquery as mysql 5.7 doesn't support cte fix doc error Apply suggestions from code review
…followed (#18061) We made a fix that resolved max_active_runs not allowing other dagruns to move to running state, see #17945 and introduced a bug that dagruns were not following the execution_date order when moving to running state. This PR fixes it by adding a 'max_active_runs` column in dagmodel. Also an extra test not connected with this change was added because I was able to trigger the bug while working on this
…17945) Currently, if you set max_active_runs for a dag and that dag has many queued dagruns with execution dates older than another dag's queued dagruns, airflow will not move the newer queued dagruns to running with the effect that only one dagruns would be in running at any time This PR fixes this by updating the DagRun.last_scheduling_decision whenever a decision of scheduling was made (cherry picked from commit 430976c)
…followed (#18061) We made a fix that resolved max_active_runs not allowing other dagruns to move to running state, see #17945 and introduced a bug that dagruns were not following the execution_date order when moving to running state. This PR fixes it by adding a 'max_active_runs` column in dagmodel. Also an extra test not connected with this change was added because I was able to trigger the bug while working on this (cherry picked from commit ebbe2b4)
FWIW can confirm this fixed my issue in #17638, so big thanks! Note I did have an issue after upgrading where the |
Interesting. |
https://github.com/apache/airflow/pull/17945/files# which is reverted as schedules tasks out of order but does work correctly when depends on past is true.
Currently, if you set max_active_runs for a dag and that dag has many queued dagruns
with execution dates older than another dag's queued dagruns, airflow will not move
the newer queued dagruns to running with the effect that only one dagruns would be in running at any time
This PR fixes this by updating the DagRun.last_scheduling_decision whenever a decision of scheduling
was made
Related: #14205
^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code change, Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in UPDATING.md.