Closed BlakeEriks closed 2 months ago
hi @BlakeEriks - thanks for the issue!
Assuming you mean to pass result_storage_key
as a task
setting, you should be able to do this today with get_run_context
and with_options
, something like
from prefect import flow, task
from prefect.context import get_run_context
@task
def some_task():
return "hello"
@flow(version="somespecialflowversion")
def some_flow():
current_flow_version = get_run_context().flow.version
some_task.with_options(result_storage_key=current_flow_version)()
if __name__ == "__main__":
some_flow()
if you're thinking that there would be a preferable DX, feel free to express that here!
EDIT
I see the motivating slack thread now!
Describe the current behavior
Currently, the runtime only supports a subset of the information for a flow on a given flow run.
Namely:
Describe the proposed behavior
I would like more information on the flow to be available in the runtime, namely the
version
for the flow associated with the current flow_run.Example Use
A user could leverage this information from the runtime within their
result_storage_key
for a flow.This would allow me to invalidate the result storage cache by incrementing my flow version.
Additional context
No response