-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Add default store for transactions #13983
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! one nit about the default name, otherwise LGTM
src/prefect/transactions.py
Outdated
default_name = PREFECT_DEFAULT_RESULT_STORAGE_BLOCK.value().split("/")[ | ||
-1 | ||
] | ||
default_storage.save(default_name, _sync=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this need an overwrite flag?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It shouldn't because we only run this save after confirming it hasn't been loaded from the server, but I'll add overwrite=True
to be safe since that should guard against race conditions.
Co-authored-by: Chris White <chris@prefect.io>
Add a default store and key for transactions opened via the
transaction
context manager from inside a flow. Thetransaction
context manager will use a copy of theResultFactory
from the flow or task run context withpersist_result
set toTrue
. ThatResultFactory
copy will also use the default result storage block if one was not provided to the flow.The
PREFECT_DEFAULT_RESULT_STORAGE_BLOCK
has been updated to default to aLocalFilesystem
block with the name containing a slugified version of the hostname of the current machine (to avoid conflicts with other users). This block will be created when a transaction is opened with nostore
provided.Example
Run a transaction in flow with default record transaction storage:
First run with log the following:
Subsequent runs will log the following (previous transaction value will be used):
Checklist
<link to issue>
"maintenance
,fix
,feature
,enhancement
,docs
.For documentation changes:
mint.json
for files that are removed or renamed.For new functions or classes in the Python SDK:
docs/mint.json
navigation.