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
bugfix: deferred tasks does not cancel when DAG is marked fail #20649
Conversation
@@ -70,7 +71,7 @@ def set_state( | |||
past: bool = False, | |||
state: TaskInstanceState = TaskInstanceState.SUCCESS, | |||
commit: bool = False, | |||
session=None, | |||
session: SASession = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please search for session: Session = NEW_SESSION
for a more idomatic way to annotate this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
# Mark only RUNNING task instances. | ||
# Mark only running task instances. | ||
task_ids = [task.task_id for task in dag.tasks] | ||
tis = ( | ||
session.query(TaskInstance) | ||
.filter( | ||
TaskInstance.dag_id == dag.dag_id, | ||
TaskInstance.execution_date == execution_date, | ||
TaskInstance.task_id.in_(task_ids), | ||
TaskInstance.state.in_(State.running), | ||
) | ||
.filter(TaskInstance.state == State.RUNNING) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Note for other reviewers) From what I can tell, this is the only functional change; all others are Mypy fixes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. That's right.
The PR is likely OK to be merged with just subset of tests for default Python and Database versions without running the full matrix of tests, because it does not modify the core of Airflow. If the committers decide that the full tests matrix is needed, they will add the label 'full tests needed'. Then you should rebase to the latest main or amend the last commit of the PR, and push it with --force-with-lease. |
(cherry picked from commit 64c0bd5)
(cherry picked from commit 64c0bd5)
bugfix: deferred tasks does not cancel when DAG is marked fail #20580 and fix typing
closes: #20580