hey there, a few questions regarding <result stora...
# ask-community
c
hey there, a few questions regarding result storage (in prefect 2): 1️⃣ can I use the
prefect.runtime
context with
result_storage
? i.e.
Copy code
result_storage=S3Bucket(
  bucket_name="foo_bucket",
  bucket_folder="state/{flow_run.flow_name}"
)
2️⃣ is there a way of setting
result_storage_key
more globally, e.g. through a ENVIRONMENT var?
b
Hi Constantino, I don't think you'll run into issues with using the runtime context in result storage. If you're looking to get the flow name from
flow_run
, I believe it will look like this:
runtime.flow_run.flow_name
I don't think there's an environment variable that sets the
result_storage_key
globally. The closest thing I've found is:
prefect config set PREFECT_DEFAULT_RESULT_STORAGE_BLOCK
, which sets the default storage location for your workflow, but you'd still need to set the
result_storage_key
at the task level.
IMO I think it's worth exploring adding an environment variable to achieve this. Mind creating an idea in the GitHub discussions? I can start one next week, unless you get to it before me.
c