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

Fix cleaning zombie RESTARTING tasks #33706

Merged
merged 3 commits into from
Aug 24, 2023
Merged

Conversation

Bisk1
Copy link
Contributor

@Bisk1 Bisk1 commented Aug 24, 2023

Resolves #33661

Added RESTARTING state to the list of task instance states that are handled by scheduler in adopt_or_reset_orphaned_tasks(). This way the system can recover from the situation when a task was set to RESTARTING state externally (webserver request) but both task process and scheduler were dead when it happened.

This approach is safe because adopt_or_reset_orphaned_tasks() only modifies tasks that were queued by a scheduler that is no longer running. In theory it could reset a task which is still running even though its scheduler is dead, but it is identical situation as with RUNNING tasks which are also updated by this method.


^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an 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 a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in newsfragments.

@boring-cyborg boring-cyborg bot added the area:Scheduler including HA (high availability) scheduler label Aug 24, 2023
@boring-cyborg
Copy link

boring-cyborg bot commented Aug 24, 2023

Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst)
Here are some useful points:

  • Pay attention to the quality of your code (ruff, mypy and type annotations). Our pre-commits will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example DAG that shows how users should use it.
  • Consider using Breeze environment for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
  • Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: [email protected]
    Slack: https://s.apache.org/airflow-slack

@potiuk
Copy link
Member

potiuk commented Aug 24, 2023

As discussed in the issue #33706 - that sounds good. But I would love others who know more about inricacise of executors might chime in ? :D

@potiuk potiuk added this to the Airflow 2.7.1 milestone Aug 24, 2023
daniel.dylag added 2 commits August 24, 2023 23:55
Renamed to adoptable_states because adoption is preferrable choice and reset is fallback.
Also "resettable" might be confused with RESTARTING itself.
@potiuk potiuk merged commit 5c35786 into apache:main Aug 24, 2023
42 checks passed
@boring-cyborg
Copy link

boring-cyborg bot commented Aug 24, 2023

Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions.

@Bisk1 Bisk1 deleted the fix-zombie-restarting branch August 25, 2023 00:27
@ephraimbuddy ephraimbuddy added the type:bug-fix Changelog: Bug Fixes label Aug 28, 2023
ephraimbuddy pushed a commit that referenced this pull request Aug 28, 2023
* Fix cleaning zombie RESTARTING tasks

* Fix test

* Improve naming

Renamed to adoptable_states because adoption is preferrable choice and reset is fallback.
Also "resettable" might be confused with RESTARTING itself.

---------

Co-authored-by: daniel.dylag <[email protected]>
(cherry picked from commit 5c35786)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:Scheduler including HA (high availability) scheduler type:bug-fix Changelog: Bug Fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Zombie tasks in RESTARTING state are not cleaned
4 participants