Blake
03/29/2024, 1:17 PMresult_storage
flow parameter when I am within the flow? Something like this:
@flow(
result_storage=s3_storage
)
def my_flow():
# Get the provided result storage
result_storage = ...
Marvin
03/29/2024, 1:18 PMresult_storage
or other flow configurations from within the flow itself isn't explicitly covered in the search results from the Prefect documentation. However, typically in Python, if you need a value, such as result_storage
, used in a decorator to be accessible within the function itself, you would have to either pass it as an argument to the function or set it as a global variable outside of the function.
Let's look at an example which demonstrates how to use a custom result storage and serializer. Though this example may not directly address your question, it is somewhat related. You can retrieve a result from custom storage by using prefect.results.PersistedResult
. But again, this focuses on accessing results, not the result_storage
parameter specifically (See GitHub Source).
If you're looking for a way to access the result_storage
object passed to a flow decorator from within the flow definition itself, this information might not be readily accessible or documented. A potential alternative in your cases might be to define result_storage
outside the @flow
decorator and pass it both to the decorator and within the flow if needed.
If you require a more definitive answer or a direct example, I can expand the search to GitHub issues to check if this query has come up within the community or if there is an established solution. Would you like me to do that?