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

support retry_delay_seconds in task engine #13815

Merged
merged 9 commits into from
Jun 5, 2024

Conversation

zzstoatzz
Copy link
Contributor

@zzstoatzz zzstoatzz commented Jun 5, 2024

supersedes #13785 and #13796

this PR updates handle_retry in the task engine to support retry_delay_seconds as a int | float | Sequence[int | float] | Callable

handle_retry will:

  • set the state to Retrying() if no delay
  • set the state to AwaitingRetry() if there's a retry delay with a delayed scheduled time

a new async method wait_until_ready on the engine (which is run_sync_as_coro to in the sync case to avoid duplication) will sleep until the scheduled run time

notably, this PR will handle the case where the number of attempted task retries is greater than len(retry_delay_seconds) (when its a Sequence) by repeating the final delay in the Sequence

@zzstoatzz zzstoatzz changed the title support retry_delay_seconds support retry_delay_seconds in task engine Jun 5, 2024
@zzstoatzz zzstoatzz marked this pull request as ready for review June 5, 2024 19:40
@zzstoatzz zzstoatzz requested a review from a team as a code owner June 5, 2024 19:40
src/prefect/task_engine.py Outdated Show resolved Hide resolved
@zzstoatzz zzstoatzz mentioned this pull request Jun 5, 2024
6 tasks
@zzstoatzz zzstoatzz self-assigned this Jun 5, 2024
@zzstoatzz zzstoatzz added the fix A fix for a bug in an existing feature label Jun 5, 2024
@zzstoatzz zzstoatzz requested review from jlowin and cicdw June 5, 2024 20:07
@zzstoatzz zzstoatzz requested a review from desertaxle June 5, 2024 20:27
Copy link
Member

@desertaxle desertaxle left a comment

Choose a reason for hiding this comment

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

LGTM!

@zzstoatzz zzstoatzz merged commit e3d066f into main Jun 5, 2024
23 of 27 checks passed
@zzstoatzz zzstoatzz deleted the task-retry-delay-seconds-refactor branch June 5, 2024 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix A fix for a bug in an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants