Skip to content
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

Merged
merged 1 commit into from Jan 5, 2022
Merged

bugfix: deferred tasks does not cancel when DAG is marked fail #20649

merged 1 commit into from Jan 5, 2022

Conversation

dungdm93
Copy link
Contributor

@dungdm93 dungdm93 commented Jan 4, 2022

bugfix: deferred tasks does not cancel when DAG is marked fail #20580 and fix typing
closes: #20580

@boring-cyborg boring-cyborg bot added the area:API Airflow's REST/HTTP API label Jan 4, 2022
@@ -70,7 +71,7 @@ def set_state(
past: bool = False,
state: TaskInstanceState = TaskInstanceState.SUCCESS,
commit: bool = False,
session=None,
session: SASession = None,
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

Comment on lines 340 to 390
# 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)
)
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. That's right.

@dungdm93 dungdm93 requested a review from uranusjr January 4, 2022 09:51
@github-actions github-actions bot added the okay to merge It's ok to merge this PR as it does not require more tests label Jan 4, 2022
@github-actions
Copy link

github-actions bot commented Jan 4, 2022

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.

@ephraimbuddy ephraimbuddy added this to the Airflow 2.2.4 milestone Jan 5, 2022
@ephraimbuddy ephraimbuddy merged commit 64c0bd5 into apache:main Jan 5, 2022
@jedcunningham jedcunningham added the type:bug-fix Changelog: Bug Fixes label Jan 28, 2022
jedcunningham pushed a commit that referenced this pull request Jan 28, 2022
jedcunningham pushed a commit that referenced this pull request Feb 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:API Airflow's REST/HTTP API okay to merge It's ok to merge this PR as it does not require more tests type:bug-fix Changelog: Bug Fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Triggers are not terminated when DAG is mark failed
4 participants