AIP-72: Handling up_for_retry task instance states#45070
Closed
amoghrajesh wants to merge 3 commits into
Closed
Conversation
amoghrajesh
commented
Dec 19, 2024
Comment on lines
+375
to
+387
| def _is_eligible_to_retry(task_instance, task_retries: int): | ||
| """ | ||
| Is task instance is eligible for retry. | ||
|
|
||
| :param task_instance: the task instance | ||
|
|
||
| :meta private: | ||
| """ | ||
| if task_instance.state == State.RESTARTING: | ||
| # If a task is RESTARTING state it is always eligible for retry | ||
| return True | ||
|
|
||
| return task_retries and task_instance.try_number <= task_instance.max_tries |
Contributor
Author
There was a problem hiding this comment.
Mainly a port over of
airflow/airflow/models/taskinstance.py
Lines 1053 to 1072 in 088242a
Tried splitting it too because we do not have "task_instance.task" here
Comment on lines
+301
to
+314
| except (AirflowTaskTimeout, AirflowException): | ||
| # Couldn't load the task, don't know number of retries, guess | ||
| if not getattr(ti, "task", None): | ||
| # Let us set the task_retries to default = 0 | ||
| msg = RetryTask( | ||
| end_date=datetime.now(tz=timezone.utc), | ||
| task_retries=0, | ||
| ) | ||
| else: | ||
| msg = RetryTask( | ||
| end_date=datetime.now(tz=timezone.utc), | ||
| # is `or 0` needed? | ||
| task_retries=ti.task.retries or 0, | ||
| ) |
Contributor
Author
There was a problem hiding this comment.
As for the API and this PR, all we should care about is whether we should retry or not. The task ran, complained that it needs to retry, so we send a retry API call. The core logic of how retry works should be out of the scope of this PR.
Contributor
Author
|
We do not need this PR anymore, handled using #45106 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
^ 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.rstor{issue_number}.significant.rst, in newsfragments.