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

Turn on task persistence by default #14102

Merged
merged 7 commits into from
Jun 18, 2024
Merged

Conversation

desertaxle
Copy link
Member

@desertaxle desertaxle commented Jun 18, 2024

To ensure we get idempotency for tasks out of the box, we need to ensure that tasks persist their results by default. With this PR, persist_result will default to True for all tasks. If persist_result is set to false, then the cache_policy will be ignored.

To facilitate writing results by default, we will attempt to load a default storage block matching the default storage block configured with PREFECT_DEFAULT_RESULT_STORAGE_BLOCK. If that block doesn't exist (defaults to {hostname}-storage), we will create and save that block for the user. That block will be reused for subsequent runs.

Closes #14087

Example

Checklist

  • This pull request includes a label categorizing the change e.g. maintenance, fix, feature, enhancement, docs.
  • This pull request references any related issue by including "closes <link to issue>"
    • If no issue exists and your change is not a small fix, please create an issue first.
  • If this pull request adds new functionality, it includes unit tests that cover the changes
  • If this pull request removes docs files, it includes redirect settings in mint.json.
  • If this pull request adds functions or classes, it includes helpful docstrings.

@desertaxle desertaxle added the enhancement An improvement of an existing feature label Jun 18, 2024
@desertaxle desertaxle marked this pull request as ready for review June 18, 2024 16:03
@desertaxle desertaxle requested review from chrisguidry and a team as code owners June 18, 2024 16:03
@desertaxle desertaxle requested review from cicdw and removed request for a team and chrisguidry June 18, 2024 16:03
Copy link
Member

@cicdw cicdw left a comment

Choose a reason for hiding this comment

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

One request on the init logic, otherwise LGTM!

src/prefect/tasks.py Outdated Show resolved Hide resolved
Copy link
Member

@cicdw cicdw left a comment

Choose a reason for hiding this comment

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

Good stuff, LGTM

@desertaxle desertaxle merged commit ee7924b into main Jun 18, 2024
26 checks passed
@desertaxle desertaxle deleted the task-result-persistence-by-default branch June 18, 2024 17:26
@desertaxle
Copy link
Member Author

Related to #13800

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An improvement of an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tasks need persist_result=True to persist transaction records
2 participants