https://prefect.io logo
Title
m

Mike Grabbe

03/16/2023, 3:45 PM
Is there a way to globally configure result persistence to S3 for all flows & tasks in a workspace? I know how to persist results to S3 on an individual flow, but I was hoping to find a way to avoid duplicating this configuration across our deployed flows.
1
r

redsquare

03/16/2023, 4:39 PM
You could decorate the flow decorator and persist in a common fashion across all your flows - we do this for logging/dataadog and a few other things
🙌 1
m

Mike Grabbe

03/16/2023, 5:10 PM
Ooo I like that idea
Thank you!
👍 1
n

Nate

03/17/2023, 6:36 PM
just another idea: I made a small util for something like this that could be customized, here i just mapped: workspace -> result storage block name
r

redsquare

03/17/2023, 6:38 PM
@Nate how does that work?
n

Nate

03/17/2023, 6:39 PM
you could say
result_storage=result_storage_from_env()
in your flow decorator (like this) and it would select a result storage based on which workspace the client finds itself in
r

redsquare

03/17/2023, 6:40 PM
ah neat, and it auto syncs it
not seen that pattern before, it works as you inherit from block
c# dev here
n

Nate

03/17/2023, 6:42 PM
yeah i just made it bc I was testing a deployment in one workspace and eventually wanted to deploy in another and yeah, a neat little tidbit about blocks is that you can load a block instance of any Block subclass via
Block.load("block-type-name/block-document-name")
r

redsquare

03/17/2023, 6:45 PM
was never certain decorating the flow decorator was a good idea, ramifications futher down the line